Skip to content
Snippets Groups Projects
Commit 65e94ed7 authored by Jared Hancock's avatar Jared Hancock
Browse files

i18n: Switch language immediately on profile update

parent bbd35ea4
No related branches found
No related tags found
No related merge requests found
...@@ -372,10 +372,6 @@ class Internationalization { ...@@ -372,10 +372,6 @@ class Internationalization {
static function getCurrentLanguage($user=false) { static function getCurrentLanguage($user=false) {
global $thisstaff, $thisclient; global $thisstaff, $thisclient;
static $session = null;
if (!isset($session))
$session = &$_SESSION['::lang'];
$user = $user ?: $thisstaff ?: $thisclient; $user = $user ?: $thisstaff ?: $thisclient;
if ($user && method_exists($user, 'getLanguage')) if ($user && method_exists($user, 'getLanguage'))
...@@ -383,8 +379,8 @@ class Internationalization { ...@@ -383,8 +379,8 @@ class Internationalization {
return $lang; return $lang;
// Support the flag buttons for guests // Support the flag buttons for guests
if ((!$user || $user != $thisstaff) && $session) if ((!$user || $user != $thisstaff) && $_SESSION['::lang'])
return $session; return $_SESSION['::lang'];
return self::getDefaultLanguage(); return self::getDefaultLanguage();
} }
......
...@@ -603,9 +603,6 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { ...@@ -603,9 +603,6 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
if($errors) return false; if($errors) return false;
$_SESSION['::lang'] = null;
TextDomain::configureForUser($this);
$this->firstname = $vars['firstname']; $this->firstname = $vars['firstname'];
$this->lastname = $vars['lastname']; $this->lastname = $vars['lastname'];
$this->email = $vars['email']; $this->email = $vars['email'];
...@@ -622,6 +619,9 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { ...@@ -622,6 +619,9 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
$this->default_paper_size = $vars['default_paper_size']; $this->default_paper_size = $vars['default_paper_size'];
$this->lang = $vars['lang']; $this->lang = $vars['lang'];
$_SESSION['::lang'] = null;
TextDomain::configureForUser($this);
return $this->save(); return $this->save();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment