From 19407e1ab6df2c239017fb20e47d6201bdaab223 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 27 Apr 2013 13:40:48 +0200 Subject: Structure pour l'internationalisation terminée (voir bug #38) : il reste à faire la traduction en anglais notamment, rajouter une option pour changer la langue, détecter la langue préférée de l'utilisateur et voir si on peut migrer facilement l'installateur aussi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/apiController.php | 6 ++--- app/controllers/configureController.php | 28 ++++++++++----------- app/controllers/entryController.php | 10 ++++---- app/controllers/feedController.php | 44 ++++++++++++++------------------- app/controllers/indexController.php | 12 ++++----- 5 files changed, 46 insertions(+), 54 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/apiController.php b/app/controllers/apiController.php index bc08386b5..025908f3e 100755 --- a/app/controllers/apiController.php +++ b/app/controllers/apiController.php @@ -20,11 +20,11 @@ class apiController extends ActionController { $notes = $e->notes (); if ($notes == '') { $feed = $e->feed (true); - $notes = 'Article publié initialement sur ' . $feed->name () . ''; if($author != '') { - $notes .= ' par ' . $author; + $notes = Translate::t ('article_published_on_author', $feed->website (), $feed->name (), $author); + } else { + $notes = Translate::t ('article_published_on', $feed->website (), $feed->name ()); } - $notes .= ', mis en favoris dans FreshRSS'; } $id = $e->id (); diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 18a56c066..7e73fd2ba 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -5,7 +5,7 @@ class configureController extends ActionController { if (login_is_conf ($this->view->conf) && !is_logged ()) { Error::error ( 403, - array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')) + array ('error' => array (Translate::t ('access denied'))) ); } } @@ -48,7 +48,7 @@ class configureController extends ActionController { // notif $notif = array ( 'type' => 'good', - 'content' => 'Les catégories ont été mises à jour' + 'content' => Translate::t ('categories_updated') ); Session::_param ('notification', $notif); @@ -58,7 +58,7 @@ class configureController extends ActionController { $this->view->categories = $catDAO->listCategories (); $this->view->defaultCategory = $catDAO->getDefault (); - View::prependTitle ('Gestion des catégories - '); + View::prependTitle (Translate::t ('categories_management') . ' - '); } public function feedAction () { @@ -80,7 +80,7 @@ class configureController extends ActionController { if (!$this->view->flux) { Error::error ( 404, - array ('error' => array ('La page que vous cherchez n\'existe pas')) + array ('error' => array (Translate::t ('page_not_found'))) ); } else { $catDAO = new CategoryDAO (); @@ -102,12 +102,12 @@ class configureController extends ActionController { $notif = array ( 'type' => 'good', - 'content' => 'Le flux a été mis à jour' + 'content' => Translate::t ('feed_updated') ); } else { $notif = array ( 'type' => 'bad', - 'content' => 'Une erreur est survenue lors de la mise à jour' + 'content' => Translate::t ('error_occurred_update') ); } @@ -115,10 +115,10 @@ class configureController extends ActionController { Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true); } - View::prependTitle ('Gestion des flux RSS - ' . $this->view->flux->name () . ' - '); + View::prependTitle (Translate::t ('rss_feed_management') . ' - ' . $this->view->flux->name () . ' - '); } } else { - View::prependTitle ('Gestion des flux RSS - '); + View::prependTitle (Translate::t ('rss_feed_management') . ' - '); } } @@ -167,21 +167,21 @@ class configureController extends ActionController { // notif $notif = array ( 'type' => 'good', - 'content' => 'La configuration a été mise à jour' + 'content' => Translate::t ('configuration_updated') ); Session::_param ('notification', $notif); Request::forward (array ('c' => 'configure', 'a' => 'display'), true); } - View::prependTitle ('Gestion générale et affichage - '); + View::prependTitle (Translate::t ('general_and_reading_management') . ' - '); } public function importExportAction () { $this->view->req = Request::param ('q'); if ($this->view->req == 'export') { - View::_title ('feeds_opml.xml'); + View::_title ('feeds.opml'); $this->view->_useLayout (false); header('Content-Type: text/xml; charset=utf-8'); @@ -212,7 +212,7 @@ class configureController extends ActionController { $this->view->feeds = $feedDAO->listFeeds (); $this->view->flux = false; - View::prependTitle ('Importation et exportation OPML - '); + View::prependTitle (Translate::t ('import_export_opml') . ' - '); } public function shortcutAction () { @@ -251,13 +251,13 @@ class configureController extends ActionController { // notif $notif = array ( 'type' => 'good', - 'content' => 'Les raccourcis ont été mis à jour' + 'content' => Translate::t ('shortcuts_updated') ); Session::_param ('notification', $notif); Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true); } - View::prependTitle ('Gestion des raccourcis - '); + View::prependTitle (Translate::t ('shortcuts_management') . ' - '); } } diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index e3c4fe165..2ce260297 100755 --- a/app/controllers/entryController.php +++ b/app/controllers/entryController.php @@ -5,7 +5,7 @@ class entryController extends ActionController { if (login_is_conf ($this->view->conf) && !is_logged ()) { Error::error ( 403, - array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')) + array ('error' => array (Translate::t ('access denied'))) ); } @@ -63,7 +63,7 @@ class entryController extends ActionController { // notif $notif = array ( 'type' => 'good', - 'content' => 'Les flux ont été marqués comme lu' + 'content' => Translate::t ('feeds_marked_read') ); Session::_param ('notification', $notif); } else { @@ -130,12 +130,12 @@ class entryController extends ActionController { if ($entryDAO->updateEntry ($id, $values)) { $notif = array ( 'type' => 'good', - 'content' => 'Modifications enregistrées' + 'content' => Translate::t ('updated') ); } else { $notif = array ( 'type' => 'bad', - 'content' => 'Une erreur est survenue' + 'content' => Translate::t ('error_occured') ); } Session::_param ('notification', $notif); @@ -157,7 +157,7 @@ class entryController extends ActionController { if ($not_found) { Error::error ( 404, - array ('error' => array ('La page que vous cherchez n\'existe pas')) + array ('error' => array (Translate::t ('page_not_found'))) ); } else { $this->view->entry = $entry; diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index c67609d57..1232ddff4 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -10,7 +10,7 @@ class feedController extends ActionController { if (login_is_conf ($this->view->conf) && !is_logged ()) { Error::error ( 403, - array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')) + array ('error' => array (Translate::t ('access_denied'))) ); } else { if (Request::isPost ()) { @@ -37,7 +37,7 @@ class feedController extends ActionController { if ($feedDAO->searchByUrl ($values['url'])) { $notif = array ( 'type' => 'bad', - 'content' => 'Vous êtes déjà abonné à ' . $feed->name () . '' + 'content' => Translate::t ('already_subscribed', $feed->name ()) ); Session::_param ('notification', $notif); } elseif ($feedDAO->addFeed ($values)) { @@ -52,7 +52,7 @@ class feedController extends ActionController { // notif $notif = array ( 'type' => 'good', - 'content' => 'Le flux ' . $feed->name () . ' a bien été ajouté' + 'content' => Translate::t ('feed_added', $feed->name ()) ); Session::_param ('notification', $notif); $params['id'] = $feed->id (); @@ -60,7 +60,7 @@ class feedController extends ActionController { // notif $notif = array ( 'type' => 'bad', - 'content' => '' . $feed->name () . ' n\' a pas pu être ajouté' + 'content' => Translate::t ('feed_not_added', $feed->name ()) ); Session::_param ('notification', $notif); } @@ -68,22 +68,14 @@ class feedController extends ActionController { Log::record ($e->getMessage (), Log::ERROR); $notif = array ( 'type' => 'bad', - 'content' => 'Un problème interne a été rencontré, le flux n\'a pas pu être ajouté' - ); - Session::_param ('notification', $notif); - } catch (FileNotExistException $e) { - Log::record ($e->getMessage (), Log::ERROR); - // notif - $notif = array ( - 'type' => 'bad', - 'content' => 'Un problème de configuration a empêché l\'ajout du flux. Voir les logs pour plus d\'informations' + 'content' => Translate::t ('internal_problem_feed') ); Session::_param ('notification', $notif); } catch (Exception $e) { // notif $notif = array ( 'type' => 'bad', - 'content' => 'L\'url ' . $url . ' est invalide' + 'content' => Translate::t ('invalid_url', $url) ); Session::_param ('notification', $notif); } @@ -144,18 +136,18 @@ class feedController extends ActionController { $feed = reset ($feeds); $notif = array ( 'type' => 'good', - 'content' => '' . $feed->name () . ' a été mis à jour' + 'content' => Translate::t ('feed_actualized', $feed->name ()) ); $url['params'] = array ('get' => 'f_' . $feed->id ()); } elseif ($i > 0) { $notif = array ( 'type' => 'good', - 'content' => $i . ' flux ont été mis à jour' + 'content' => Translate::t ('n_feeds_actualized', $i) ); } else { $notif = array ( 'type' => 'bad', - 'content' => 'Aucun flux n\'a pu être mis à jour' + 'content' => Translate::t ('no_feed_actualized') ); } @@ -165,7 +157,7 @@ class feedController extends ActionController { } else { $notif = array ( 'type' => 'good', - 'content' => 'Les flux ont été mis à jour' + 'content' => Translate::t ('feeds_actualized') ); Session::_param ('notification', $notif); $this->view->_useLayout (false); @@ -176,7 +168,7 @@ class feedController extends ActionController { if (login_is_conf ($this->view->conf) && !is_logged ()) { Error::error ( 403, - array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')) + array ('error' => array (Translate::t ('access_denied'))) ); } else { $entryDAO = new EntryDAO (); @@ -219,9 +211,9 @@ class feedController extends ActionController { } if ($error) { - $res = 'Les flux ont été importés mais des erreurs sont survenus'; + $res = Translate::t ('feeds_imported_with_errors'); } else { - $res = 'Les flux ont été importés'; + $res = Translate::t ('feeds_imported'); } $notif = array ( 'type' => 'good', @@ -240,7 +232,7 @@ class feedController extends ActionController { if (login_is_conf ($this->view->conf) && !is_logged ()) { Error::error ( 403, - array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')) + array ('error' => array (Translate::t ('access_denied'))) ); } else { $type = Request::param ('type', 'feed'); @@ -251,24 +243,24 @@ class feedController extends ActionController { if ($feedDAO->deleteFeedByCategory ($id)) { $notif = array ( 'type' => 'good', - 'content' => 'La catégorie a été vidée' + 'content' => Translate::t ('category_emptied') ); } else { $notif = array ( 'type' => 'bad', - 'content' => 'Un problème est survenu' + 'content' => Translate::t ('error_occured') ); } } else { if ($feedDAO->deleteFeed ($id)) { $notif = array ( 'type' => 'good', - 'content' => 'Le flux a été supprimé' + 'content' => Translate::t ('feed_deleted') ); } else { $notif = array ( 'type' => 'bad', - 'content' => 'Un problème est survenu' + 'content' => Translate::t ('error_occured') ); } } diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index 8fa911631..dfdcfde42 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -35,13 +35,13 @@ class indexController extends ActionController { // Récupère les flux par catégorie, favoris ou tous if ($this->get['type'] == 'all') { $entries = $entryDAO->listEntries ($this->mode, $search, $order); - View::prependTitle ('Vos flux RSS - '); + View::prependTitle (Translate::t ('your_rss_feeds') . ' - '); } elseif ($this->get['type'] == 'favoris') { $entries = $entryDAO->listFavorites ($this->mode, $search, $order); - View::prependTitle ('Vos favoris - '); + View::prependTitle (Translate::t ('your_favorites') . ' - '); } elseif ($this->get['type'] == 'public') { $entries = $entryDAO->listPublic ($this->mode, $search, $order); - View::prependTitle ('Public - '); + View::prependTitle (Translate::t ('public') . ' - '); } elseif ($this->get != false) { if ($this->get['type'] == 'c') { $cat = $catDAO->searchById ($this->get['filter']); @@ -72,7 +72,7 @@ class indexController extends ActionController { if ($error) { Error::error ( 404, - array ('error' => array ('La page que vous cherchez n\'existe pas')) + array ('error' => array (Translate::t ('page_not_found'))) ); } else { $this->view->mode = $this->mode; @@ -93,7 +93,7 @@ class indexController extends ActionController { } public function aboutAction () { - View::prependTitle ('À propos - '); + View::prependTitle (Translate::t ('about') . ' - '); } public function changeModeAction () { @@ -143,7 +143,7 @@ class indexController extends ActionController { } else { $res = array (); $res['status'] = 'failure'; - $res['reason'] = 'L\'identifiant est invalide'; + $res['reason'] = Translate::t ('invalid_login'); } $this->view->res = json_encode ($res); -- cgit v1.2.3