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/views/configure/display.phtml | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'app/views/configure/display.phtml') diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 79fa4b43c..fcae83d9a 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -1,104 +1,104 @@ partial ('aside_configure'); ?>
- ← Retour à vos flux RSS +
- Configuration générale +
- +
- mois +
- + conf->mailLogin (); ?>
- - + +
- Configuration de lecture +
- +
- +
- +
- +
- +
- Partage +
- +
- +
- - + +
-- cgit v1.2.3 From 70d75f0cf5304c1f8ef121538f9e4e166bb7b755 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 27 Apr 2013 16:45:16 +0200 Subject: Possibilité de choisir la langue à utiliser + fin traduction en anglais (bug #38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/App_FrontController.php | 6 ++++-- app/controllers/configureController.php | 6 ++++++ app/i18n/en.php | 5 +++-- app/i18n/fr.php | 1 + app/models/RSSConfiguration.php | 26 ++++++++++++++++++++++++-- app/views/configure/display.phtml | 12 ++++++++++++ 6 files changed, 50 insertions(+), 6 deletions(-) (limited to 'app/views/configure/display.phtml') diff --git a/app/App_FrontController.php b/app/App_FrontController.php index 177e83b66..8b515873a 100644 --- a/app/App_FrontController.php +++ b/app/App_FrontController.php @@ -11,12 +11,12 @@ 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 (); + + Translate::init (); } private function loadLibs () { @@ -41,6 +41,8 @@ class App_FrontController extends FrontController { $entryDAO = new EntryDAO (); View::_param ('nb_not_read', $entryDAO->countNotRead ()); + + Session::_param ('language', $this->conf->language ()); } private function loadStylesAndScripts () { diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 11b55f4b0..81a8e97d7 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -124,6 +124,7 @@ class configureController extends ActionController { public function displayAction () { if (Request::isPost ()) { + $language = Request::param ('language', 'en'); $nb = Request::param ('posts_per_page', 10); $view = Request::param ('default_view', 'all'); $display = Request::param ('display_posts', 'no'); @@ -135,6 +136,7 @@ class configureController extends ActionController { $openPage = Request::param ('mark_open_page', 'no'); $urlShaarli = Request::param ('shaarli', ''); + $this->view->conf->_language ($language); $this->view->conf->_postsPerPage (intval ($nb)); $this->view->conf->_defaultView ($view); $this->view->conf->_displayPosts ($display); @@ -149,6 +151,7 @@ class configureController extends ActionController { $this->view->conf->_urlShaarli ($urlShaarli); $values = array ( + 'language' => $this->view->conf->language (), 'posts_per_page' => $this->view->conf->postsPerPage (), 'default_view' => $this->view->conf->defaultView (), 'display_posts' => $this->view->conf->displayPosts (), @@ -164,6 +167,9 @@ class configureController extends ActionController { Session::_param ('conf', $this->view->conf); Session::_param ('mail', $this->view->conf->mailLogin ()); + Session::_param ('language', $this->view->conf->language ()); + Translate::reset (); + // notif $notif = array ( 'type' => 'good', diff --git a/app/i18n/en.php b/app/i18n/en.php index 23b2ae17b..203904c9d 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -131,6 +131,7 @@ return array ( 'think_to_add' => 'Think to add RSS feeds!', 'general_configuration' => 'General configuration', + 'language' => 'Language', 'delete_articles_every' => 'Remove articles every', 'month' => 'months', 'persona_connection_email' => 'Login mail address (use Persona)', @@ -180,9 +181,9 @@ return array ( 'github_or_email' => 'on Github or by mail', 'license' => 'License', 'agpl3' => 'AGPL 3', - 'freshrss_description' => 'FreshRSS est un agrégateur de flux RSS à auto-héberger à l\'image de RSSLounge, TinyTinyRSS ou Leed. Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. L\'objectif étant d\'offrir une alternative sérieuse au futur feu-Google Reader.', + 'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like RSSLounge, TinyTinyRSS or Leed. It is light and easy to take in hand while being powerful and configurable tool. Objective is to provide a serious alternative to Google Reader.', 'credits' => 'Credits', - 'credits_content' => 'Des éléments de design sont issus du projet Bootstrap bien que FreshRSS n\'utilise pas ce framework. Les icônes sont issues du projet GNOME. La police Open Sans utilisée a été créée par Steve Matteson. Les favicons sont récupérés grâce au site getFavicon. FreshRSS repose sur Minz, un framework PHP.', + 'credits_content' => 'Some design elements come from Bootstrap although FreshRSS doesn\'t use this framework. Icons come from GNOME project. Open Sans font police used has been created by Steve Matteson. Favicons are collected with getFavicon API. FreshRSS is based on Minz, a PHP framework.', // DATE 'january' => 'january', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 39208cef8..0473a8f94 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -131,6 +131,7 @@ return array ( 'think_to_add' => 'Pensez à en ajouter !', 'general_configuration' => 'Configuration générale', + 'language' => 'Langue', 'delete_articles_every' => 'Supprimer les articles tous les', 'month' => 'mois', 'persona_connection_email' => 'Adresse mail de connexion (utilise Persona)', diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index ca56ec3a8..00fe3fe52 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -1,6 +1,11 @@ 'English', + 'fr' => 'Français', + ); + private $language; private $posts_per_page; private $default_view; private $display_posts; @@ -13,6 +18,7 @@ class RSSConfiguration extends Model { public function __construct () { $confDAO = new RSSConfigurationDAO (); + $this->_language ($confDAO->language); $this->_postsPerPage ($confDAO->posts_per_page); $this->_defaultView ($confDAO->default_view); $this->_displayPosts ($confDAO->display_posts); @@ -24,6 +30,12 @@ class RSSConfiguration extends Model { $this->_urlShaarli ($confDAO->url_shaarli); } + public function availableLanguages () { + return $this->available_languages; + } + public function language () { + return $this->language; + } public function postsPerPage () { return $this->posts_per_page; } @@ -60,7 +72,13 @@ class RSSConfiguration extends Model { public function urlShaarli () { return $this->url_shaarli; } - + + public function _language ($value) { + if (!isset ($this->available_languages[$value])) { + $value = 'en'; + } + $this->language = $value; + } public function _postsPerPage ($value) { if (is_int (intval ($value))) { $this->posts_per_page = $value; @@ -122,6 +140,7 @@ class RSSConfiguration extends Model { } class RSSConfigurationDAO extends Model_array { + public $language = 'en'; public $posts_per_page = 20; public $default_view = 'not_read'; public $display_posts = 'no'; @@ -146,7 +165,10 @@ class RSSConfigurationDAO extends Model_array { public function __construct () { parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php'); - + + if (isset ($this->array['language'])) { + $this->language = $this->array['language']; + } if (isset ($this->array['posts_per_page'])) { $this->posts_per_page = $this->array['posts_per_page']; } diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index fcae83d9a..be67896dc 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -6,6 +6,18 @@
+
+ +
+ +
+
+
-- cgit v1.2.3