示例#1
0
文件: tests.py 项目: mccammos/zamboni
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()
示例#2
0
文件: tests.py 项目: mccammos/zamboni
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')
示例#3
0
文件: tests.py 项目: mccammos/zamboni
def teardown():
    if os.path.isdir(LOCALEDIR):
        shutil.rmtree(LOCALEDIR)
    l10n.deactivate_all()