js国际化解决方案(使用 jQuery.i18n.properties)
来源:互联网 发布:怎么看淘宝店铺买家秀 编辑:程序博客网 时间:2024/05/19 10:41
//设置语言httpServletRequest.getSession().setAttribute("currUser_language",langType!=null?langType:"zh_CN");
<#assign currUser_language = Session["currUser_language"]><#assign path="${request.contextPath}"><script language="JavaScript"> var ctx = '${path}'; var currUser_language = '${currUser_language}';</script>
<script type="text/javascript" src="${path}/statics/common/js/easy-ui/easyui/1.3.4/locale/easyui-lang-${currUser_language}.js"></script>
<script type="text/javascript" src="${path}/statics/common/js/i18n/jquery.i18n.properties-1.0.9.js"></script>
<script> var language_pack = { now_lang : "zh_CN", loadProperties : function(new_lang){ var self = this; var tmp_lang = new_lang; jQuery.i18n.properties({//加载资浏览器语言对应的资源文件 name: 'strings', //资源文件名称 path:ctx + '/statics/common/js/i18n/language/', //资源文件路径 language: tmp_lang, cache: false, mode:'map', //用Map的方式使用资源文件中的值 callback: function() {//加载成功后设置显示内容 /*for(var i in $.i18n.map){ $('[data-lang="'+i+'"]').text($.i18n.map[i]); } document.title = $.i18n.map['string_title'];*/ //alert($.i18n.map['string_title']); //alert($.i18n.prop('string_hello',new_lang,new_lang)); } }); self.now_lang = new_lang; } }; $(document).ready(function(){ language_pack.loadProperties(currUser_language); });</script>
strings_en.properties:
common.edit=Editcommon.add=Addcommon.delete=Deletestrings_zh_CN.properties:
common.edit=编辑common.add=添加common.delete=删除
js中使用如下:
$.i18n.map['common.save']
$.i18n.prop('string_hello','110','cde')
阅读全文
0 0
- js国际化解决方案(使用 jQuery.i18n.properties)
- jQuery.i18n.properties实现js国际化
- 使用 jQuery.i18n.properties 实现 Web 前端的国际化
- 使用 jQuery.i18n.properties 实现 Web 前端的国际化
- 使用 jQuery.i18n.properties 实现Web 前端的国际化
- 使用 jQuery.i18n.properties 实现Web 前端的国际化
- 使用 jQuery.i18n.properties 实现 Web 前端的国际化
- 使用 jQuery.i18n.properties 实现 Web 前端的国际化
- 使用 jQuery.i18n.properties 实现 Web 前端的国际化
- 使用 jQuery.i18n.properties 实现 Web 前端的国际化
- 使用 jQuery.i18n.properties 实现 Web 前端的国际化
- 使用jquery.i18n.properties 实现web前端国际化
- jQuery之前端国际化jQuery.i18n.properties
- jQuery之前端国际化jQuery.i18n.properties
- jQuery之前端国际化jQuery.i18n.properties
- jQuery.i18n.properties实现前端国际化
- Web前端国际化之jQuery.i18n.properties
- jQuery.i18n.properties实现前端国际化
- ORACLE安装的centos操作系统以及pdksh-5.2.14告警
- 内存优化
- 基于Solr的Hbase二级索引
- hive sql的重要函数
- AlexNet模型实现(3. C++模型实现)
- js国际化解决方案(使用 jQuery.i18n.properties)
- [Havok学习笔记(5)] CAMERA TUTORIAL
- 1005. 继续(3n+1)猜想 (25)
- ECMAScript6(15):Promise 对象
- 二分 Tavas and Karafs:CodeForces 535C
- C#汉字转拼音(npinyin)将中文转换成拼音全文或首字母
- 调用摄像头 拍照
- imgproc模块--霍夫圆变换
- HIve安装配置常见问题汇总