Add user language in settings, use that field as language for UI
This commit is contained in:
parent
e74916d395
commit
fb3ac68cc0
7 changed files with 80 additions and 47 deletions
12
index.php
12
index.php
|
@ -102,13 +102,13 @@ session_start();
|
|||
* Language was set earlier, but we can over-ride it in the session.
|
||||
* We have to do it here because the session was just now opened.
|
||||
*/
|
||||
|
||||
if(array_key_exists('system_language',$_POST)) {
|
||||
if(strlen($_POST['system_language']))
|
||||
$_SESSION['language'] = $_POST['system_language'];
|
||||
else
|
||||
unset($_SESSION['language']);
|
||||
if (x($_SESSION,'authenticated') && !x($_SESSION,'language')) {
|
||||
// we didn't loaded user data yet, but we need user language
|
||||
$r = q("SELECT language FROM user WHERE uid=%d", intval($_SESSION['uid']));
|
||||
$_SESSION['language'] = $lang;
|
||||
if (count($r)>0) $_SESSION['language'] = $r[0]['language'];
|
||||
}
|
||||
|
||||
if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
|
||||
$lang = $_SESSION['language'];
|
||||
load_translation_table($lang);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue