mirror of https://gitee.com/stylefeng/guns
更新html的多语言翻译
parent
343016494b
commit
f4da698d54
|
@ -5,6 +5,7 @@ import cn.stylefeng.guns.core.beetl.tag.SysDictCheckBoxTag;
|
|||
import cn.stylefeng.guns.core.beetl.tag.SysDictRadioTag;
|
||||
import cn.stylefeng.guns.core.beetl.tag.SysDictSelectTag;
|
||||
import cn.stylefeng.roses.kernel.auth.api.LoginUserApi;
|
||||
import cn.stylefeng.roses.kernel.i18n.util.QuickTranslateUtil;
|
||||
import cn.stylefeng.roses.kernel.system.expander.SystemConfigExpander;
|
||||
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
|
||||
|
||||
|
@ -34,6 +35,9 @@ public class CustomBeetlGroupUtilConfiguration extends BeetlGroupUtilConfigurati
|
|||
// 获取基本信息的工具
|
||||
groupTemplate.registerFunctionPackage("constants", SystemConfigExpander.class);
|
||||
|
||||
// 多语言
|
||||
groupTemplate.registerFunctionPackage("translate", QuickTranslateUtil.class);
|
||||
|
||||
// 下拉选字典
|
||||
groupTemplate.registerTag("dict_select", SysDictSelectTag.class);
|
||||
|
||||
|
@ -42,9 +46,6 @@ public class CustomBeetlGroupUtilConfiguration extends BeetlGroupUtilConfigurati
|
|||
|
||||
// 多选字典
|
||||
groupTemplate.registerTag("dict_checkbox", SysDictCheckBoxTag.class);
|
||||
|
||||
// todo 多语言
|
||||
// groupTemplate.registerFunctionPackage("lang", new UserTranslationContext());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,6 +54,31 @@
|
|||
var ws = layui.ws;
|
||||
var notice = layui.notice;
|
||||
|
||||
//获取支持的语言列表
|
||||
var languageRequest = new HttpRequest(Feng.ctxPath + "/i18n/getAllLanguages", 'get', function (data) {
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var code = data.data[i].code;
|
||||
var description = data.data[i].name;
|
||||
$("#languageDiv").append('<dd lay-unselect><a id="tran-' + code + '" href="javascript:;">' + description + '</a></dd>');
|
||||
|
||||
//设置监听事件,设置点击按钮切换当前系统语言
|
||||
(function (code) {
|
||||
$('#tran-' + code).click(function () {
|
||||
var changeLanguageRequest = new HttpRequest(Feng.ctxPath + "/i18n/changeUserTranslation", 'post', function (data) {
|
||||
window.location.href = Feng.ctxPath + "/";
|
||||
}, function (data) {
|
||||
layer.msg("切换多语言失败!" + data.message, {icon: 5, anim: 6});
|
||||
});
|
||||
changeLanguageRequest.set("tranLanguageCode", code);
|
||||
changeLanguageRequest.start(true);
|
||||
});
|
||||
})(code);
|
||||
}
|
||||
}, function (data) {
|
||||
layer.msg("获取语言列表失败!" + data.responseJSON.message, {icon: 5, anim: 6});
|
||||
});
|
||||
languageRequest.start();
|
||||
|
||||
// 默认加载主页
|
||||
index.loadHome({
|
||||
menuPath: $("#firstPageAction").attr('lay-href'),
|
||||
|
@ -106,7 +131,8 @@
|
|||
timeout: false
|
||||
});
|
||||
$('#messageDot').hide();
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
onWsClose: function (event) {
|
||||
//关闭连接回调
|
||||
|
|
|
@ -55,7 +55,9 @@
|
|||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd lay-unselect><a ew-href="${ctxPath}/view/personal">个人中心</a></dd>
|
||||
<dd lay-unselect><a id="setPsw">修改密码</a></dd>
|
||||
<dd lay-unselect><a id="setPsw">${translate.get("MENU_CHANGE_PASSWORD","修改密码")}</a></dd>
|
||||
<hr>
|
||||
<div id="languageDiv"></div>
|
||||
<hr>
|
||||
<dd lay-unselect><a id="btnLogout">退出</a></dd>
|
||||
</dl>
|
||||
|
|
Loading…
Reference in New Issue