예제 #1
0
파일: utils.py 프로젝트: qyqx/tracim
def _lazy_ugettext(text: str):
    """
    This function test if application context is available
    :param text: String to traduce
    :return: lazyfied string or string
    """
    try:
        # Test if context is available,
        # cf. https://github.com/tracim/tracim/issues/173
        context = StackedObjectProxy(name="context")
        context.translator
        return ugettext(text)
    except TypeError:
        return text
예제 #2
0
파일: test_i18n.py 프로젝트: 984958198/tg2
 def hello(self, **kw):
     return dict(text=unicode_text(i18n.ugettext('Your application is now running')))
예제 #3
0
파일: test_i18n.py 프로젝트: 984958198/tg2
 def fallback(self, **kw):
     return i18n.ugettext('This is a fallback')
예제 #4
0
 def fallback(self, **kw):
     return i18n.ugettext('This is a fallback')
예제 #5
0
 def hello(self, **kw):
     return dict(text=unicode_text(
         i18n.ugettext('Your application is now running')))