Commit 929034f1 authored by Jérome Perrin's avatar Jérome Perrin

move DummyLocalizer from testDms in utils


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17865 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5bdd58c1
...@@ -68,6 +68,39 @@ class DummyTranslationService: ...@@ -68,6 +68,39 @@ class DummyTranslationService:
self._translated.setdefault(domain, []).append((msgid, mapping)) self._translated.setdefault(domain, []).append((msgid, mapping))
return msgid return msgid
class DummyMessageCatalog:
__allow_access_to_unprotected_subobjects__ = 1
def gettext(self, word, *args, **kw):
return word
class DummyLocalizer:
"""A replacement for stock cookie - based localizer.
You can change the current language by calling 'changeLanguage'
"""
__allow_access_to_unprotected_subobjects__ = 1
erp5_ui = DummyMessageCatalog()
erp5_catalog = DummyMessageCatalog()
lang = 'en'
def get_selected_language(self):
return self.lang
def get_languages_map(self):
return [{'selected': True, 'id': 'en', 'title': 'English'},
{'selected': False, 'id': 'pl', 'title': 'Polish'},
{'selected': False, 'id': 'fr', 'title': 'French'},]
def changeLanguage(self, lang):
self.lang = lang
def translate(self, word, *args, **kw):
return word
def __call__(self, request, context):
# the before traverse hook
pass
# python scripts # python scripts
def createZODBPythonScript(container, script_id, script_params, def createZODBPythonScript(container, script_id, script_params,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment