Kaydet (Commit) a5f6cbce authored tarafından Doug Beck's avatar Doug Beck Kaydeden (comit) Claude Paroz

Refactored DjangoTranslation class

Also fixes #18192 and #21055.
üst 7c54f8cc
......@@ -104,6 +104,7 @@ answer newbie questions, and generally made Django that much better:
Batman
Oliver Beattie <oliver@obeattie.com>
Brian Beck <http://blog.brianbeck.com/>
Doug Beck <doug@douglasbeck.com>
Shannon -jj Behrens <http://jjinux.blogspot.com/>
Esdras Beleza <linux@esdrasbeleza.com>
Božidar Benko <bbenko@gmail.com>
......
......@@ -4,6 +4,7 @@ from __future__ import unicode_literals
from contextlib import contextmanager
import datetime
import decimal
import gettext as gettext_module
from importlib import import_module
import os
import pickle
......@@ -1338,3 +1339,26 @@ class CountrySpecificLanguageTests(TestCase):
r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-pt,en-US;q=0.8,en;q=0.6,ru;q=0.4'}
lang = get_language_from_request(r)
self.assertEqual('pt-br', lang)
class TranslationFilesMissing(TestCase):
def setUp(self):
super(TranslationFilesMissing, self).setUp()
self.gettext_find_builtin = gettext_module.find
def tearDown(self):
gettext_module.find = self.gettext_find_builtin
super(TranslationFilesMissing, self).tearDown()
def patchGettextFind(self):
gettext_module.find = lambda *args, **kw: None
def test_failure_finding_default_mo_files(self):
'''
Ensure IOError is raised if the default language is unparseable.
Refs: #18192
'''
self.patchGettextFind()
trans_real._translations = {}
self.assertRaises(IOError, activate, 'en')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment