fix: 修复多语言获取

This commit is contained in:
Ying
2022-08-24 12:04:09 +08:00
parent 021edabb72
commit 3f310751e1
4 changed files with 7 additions and 3 deletions

View File

@@ -492,6 +492,7 @@ class Admin extends AdminController
$array = parse_ini_file($env, true);
$array['LANG_DEFAULT_LANG'] = $language;
$content = parse_array_ini($array);
request()->session()->set('lang', $language);
if (write_file($env, $content)) {
return json(['success']);
}

View File

@@ -162,6 +162,9 @@
admin.setStorage('language', obj.symbol);
location.reload();
})
// 清空本地缓存
admin.setConfig("TabLists", undefined);
}
});

View File

@@ -558,8 +558,8 @@ if (!function_exists('__')) {
*/
function __($str, $parameters = [], $domain = null, $locale = null)
{
if (is_numeric($str)
|| getenv('LANG_DEFAULT_LANG') === 'zh-CN') {
$lang = session('lang', 'zh-CN');
if (is_numeric($str) || strstr($lang, 'zh-CN')) {
return $str;
}

View File

@@ -137,7 +137,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form', 'rate', 'table', 'sl
, setBreadHtml: function () {
var b = '<div class="layui-breadcrumb-header layui-breadcrumb" lay-separator="/">';
b += ' <a lay-href="#">' + '主页' + '</a>';
b += ' <a lay-href="#">' + i18n.prop('主页') + '</a>';
b += ' <span class="breadcrumb">';
b += ' <a lay-href="#">Dashboard</a>';
b += ' </span>';