开发者

jquery.i18n.properties how to configure several properties files

开发者 https://www.devze.com 2023-03-10 16:27 出处:网络
Does anybody know how to declare several properties file to load for JQuery.i18n.properties plugin. I开发者_Python百科 tried this:

Does anybody know how to declare several properties file to load for JQuery.i18n.properties plugin. I开发者_Python百科 tried this:

jQuery.i18n.properties({
     name:'ApplicationResources','Forum', 
     path:'/host/global/', 
     mode:'both',
     language:'de', 
     callback: function() {

     }
});

Its not working. The Help of the plugin set there is a support for several names in this format('Msg1','Msg2') But unfortunatelly, I can't get it to work.

Appreciate help from you,


I also want to load several properties files by i18n.properties. Its docs or examples do not show how to do this. And I just digged into its source code, and found that it uses array in the 'name' settings.

[$.i18n.properties source code]:

$.i18n.properties = function(settings) {
....
  var files=getFiles(settings.name);
  for(i=0; i<files.length; i++) {
    // 1. load base (eg, Messages.properties)
    loadAndParseFile(settings.path + files[i] + '.properties', settings);
    ....
  }
}
...
/** Make sure filename is an array */
function getFiles(names) {
  return (names && names.constructor == Array) ? names : [names];
}

So the solution for this should be:

 jQuery.i18n.properties({
 name: ['ApplicationResources','Forum'], 
 path:'/host/global/',
...
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号