get_language() isn't reliable here, so we'll clear everything. This works on my local box

This commit is contained in:
Wil Clouser 2010-02-22 15:36:49 -08:00
Родитель d9ed8e0278
Коммит 9e5aef461d
2 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -75,12 +75,10 @@ def activate(locale):
jingo.env.install_gettext_translations(t)
def deactivate():
""" Override django's utils.translation.deactivate(). Django continues
to cache a catalog even if you call their deactivate().
def deactivate_all():
""" Override django's utils.translation.deactivate_all(). Django continues
to cache a catalog even if you call their deactivate_all().
"""
locale = django_trans.get_language()
django_trans.deactivate()
if locale in django_trans._translations:
del django_trans._translations[locale]
django_trans.deactivate_all()
django_trans._translations = {}

Просмотреть файл

@ -25,7 +25,7 @@ def setup():
def teardown():
if os.path.isdir(LOCALEDIR):
shutil.rmtree(LOCALEDIR)
l10n.deactivate()
l10n.deactivate_all()
@with_setup(setup, teardown)
@ -67,13 +67,13 @@ def test_ungettext():
def test_activate():
l10n.deactivate()
l10n.deactivate_all()
l10n.activate('fr')
# This string is from the AMO .po file
a_text = "My Account"
p_text = "Mon compte"
eq_(p_text, _(a_text))
l10n.deactivate()
l10n.deactivate_all()
MO_DATA = '''\