aboutsummaryrefslogtreecommitdiff
path: root/app/FreshRSS.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-11-11 23:03:15 +0100
committerGravatar GitHub <noreply@github.com> 2020-11-11 23:03:15 +0100
commit8dad63de0294c4d385069afccbba307c2b8cf9e5 (patch)
treeb1a3bfc1525a36c4c9169090ae5c62de452abb0b /app/FreshRSS.php
parent23015f26cc9d5286d21419dbf7a6829949d60c8d (diff)
Fix initI18n (#3249)
* Fix initI18n #fix https://github.com/FreshRSS/FreshRSS/issues/3246#issuecomment-725463337 #fix https://github.com/FreshRSS/FreshRSS/issues/3136 It was due to calling `initI18n()` before `FreshRSS_Context` is intialised in some situations Introduced by https://github.com/FreshRSS/FreshRSS/pull/3022 Will be better fixed when https://github.com/FreshRSS/FreshRSS/pull/3070 lands * Fallback condition
Diffstat (limited to 'app/FreshRSS.php')
-rw-r--r--app/FreshRSS.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index e4cc3936c..5b16e3f89 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -90,8 +90,9 @@ class FreshRSS extends Minz_FrontController {
}
private static function initI18n() {
- $selected_language = FreshRSS_Auth::hasAccess() ? FreshRSS_Context::$user_conf->language : null;
- $language = Minz_Translate::getLanguage($selected_language, Minz_Request::getPreferredLanguages(), FreshRSS_Context::$system_conf->language);
+ $userLanguage = isset(FreshRSS_Context::$user_conf) ? FreshRSS_Context::$user_conf->language : null;
+ $systemLanguage = isset(FreshRSS_Context::$system_conf) ? FreshRSS_Context::$system_conf->language : null;
+ $language = Minz_Translate::getLanguage($userLanguage, Minz_Request::getPreferredLanguages(), $systemLanguage);
Minz_Session::_param('language', $language);
Minz_Translate::init($language);