Exemplo n.º 1
0
def test_context_manager():
    session.lang = 'fr_MP'
    with session_language('en_PI'):
        assert session.lang == 'en_PI'
        assert _(u'I need a drink.') == u"I be needin' a bottle of rhum!"

    assert session.lang == 'fr_MP'
Exemplo n.º 2
0
def test_context_manager():
    session.lang = 'fr_MP'
    with session_language('en_PI'):
        assert session.lang == 'en_PI'
        assert _(u'I need a drink.') == u"I be needin' a bottle of rhum!"

    assert session.lang == 'fr_MP'
Exemplo n.º 3
0
 def example():
     """Example command from example plugin"""
     with current_app.test_request_context():
         with session_language('es_ES'):
             print _('example plugin says hi'), current_plugin
             if self.settings.get('show_message'):
                 print self.settings.get('dummy_message')
Exemplo n.º 4
0
 def example():
     """Example command from example plugin"""
     with current_app.test_request_context():
         with session_language('es_ES'):
             print _('example plugin says hi'), current_plugin
             if self.settings.get('show_message'):
                 print self.settings.get('dummy_message')
Exemplo n.º 5
0
def test_set_best_lang_request():
    with session_language('en_PI'):
        assert babel.locale_selector_func() == 'en_PI'
Exemplo n.º 6
0
def test_set_best_lang_request():
    with session_language('en_PI'):
        assert babel.locale_selector_func() == 'en_PI'