def test_activate(): 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_all()
def test_cached_activate(): """ Make sure the locale is always activated properly, even when we hit a cached version. """ l10n.deactivate_all() l10n.activate('fr') eq_(translation.get_language(), 'fr') l10n.activate('vi') eq_(translation.get_language(), 'vi') l10n.activate('fr') eq_(translation.get_language(), 'fr') l10n.activate('de') eq_(translation.get_language(), 'de') l10n.activate('fr') eq_(translation.get_language(), 'fr') l10n.activate('vi') eq_(translation.get_language(), 'vi')
def teardown(): if os.path.isdir(LOCALEDIR): shutil.rmtree(LOCALEDIR) l10n.deactivate_all()