根据之前在网站上看到的文章,按照操作导入怎么没有反应alert(1111)可以弹出来,alert($.i18n.prop("Login"))就没反应,是哪里错了吗
发布网站访问还是file浏览的
发布网站注意配置web服务器添加.properties后缀的mime隐射
file浏览器不要用webkit核心浏览器,如chrome,360急速模式,ajax会出错
你看看你这代码,都没告诉i18n插件该加载哪一个properties。(假设你web服务器什么的都是对的。)
$.i18n.properties({
name: 'Messages',
language: 'en_US',
path: 'bundles'
});
官方API说明了,要给出name,language和path,我觉得你是没有给出language属性,导致不知道该用谁的。
i18n files are named .js, or .js or _.js
初始化时可用参数在这,你看看,你是不是缺点啥。
* @param name (string/string[], optional) names of file to load (eg, 'Messages' or ['Msg1','Msg2']). Defaults to "Messages"
* @param language (string, optional) language/country code (eg, 'en', 'en_US', 'pt_BR'). if not specified, language reported by the browser will be used instead.
* @param path (string, optional) path of directory that contains file to load
* @param mode (string, optional) whether bundles keys are available as JavaScript variables/functions or as a map (eg, 'vars' or 'map')
* @param debug (boolean, optional) whether debug statements are logged at the console
* @param cache (boolean, optional) whether bundles should be cached by the browser, or forcibly reloaded on each page load. Defaults to false (i.e. forcibly reloaded)
* @param encoding (string, optional) the encoding to request for bundles. Property file resource bundles are specified to be in ISO-8859-1 format. Defaults to UTF-8 for backward compatibility.
* @param callback (function, optional) callback function to be called after script is terminated
alert(111);
alert($.i18n.prop('Login'));