Пример #1
0
 def test_lazy_gettext(self):
     app = flask.Flask(__name__)
     b = babel.Babel(app, default_locale='de_DE')
     yes = lazy_gettext(u'Yes')
     with app.test_request_context():
         assert text_type(yes) == 'Ja'
     app.config['BABEL_DEFAULT_LOCALE'] = 'en_US'
     with app.test_request_context():
         assert text_type(yes) == 'Yes'
Пример #2
0
 def test_lazy_gettext(self):
     app = flask.Flask(__name__)
     b = babel.Babel(app, default_locale='de_DE')
     yes = lazy_gettext(u'Yes')
     with app.test_request_context():
         assert text_type(yes) == 'Ja'
     app.config['BABEL_DEFAULT_LOCALE'] = 'en_US'
     with app.test_request_context():
         assert text_type(yes) == 'Yes'
Пример #3
0
 def test_lazy_gettext_defaultdomain(self):
     app = flask.Flask(__name__)
     domain = babel.Domain(domain='test')
     b = babel.Babel(app, default_locale='de_DE', default_domain=domain)
     first = lazy_gettext('first')
     with app.test_request_context():
         assert text_type(first) == 'erste'
     app.config['BABEL_DEFAULT_LOCALE'] = 'en_US'
     with app.test_request_context():
         assert text_type(first) == 'first'
Пример #4
0
 def test_lazy_gettext_defaultdomain(self):
     app = flask.Flask(__name__)
     domain = babel.Domain(domain='test')
     b = babel.Babel(app, default_locale='de_DE', default_domain=domain)
     first = lazy_gettext('first')
     with app.test_request_context():
         assert text_type(first) == 'erste'
     app.config['BABEL_DEFAULT_LOCALE'] = 'en_US'
     with app.test_request_context():
         assert text_type(first) == 'first'