DataObjects/ProjectDirectory.php
[Pman.Core] / Pman.I18n.js
index b8878f5..931f9b3 100644 (file)
 
 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..
-     *
-     */
     
-    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
@@ -159,8 +131,23 @@ Pman.I18n = {
         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;
@@ -168,6 +155,9 @@ Pman.I18n = {
         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 ]);
         });
         
@@ -470,6 +460,4 @@ Pman.I18n = {
      
     
 };
-
-Pmnan.on('load', Pman.I18n.onReady, Pman.I18n);
-