Simple test case:
{{{
>>> from django.utils import translation
>>> translation.activate('foo')
>>> translation.gettext('x')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.7/dist-
packages/django/utils/translation/__init__.py", line 77, in gettext
return _trans.gettext(message)
File "/usr/lib/python2.7/dist-
packages/django/utils/translation/trans_real.py", line 312, in gettext
return do_translate(message, 'gettext')
File "/usr/lib/python2.7/dist-
packages/django/utils/translation/trans_real.py", line 298, in
do_translate
result = getattr(translation_object,
translation_function)(eol_message)
File "/usr/lib/python2.7/gettext.py", line 348, in gettext
tmsg = self._catalog.get(message, missing)
AttributeError: 'NoneType' object has no attribute 'get'
}}}
I think that either translation.activate should fail or fallback to
default locale.
--
Ticket URL: <https://code.djangoproject.com/ticket/26050>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Just for the reference, testcase executed in Django 1.9:
{{{
>>> from django.utils import translation
>>> translation.activate('foo')
>>> translation.gettext('x')
'x'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26050#comment:1>
* status: new => closed
* resolution: => duplicate
Comment:
Duplicate of #26046.
--
Ticket URL: <https://code.djangoproject.com/ticket/26050#comment:2>