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 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'app/FreshRSS.php') 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) { -- cgit v1.2.3