소스 검색

Mise en place de la structure permettant de traduire l'appli (voir bug #38) pour le layout > encore beaucoup de boulot !

Marien Fressinaud 13 년 전
부모
커밋
a3b989b5e4
7개의 변경된 파일84개의 추가작업 그리고 39개의 파일을 삭제
  1. 3 0
      app/App_FrontController.php
  2. 42 0
      app/i18n/fr.php
  3. 4 4
      app/layout/aside_configure.phtml
  4. 5 5
      app/layout/aside_feed.phtml
  5. 10 10
      app/layout/aside_flux.phtml
  6. 9 9
      app/layout/header.phtml
  7. 11 11
      app/layout/nav_menu.phtml

+ 3 - 0
app/App_FrontController.php

@@ -11,6 +11,9 @@ class App_FrontController extends FrontController {
 		$this->loadModels ();
 
 		Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?)
+		Session::_param ('language', 'fr');
+		Translate::init ();
+
 		$this->loadParamsView ();
 		$this->loadStylesAndScripts ();
 		$this->loadNotifications ();

+ 42 - 0
app/i18n/fr.php

@@ -0,0 +1,42 @@
+<?php
+
+return array (
+	'login'				=> 'Connexion',
+	'logout'			=> 'Déconnexion',
+	'search_on_title'		=> 'Rechercher sur les titres',
+
+	'configuration'			=> 'Configuration',
+	'general_and_reading'		=> 'Général et lecture',
+	'categories'			=> 'Catégories',
+	'category'			=> 'Catégorie',
+	'shortcuts'			=> 'Raccourcis',
+	'about'				=> 'À propos',
+
+	'your_rss_feeds'		=> 'Vos flux RSS',
+	'add_rss_feed'			=> 'Ajouter un flux RSS',
+	'no_rss_feed'			=> 'Aucun flux RSS',
+	'import_export_opml'		=> 'Importer / exporter (OPML)',
+
+	'subscription_management'	=> 'Gestion des abonnements',
+	'all_feeds'			=> 'Tous (%d)',
+	'favorite_feeds'		=> 'Favoris (%d)',
+	'not_read'			=> '%d non lu',
+	'not_reads'			=> '%d non lus',
+
+	'filter'			=> 'Filtrer',
+	'see_website'			=> 'Voir le site',
+	'administration'		=> 'Gestion',
+	'actualize'			=> 'Actualiser',
+
+	'mark_read'			=> 'Marquer comme lu',
+	'mark_all_read'			=> 'Tout marquer comme lu',
+	'mark_feed_read'		=> 'Marquer le flux comme lu',
+	'mark_cat_read'			=> 'Marquer la catégorie comme lue',
+	'before_one_day'		=> 'Antérieurs à 1 jour',
+	'before_one_week'		=> 'Antérieurs à 1 semaine',
+	'display'			=> 'Affichage',
+	'show_all'			=> 'Tout afficher',
+	'show_not_reads'		=> 'Afficher les non lus',
+	'older_first'			=> 'Plus anciens en premier',
+	'newer_first'			=> 'Plus récents en premier',
+);

+ 4 - 4
app/layout/aside_configure.phtml

@@ -1,13 +1,13 @@
 <div class="nav nav-list aside">
-	<li class="nav-header">Configuration</li>
+	<li class="nav-header"><?php echo Translate::t ('configuration'); ?></li>
 
 	<li class="item<?php echo Request::actionName () == 'display' ? ' active' : ''; ?>">
-		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'display')); ?>">Général et lecture</a>
+		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'display')); ?>"><?php echo Translate::t ('general_and_reading'); ?></a>
 	</li>
 	<li class="item<?php echo Request::actionName () == 'categorize' ? ' active' : ''; ?>">
-		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'categorize')); ?>">Catégories</a>
+		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'categorize')); ?>"><?php echo Translate::t ('categories'); ?></a>
 	</li>
 	<li class="item<?php echo Request::actionName () == 'shortcut' ? ' active' : ''; ?>">
-		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'shortcut')); ?>">Raccourcis</a>
+		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'shortcut')); ?>"><?php echo Translate::t ('shortcuts'); ?></a>
 	</li>
 </div>

+ 5 - 5
app/layout/aside_feed.phtml

