[config, i18n] Create default translation mechanism for all supported languages. oldstable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 09 Nov 2010 17:17:45 +0100
brancholdstable
changeset 6729 1a423eaee782
parent 6728 f68bd4c876d1
child 6733 627a93027605
[config, i18n] Create default translation mechanism for all supported languages. Mostly usefull in test where language are never initialised from .po files.
cwconfig.py
devtools/__init__.py
--- a/cwconfig.py	Fri Dec 03 11:24:48 2010 +0000
+++ b/cwconfig.py	Tue Nov 09 17:17:45 2010 +0100
@@ -947,6 +947,9 @@
     def __init__(self, appid, debugmode=False):
         self.appid = appid
         CubicWebNoAppConfiguration.__init__(self, 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())
 
--- a/devtools/__init__.py	Fri Dec 03 11:24:48 2010 +0000
+++ b/devtools/__init__.py	Tue Nov 09 17:17:45 2010 +0100
@@ -190,7 +190,7 @@
     cube_appobject_path = TestServerConfiguration.cube_appobject_path | TwistedConfiguration.cube_appobject_path
 
     def available_languages(self, *args):
-        return ('en', 'fr', 'de')
+        return ('en', 'fr', 'de', 'es')
 
     def pyro_enabled(self):
         # but export PYRO_MULTITHREAD=0 or you get problems with sqlite and