1、自定义jquery国际化插件jquery.international.js,用来初始化国际化用到的变量
// plugin definition
$.fn.international = function(options) {
// Extend our default options with those provided.
// Note that the first arg to extend is an empty object -
// this is to keep from overriding our "defaults" object.
var opts = $.extend({}, $.fn.international.defaults, options);
// Our plugin implementation code goes here.
};
// plugin defaults - added as a property on our plugin function
$.fn.international.defaults = {
foreground: 'red',
background: 'yellow'
};
2、引入第一步的文件
<script src="<%=request.getContextPath()%>/js/jquery-easyui-1.2.6/plugins/jquery.international.js" charset="UTF-8" type="text/javascript"></script>
3、分别在中文和英文语言包中设置变量的值
easyui-lang-zh_CN.js
$.fn.international.defaults.foreground="红色";
easyui-lang-en.js
$.fn.international.defaults.foreground="red";
4、动态引入语言包文件,见我的上一篇博客