@@ -1,9 +1,9 @@
 <ul class="nav nav-list aside aside_feed">
-	<li class="nav-header">Vos flux RSS</li>
+	<li class="nav-header"><?php echo Translate::t ('your_rss_feeds'); ?></li>
 
 	<li class="nav-form"><form id="add_rss" method="post" action="<?php echo Url::display (array ('c' => 'feed', 'a' => 'add')); ?>">
 		<div class="stick">
-			<input type="url" name="url_rss" placeholder="Ajouter un flux RSS" />
+			<input type="url" name="url_rss" placeholder="<?php echo Translate::t ('add_rss_feed'); ?>" />
 			<div class="dropdown">
 				<div id="dropdown-cat" class="dropdown-target"></div>
 
@@ -11,7 +11,7 @@
 				<ul class="dropdown-menu">
 					<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
 
-					<li class="dropdown-header">Catégorie</li>
+					<li class="dropdown-header"><?php echo Translate::t ('category'); ?></li>
 
 					<?php foreach ($this->categories as $cat) { ?>
 					<li class="item">
@@ -27,7 +27,7 @@
 		</div>
 	</form></li>
 
-	<li class="item<?php echo Request::actionName () == 'importExport' ? ' active' : ''; ?>"><a href="<?php echo _url ('configure', 'importExport'); ?>">Import / Export OPML</a></li>
+	<li class="item<?php echo Request::actionName () == 'importExport' ? ' active' : ''; ?>"><a href="<?php echo _url ('configure', 'importExport'); ?>"><?php echo Translate::t ('import_export_opml'); ?></a></li>
 
 	<li class="separator"></li>
 
@@ -41,6 +41,6 @@
 	</li>
 	<?php } ?>
 	<?php } else { ?>
-	<li class="item disable">Aucun flux</li>
+	<li class="item disable"><?php echo Translate::t ('no_rss_feed'); ?></li>
 	<?php } ?>
 </ul>

+ 10 - 10
app/layout/aside_flux.phtml

@@ -22,7 +22,7 @@
 		<?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
 		<li>
 			<div class="stick">
-				<a class="btn btn-important" href="<?php echo _url ('configure', 'feed'); ?>">Gestion des abonnements</a>
+				<a class="btn btn-important" href="<?php echo _url ('configure', 'feed'); ?>"><?php echo Translate::t ('subscription_management'); ?></a>
 				<a class="btn btn-important" href="<?php echo Url::display ($url); ?>"><i class="icon i_rss"></i></a>
 			</div>
 		</li>
@@ -32,9 +32,9 @@
 			<div class="all">
 				<a class="btn<?php echo !$this->get_c ? ' active' : ''; ?>" href="<?php echo _url ('index', 'index'); ?>">
 					<i class="icon i_all"></i>
-					Tous (<?php echo $this->nb_total; ?>)
+					<?php echo Translate::t ('all_feeds', $this->nb_total); ?>
 					<?php if ($this->nb_not_read > 0) { ?>
-					<span class="notRead"><?php echo $this->nb_not_read; ?> non lu<?php echo $this->nb_not_read > 1 ? 's' : ''; ?></span>
+					<span class="notRead"><?php echo $this->nb_not_read > 1 ? Translate::t ('not_reads', $this->nb_not_read) : Translate::t ('not_read', $this->nb_not_read); ?></span>
 					<?php } ?>
 				</a>
 			</div>
@@ -44,7 +44,7 @@
 			<div class="favorites">
 				<a class="btn<?php echo $this->get_c == 'favoris' ? ' active' : ''; ?>" href="<?php echo _url ('index', 'index', 'get', 'favoris'); ?>">
 					<i class="icon i_bookmark"></i>
-					Favoris (<?php echo $this->nb_favorites; ?>)
+					<?php echo Translate::t ('favorite_feeds', $this->nb_favorites); ?>
 				</a>
 			</div>
 		</li>
@@ -58,7 +58,7 @@
 				<a class="btn<?php echo $c_active ? ' active' : ''; ?>" href="<?php echo _url ('index', 'index', 'get', 'c_' . $cat->id ()); ?>">
 					<?php echo $cat->name (); ?>
 					<?php if ($catNotRead > 0) { ?>
-					<span class="notRead"><?php echo $catNotRead ?> non lu<?php echo $catNotRead > 1 ? 's' : ''; ?></span>
+					<span class="notRead"><?php echo $catNotRead > 1 ? Translate::t ('not_reads', $catNotRead) : Translate::t ('not_read', $catNotRead); ?></span>
 					<?php } ?>
 				</a>
 			</div>
