aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/authController.php
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2020-06-05 10:10:46 +0200
committerGravatar GitHub <noreply@github.com> 2020-06-05 10:10:46 +0200
commit36bda2e715ed822cc495ff419ad565084e241f43 (patch)
tree6a4fd79cd42ab76cab2338eedb02f787e4e2c3a8 /app/Controllers/authController.php
parentd4554fa087f9057610085ca685cd8fb79d8f2bd0 (diff)
Add language detection when the user is not logged in (#3022)
Before, when the user was not logged in, pages where translated with the '_' user language. Now, they are translated with the user preferred language if there is one supported by FreshRSS or with the system default language.
Diffstat (limited to 'app/Controllers/authController.php')
-rw-r--r--app/Controllers/authController.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php
index d61472e53..d158092bf 100644
--- a/app/Controllers/authController.php
+++ b/app/Controllers/authController.php
@@ -148,6 +148,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController {
FreshRSS_FormAuth::deleteCookie();
}
+ Minz_Translate::init($conf->language);
+
// All is good, go back to the index.
Minz_Request::good(_t('feedback.auth.login.success'),
array('c' => 'index', 'a' => 'index'));
@@ -191,6 +193,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController {
Minz_Session::_param('csrf');
FreshRSS_Auth::giveAccess();
+ Minz_Translate::init($conf->language);
+
Minz_Request::good(_t('feedback.auth.login.success'),
array('c' => 'index', 'a' => 'index'));
} else {
@@ -231,6 +235,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController {
$this->view->show_tos_checkbox = file_exists(join_path(DATA_PATH, 'tos.html'));
$this->view->show_email_field = FreshRSS_Context::$system_conf->force_email_validation;
+ $this->view->preferred_language = Minz_Translate::getLanguage(null, Minz_Request::getPreferredLanguages(), FreshRSS_Context::$system_conf->language);
Minz_View::prependTitle(_t('gen.auth.registration.title') . ' ยท ');
}
}