From addcea9cd45a87f2ae56f879bad86425efc16fba Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 6 Jan 2015 21:10:51 +0100 Subject: Fix i18n loading and availableLanguages calls - Change the way to init i18n - Add a availableLanguages() method to Minz_Translate See https://github.com/FreshRSS/FreshRSS/issues/730 --- app/FreshRSS.php | 18 ++++++++++++++---- app/views/configure/display.phtml | 2 +- app/views/user/manage.phtml | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/FreshRSS.php b/app/FreshRSS.php index a53174394..7b5df7ced 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -31,15 +31,25 @@ class FreshRSS extends Minz_FrontController { // Load context and configuration. FreshRSS_Context::init(); - // Init i18n. - Minz_Session::_param('language', FreshRSS_Context::$user_conf->language); - Minz_Translate::init(); - + $this->initI18n(); $this->loadStylesAndScripts(); $this->loadNotifications(); $this->loadExtensions(); } + private function initI18n() { + $lang = Minz_Session::param('language'); + if ($lang === false) { + Minz_Session::_param('language', FreshRSS_Context::$user_conf->language); + $lang = FreshRSS_Context::$user_conf->language; + } + + Minz_Translate::init(array( + 'en' => 'English', + 'fr' => 'Français', + ), $lang); + } + private function loadStylesAndScripts() { $theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme); if ($theme) { diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index b68bf925b..36a075ea7 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -10,7 +10,7 @@
- availableLanguages(); ?> + $lib) { ?> -- cgit v1.2.3