@@ -73,14 +73,14 @@
 						<a class="dropdown-toggle" href="#dropdown-<?php echo $feed->id(); ?>"><i class="icon i_configure"></i></a>
 						<ul class="dropdown-menu">
 							<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
-							<li class="item"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>">Filtrer</a></li>
-							<li class="item"><a target="_blank" href="<?php echo $feed->website (); ?>">Voir le site</a></li>
+							<li class="item"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><?php echo Translate::t ('filter'); ?></a></li>
+							<li class="item"><a target="_blank" href="<?php echo $feed->website (); ?>"><?php echo Translate::t ('see_website'); ?></a></li>
 							<?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
 							<li class="separator"></li>
 
-							<li class="item"><a href="<?php echo _url ('configure', 'feed', 'id', $feed->id ()); ?>">Gestion</a></li>
-							<li class="item"><a href="<?php echo _url ('feed', 'actualize', 'id', $feed->id ()); ?>">Actualiser</a></li>
-							<li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', 'f_' . $feed->id ()); ?>">Marquer comme lu</a></li>
+							<li class="item"><a href="<?php echo _url ('configure', 'feed', 'id', $feed->id ()); ?>"><?php echo Translate::t ('administration'); ?></a></li>
+							<li class="item"><a href="<?php echo _url ('feed', 'actualize', 'id', $feed->id ()); ?>"><?php echo Translate::t ('actualize'); ?></a></li>
+							<li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', 'f_' . $feed->id ()); ?>"><?php echo Translate::t ('mark_read'); ?></a></li>
 							<?php } ?>
 						</ul>
 					</div>

+ 9 - 9
app/layout/header.phtml

@@ -1,23 +1,23 @@
 <?php if (login_is_conf ($this->conf)) { ?>
 <ul class="nav nav-head">
 	<?php if (!is_logged ()) { ?>
-	<li class="item"><i class="icon i_login"></i> <a id="signin" href="#">Connexion</a></li>
+	<li class="item"><i class="icon i_login"></i> <a id="signin" href="#"><?php echo Translate::t ('login'); ?></a></li>
 	<?php } else { ?>
-	<li class="item"><i class="icon i_logout"></i> <a id="signout" href="#">Déconnexion</a></li>
+	<li class="item"><i class="icon i_logout"></i> <a id="signout" href="#"><?php echo Translate::t ('logout'); ?></a></li>
 	<?php } ?>
 </ul>
 <?php } ?>
 
 <div class="header">
 	<div class="item title">
-		<h1><a href="<?php echo _url ('index', 'index'); ?>">FreshRSS</a></h1>
+		<h1><a href="<?php echo _url ('index', 'index'); ?>"><?php echo Configuration::title (); ?></a></h1>
 	</div>
 
 	<div class="item search">
 		<form action="<?php echo _url ('index', 'index'); ?>" method="get">
 			<div class="stick">
 				<?php $s = Request::param ('search', ''); ?>
-				<input type="text" name="search" id="search" value="<?php echo $s; ?>" placeholder="Rechercher sur les titres" />
+				<input type="text" name="search" id="search" value="<?php echo $s; ?>" placeholder="<?php echo Translate::t ('search_on_title'); ?>" />
 				<button class="btn" type="submit"><i class="icon i_search"></i></button>
 			</div>
 		</form>
@@ -31,12 +31,12 @@
 			<a class="btn dropdown-toggle" href="#dropdown-configure"><i class="icon i_configure"></i></a>
 			<ul class="dropdown-menu">
 				<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
-				<li class="dropdown-header">Configuration</li>
-				<li class="item"><a href="<?php echo _url ('configure', 'display'); ?>">Général et lecture</a></li>
-				<li class="item"><a href="<?php echo _url ('configure', 'categorize'); ?>">Catégories</a></li>
-				<li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>">Raccourcis</a></li>
+				<li class="dropdown-header"><?php echo Translate::t ('configuration'); ?></li>
+				<li class="item"><a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Translate::t ('general_and_reading'); ?></a></li>
+				<li class="item"><a href="<?php echo _url ('configure', 'categorize'); ?>"><?php echo Translate::t ('categories'); ?></a></li>
+				<li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Translate::t ('shortcuts'); ?></a></li>
 				<li class="separator"></li>
