Commits

Zhang Huangbin  committed 913d946

Use glob.glob() to fetch directory names of i18n translations.

  • Participants
  • Parent commits a37367e

Comments (0)

Files changed (1)

File libs/ldaplib/admin.py

 # along with iRedAdmin-OSE.  If not, see <http://www.gnu.org/licenses/>.
 #---------------------------------------------------------------------
 
-import os, sys
+import sys
+import os
+import glob
 import ldap, ldap.filter
 import web
 from libs import languages, iredutils
     # Get available languages.
     def getLanguageMaps(self):
         # Get available languages.
-        self.available_langs = [ web.safestr(v)
-                for v in os.listdir(cfg.get('rootdir')+'i18n')
-                if v in languages.langmaps
+        self.available_langs = [ web.safestr(os.path.basename(v))
+                for v in glob.glob(cfg.get('rootdir')+'i18n/[a-z][a-z]_[A-Z][A-Z]')
+                if os.path.basename(v) in languages.langmaps
+                ]
+        self.available_langs += [ web.safestr(os.path.basename(v))
+                for v in glob.glob(cfg.get('rootdir')+'i18n/[a-z][a-z]')
+                if os.path.basename(v) in languages.langmaps
                 ]
         self.available_langs.sort()