Pman.I18n = {
- /**
- * onReady: called on page load to fix 'other' translation.
- *
- * We have a special country/languages called 'other', which is used to handle
- * odd situations.
- *
- * To enable it to be translated, we need to change it's value after the pages is loaded..
- * The trigger is at the bottom of this file. (eg.Pman.on('load'))
- *
- */
- onReady : function()
- {
- var d = this.Data;
- var lang = Pman.Login.authUser.lang;
-
- var types = ['l','c'];
- Roo.each(types, function(t) {
- Roo.each(d[lang][t],function(v,i) {
- if (v['code'] == '**') {
- d[lang][t][i]['title'] = "Other";
- }
-
- });
-
- });
-
-
- },
/**
* turn zh_HK,en => into Chinese(HK) , English
if (code.indexOf('_') > -1) {
var clang = code.split('_').shift();
var cc = code.split('_').pop();
- return this.toName('l', clang) + ' (' + cc + ')';
+ return this.toName('l', clang.toUpperCase()) + ' (' + this.toName('c', cc.toUpperCase()) + ')';
}
ret = d.title;
return false; // stop!
}
+ return true;
});
return ret;
return Pman.I18n.Data[lang][type];
},
- simpleStoreData : function(type)
+ /**
+ * simpleStoreData:
+ * return a simplestore to be used by country/language combos
+ * eg.
+ * store: (function() {
+ return Pman.I18n.simpleStoreData('c');
+ })(),
+ *
+ * @param {Char} type (c,l,m)
+ * @param {function} (optional) filter language list
+ * called with object { code: xxx , title: xxx }
+ * if it exists then returning false will hide the entry.
+ */
+
+ simpleStoreData : function(type, filter)
{
+ filter = typeof(filter) == 'undefined' ? false : filter;
var lang = 'en';
try {
lang = Pman.Login.authUser.lang;
lang = lang || 'en';
var ret = [];
Roo.each(Pman.I18n.Data[lang][type], function (o) {
+ if (filter !== false && filter(o) === false) {
+ return;
+ }
ret.push([ o.code, o.title ]);
});
};
-
-Pmnan.on('load', Pman.I18n.onReady, Pman.I18n);
-
+