-				<li class="item"><a href="<?php echo _url ('index', 'about'); ?>">À propos</a></li>
+				<li class="item"><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Translate::t ('about'); ?></a></li>
 			</ul>
 		</div>
 	</div>

+ 11 - 11
app/layout/nav_menu.phtml

@@ -5,19 +5,19 @@
 
 	<?php
 		$get = false;
-		$string_mark = 'Tout marquer comme lu';
+		$string_mark = Translate::t ('mark_all_read');
 		if ($this->get_f) {
 			$get = 'f_' . $this->get_f;
-			$string_mark = 'Marquer le flux comme lu';
+			$string_mark = Translate::t ('mark_feed_read');
 		} elseif ($this->get_c) {
 			$get = 'c_' . $this->get_c;
-			$string_mark = 'Marquer la catégorie comme lue';
+			$string_mark = Translate::t ('mark_cat_read');
 		}
 	?>
 
 	<?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
 	<div class="stick">
-		<a class="read_all btn" href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get); ?>">Marquer comme lu</a>
+		<a class="read_all btn" href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get); ?>"><?php echo Translate::t ('mark_read'); ?></a>
 		<div class="dropdown">
 			<div id="dropdown-read" class="dropdown-target"></div>
 
@@ -32,8 +32,8 @@
 	$today = mktime (0, 0, 0, $date['mon'], $date['mday'], $date['year']);
 	$one_week = $today - 604800;
 ?>
-				<li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'dateMax', $today); ?>">Antérieurs à 1 jour</a></li>
-				<li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'dateMax', $one_week); ?>">Antérieurs à 1 semaine</a></li>
+				<li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'dateMax', $today); ?>"><?php echo Translate::t ('before_one_day'); ?></a></li>
+				<li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'dateMax', $one_week); ?>"><?php echo Translate::t ('before_one_week'); ?></a></li>
 			</ul>
 		</div>
 	</div>
@@ -41,23 +41,23 @@
 
 	<div class="dropdown">
 		<div id="dropdown-views" class="dropdown-target"></div>
-		<a class="dropdown-toggle btn" href="#dropdown-views">Affichage <i class="icon i_down"></i></a>
+		<a class="dropdown-toggle btn" href="#dropdown-views"><?php echo Translate::t ('display'); ?> <i class="icon i_down"></i></a>
 		<ul class="dropdown-menu">
 			<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
 
 			<li class="item">
 				<?php if ($this->mode == 'not_read') { ?>
-				<a class="print_all" href="<?php echo _url ('index', 'changeMode', 'mode', 'all'); ?>">Tout afficher</a>
+				<a class="print_all" href="<?php echo _url ('index', 'changeMode', 'mode', 'all'); ?>"><?php echo Translate::t ('show_all'); ?></a>
 				<?php } else { ?>
-				<a class="print_non_read" href="<?php echo _url ('index', 'changeMode', 'mode', 'not_read'); ?>">Afficher les non lus</a>
+				<a class="print_non_read" href="<?php echo _url ('index', 'changeMode', 'mode', 'not_read'); ?>"><?php echo Translate::t ('show_not_reads'); ?></a>
 				<?php } ?>
 			</li>
 			<li class="separator"></li>
 			<li class="item">
 				<?php if ($this->order == 'low_to_high') { ?>
-				<a href="<?php echo _url ('index', 'changeOrder', 'order', 'high_to_low'); ?>">Plus anciens en premier</a>
+				<a href="<?php echo _url ('index', 'changeOrder', 'order', 'high_to_low'); ?>"><?php echo Translate::t ('older_first'); ?></a>
 				<?php } else { ?>
-				<a href="<?php echo _url ('index', 'changeOrder', 'order', 'low_to_high'); ?>">Plus récents en premier</a>
+				<a href="<?php echo _url ('index', 'changeOrder', 'order', 'low_to_high'); ?>"><?php echo Translate::t ('newer_first'); ?></a>
 				<?php } ?>
 			</li>
 		</ul>