1.enhance i18n support

2.update layui to 2.9.3
This commit is contained in:
杨黄林
2024-01-11 21:31:04 +08:00
parent e9c0997799
commit 1e1ff7127e
6 changed files with 27 additions and 18 deletions

View File

@@ -99,5 +99,9 @@
"Please input password": "Please input password", "Please input password": "Please input password",
"Login success": "Login success", "Login success": "Login success",
"Username or password incorrect": "Username or password incorrect", "Username or password incorrect": "Username or password incorrect",
"Token invalid": "Token invalid" "Token invalid": "Token invalid",
"Total": "Total ",
"Items": " items",
"Go to": "Go to",
"Per Page": " / page"
} }

View File

@@ -99,5 +99,9 @@
"Please input password": "请填写密码", "Please input password": "请填写密码",
"Login success": "登录成功", "Login success": "登录成功",
"Username or password incorrect": "用户名或密码错误", "Username or password incorrect": "用户名或密码错误",
"Token invalid": "登录信息无效" "Token invalid": "登录信息无效",
"Total": "共",
"Items": "条记录",
"Go to": "到第",
"Per Page": "条/页"
} }

View File

@@ -1,9 +1,17 @@
var httpPort, httpsPort; var httpPort, httpsPort, pageOptions;
(function ($) { (function ($) {
$(function () { $(function () {
function init() { function init() {
var langLoading = layui.layer.load() var langLoading = layui.layer.load()
$.getJSON('/lang.json').done(function (lang) { $.getJSON('/lang.json').done(function (lang) {
pageOptions = {
limitTemplet: function (item) {
return item + lang['PerPage'];
},
skipText: [lang['Goto'], '', lang['Confirm']],
countText: [lang['Total'], lang['Items']]
};
$.ajaxSetup({ $.ajaxSetup({
error: function (xhr,) { error: function (xhr,) {
if (xhr.status === 401) { if (xhr.status === 401) {
@@ -12,7 +20,7 @@ var httpPort, httpsPort;
}); });
} }
}, },
}) });
layui.element.on('nav(leftNav)', function (elem) { layui.element.on('nav(leftNav)', function (elem) {
var id = elem.attr('id'); var id = elem.attr('id');
@@ -47,15 +55,4 @@ var httpPort, httpsPort;
init(); init();
}); });
})(layui.$); })(layui.$);
var pageOptions = {
layout: navigator.language.indexOf("zh") === -1 ? ['prev', 'page', 'next', 'skip', 'limit'] : ['prev', 'page', 'next', 'skip', 'count', 'limit'],
limitTemplet: function (item) {
if (navigator.language.indexOf("zh") === -1) {
return item + ' / Page';
}
return item + ' 条/页';
},
skipText: navigator.language.indexOf("zh") === -1 ? ['Go to', '', 'Confirm'] : ['到第', '页', '确定']
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -238,6 +238,10 @@ func (c *HandleController) MakeLangFunc() func(context *gin.Context) {
"NotSet": ginI18n.MustGetMessage(context, "Not Set"), "NotSet": ginI18n.MustGetMessage(context, "Not Set"),
"Proxy": ginI18n.MustGetMessage(context, "Proxy"), "Proxy": ginI18n.MustGetMessage(context, "Proxy"),
"TokenInvalid": ginI18n.MustGetMessage(context, "Token invalid"), "TokenInvalid": ginI18n.MustGetMessage(context, "Token invalid"),
"Total": ginI18n.MustGetMessage(context, "Total"),
"Items": ginI18n.MustGetMessage(context, "Items"),
"Goto": ginI18n.MustGetMessage(context, "Go to"),
"PerPage": ginI18n.MustGetMessage(context, "Per Page"),
}) })
} }
} }