forked from kevinowino869/mitrobill
Language Switching
customer can now choose preferred language from available language list. we are store language in session for now, if customer logout the language will reset back to default, we will move it to database in the coming update.
This commit is contained in:
27
init.php
27
init.php
@ -131,17 +131,26 @@ if ((!empty($radius_user) && $config['radius_enable']) || _post('radius_enable')
|
||||
}
|
||||
|
||||
|
||||
if (empty($config['language'])) {
|
||||
$config['language'] = 'english';
|
||||
// Check if the user has selected a language
|
||||
if (!empty($_SESSION['user_language'])) {
|
||||
$config['language'] = $_SESSION['user_language'];
|
||||
}
|
||||
$lan_file = $root_path . File::pathFixer('system/lan/' . $config['language'] . '.json');
|
||||
if (file_exists($lan_file)) {
|
||||
$_L = json_decode(file_get_contents($lan_file), true);
|
||||
$_SESSION['Lang'] = $_L;
|
||||
|
||||
if (empty($_SESSION['Lang'])) {
|
||||
if (empty($config['language'])) {
|
||||
$config['language'] = 'english';
|
||||
}
|
||||
$lan_file = $root_path . File::pathFixer('system/lan/' . $config['language'] . '.json');
|
||||
if (file_exists($lan_file)) {
|
||||
$_L = json_decode(file_get_contents($lan_file), true);
|
||||
$_SESSION['Lang'] = $_L;
|
||||
} else {
|
||||
$_L['author'] = 'Auto Generated by iBNuX Script';
|
||||
$_SESSION['Lang'] = $_L;
|
||||
file_put_contents($lan_file, json_encode($_L));
|
||||
}
|
||||
} else {
|
||||
$_L['author'] = 'Auto Generated by iBNuX Script';
|
||||
$_SESSION['Lang'] = $_L;
|
||||
file_put_contents($lan_file, json_encode($_L));
|
||||
$_L = $_SESSION['Lang'];
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user