初步的网页国际化支持

1. 添加 jquery i18n js 依赖和入口
2. 在登录界面添加语言切换功能
This commit is contained in:
mofeng-git
2024-08-09 22:49:41 +08:00
parent 4fc188dbc8
commit 4a6fbce485
12 changed files with 97 additions and 10 deletions

29
web/share/js/i18n/i18n.js Normal file
View File

@@ -0,0 +1,29 @@
$(document).ready(function() {
/*默认语言*/
var defaultLang = "cn";
$("[i18n]").i18n({
defaultLang: defaultLang,
filePath: "/share/i18n/",
filePrefix: "i18n_",
fileSuffix: "",
forever: true,
callback: function() {
console.log("i18n is ready.");
}
});
/*切换为中文 - 按钮*/
$(".chinese").click(function() {
$("[i18n]").i18n({
defaultLang: "cn",
filePath: "/share/i18n/"
});
});
/*切换为英文 - 按钮*/
$(".english").click(function() {
$("[i18n]").i18n({
defaultLang: "en",
filePath: "/share/i18n/"
});
});
});