Browse Source

Reload properly the language and translations when updated or on login

pull/676/head
Timothée Jaussoin 8 years ago
parent
commit
979827650f
  1. 4
      app/User.php
  2. 6
      app/widgets/Config/Config.php
  3. 2
      src/Movim/Bootstrap.php

4
app/User.php

@ -98,6 +98,10 @@ class User extends Model
if (isset($config['nightmode'])) {
$this->nightmode = $config['nightmode'];
}
// Reload the user
self::me(true);
(new \Movim\Bootstrap)->loadLanguage();
}
public function hasMAM()

6
app/widgets/Config/Config.php

@ -11,6 +11,7 @@ class Config extends \Movim\Widget\Base
function load()
{
$this->registerEvent('storage_set_handle', 'onConfig');
$this->registerEvent('storage_get_handle', 'onConfig');
$this->registerEvent('mam_getconfig_handle', 'onMAMConfig');
$this->registerEvent('mam_setconfig_handle', 'onMAMConfigSaved');
@ -40,9 +41,8 @@ class Config extends \Movim\Widget\Base
function onConfig($package)
{
$me = User::me();
$me->setConfig($package->content);
$me->save();
$this->user->setConfig($package->content);
$this->user->save();
$this->refreshConfig();

2
src/Movim/Bootstrap.php

@ -224,7 +224,7 @@ class Bootstrap
/**
* Loads up the language, either from the User or default.
*/
function loadLanguage()
public function loadLanguage()
{
$l = \Movim\i18n\Locale::start();

Loading…
Cancel
Save