cwconfig.py
brancholdstable
changeset 6749 48f468f33704
parent 6748 52226299c352
child 6750 ef513c03a224
--- a/cwconfig.py	Fri Dec 10 15:17:16 2010 +0100
+++ b/cwconfig.py	Fri Dec 10 12:17:18 2010 +0100
@@ -141,7 +141,7 @@
 from smtplib import SMTP
 from threading import Lock
 from os.path import (exists, join, expanduser, abspath, normpath,
-                     basename, isdir, dirname)
+                     basename, isdir, dirname, splitext)
 from warnings import warn
 from logilab.common.decorators import cached, classproperty
 from logilab.common.deprecation import deprecated
@@ -399,6 +399,13 @@
         return join(cls.shared_dir(), 'i18n')
 
     @classmethod
+    def cw_languages(cls):
+        for fname in os.listdir(join(cls.i18n_lib_dir())):
+            if fname.endswith('.po'):
+                yield splitext(fname)[0]
+
+
+    @classmethod
     def available_cubes(cls):
         import re
         cubes = set()
@@ -947,6 +954,9 @@
     def __init__(self, appid, debugmode=False):
         self.appid = appid
         super(CubicWebConfiguration, self).__init__(debugmode)
+        fake_gettext = (unicode, lambda ctx, msgid: unicode(msgid))
+        for lang in self.available_languages():
+            self.translations[lang] = fake_gettext
         self._cubes = None
         self.load_file_configuration(self.main_config_file())