文件要有默认 strings.properties 要不报错
loadProperties(lang)lang=en 或lang=tc或lang=zh 分别对应文件
<h2 class="protocolTitle" data-locale="userProtocol"></h2> 标签渲染
strings_en.properties 文件下
userProtocol=User Service Agreement
function loadProperties(lang) {
$.i18n.properties({
name: 'strings', //资源文件名称 , 命名格式: 文件名_国家代号.properties
path: 'lang', //资源文件路径,注意这里路径是你属性文件的所在文件夹,可以自定义。
mode: 'map', //用 Map 的方式使用资源文件中的值
language: lang, //这就是国家代号 name+language刚好组成属性文件名:strings+zh -> strings_zh.properties
callback: function () {
$("[data-locale]").each(function () {
$(this).html($.i18n.prop($(this).data("locale")));
});
}
});
}
jq语言
最新推荐文章于 2021-03-18 17:47:02 发布