|
@@ -1,16 +1,16 @@
|
|
|
$(function(){
|
|
|
-
|
|
|
- function loadProperties() {
|
|
|
+ var default_value="en";
|
|
|
+ function loadProperties(val) {
|
|
|
jQuery.i18n.properties({//加载资浏览器语言对应的资源文件
|
|
|
name : 'strings', //资源文件名称
|
|
|
- path : '/i18n/', //资源文件路径
|
|
|
+ path : '/lanhu-bootstrap/i18n/', //资源文件路径
|
|
|
mode : 'map', //用Map的方式使用资源文件中的值
|
|
|
- language : 'zh-CH',
|
|
|
+ language : val, // - 不支持 ,支持_
|
|
|
callback : function() {//加载成功后设置显示内容
|
|
|
$('.i18n-text').each(function() {
|
|
|
- console.log($(this).text())
|
|
|
-
|
|
|
- $(this).text($.i18n.prop($(this).text()));
|
|
|
+ var prop=$(this).attr('i18n')
|
|
|
+ var value=$.i18n.prop(prop)
|
|
|
+ $(this).text(value);
|
|
|
});
|
|
|
$('.i18n-input').each(function() {
|
|
|
$(this).value($.i18n.prop($(this).text()));
|
|
@@ -19,5 +19,11 @@ $(function(){
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- loadProperties();
|
|
|
+ $("#language").on("change",function(){
|
|
|
+
|
|
|
+ loadProperties($(this).val());
|
|
|
+
|
|
|
+ })
|
|
|
+ loadProperties(default_value);
|
|
|
+
|
|
|
})
|