#21055: Error when implementing unknown language
------------------------------+--------------------------------------
Reporter: beck | Owner: nobody
Type: Bug | Status: new
Component: Translations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
------------------------------+--------------------------------------
Comment (by fernando.gutierrez@…):
I think it is not related to one unknown language, probably related to two
unknown languages and the way django tries to avoid sharing the
translation object? This script fails for me in the third activate, it
basically replicates what I am trying to do for a language chooser, were
in one template I try to show the language name in it's own language:
{{{
from django.conf import settings
gettext = lambda s: s
settings.configure(
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
},
LANGUAGES = (
('en', gettext('English')),
('zh-sg', gettext('Traditional Chinese (Singapore)')),
('zh-hk', gettext('Traditional Chinese (Hong Kong)')),
)
)
from django.utils.translation.trans_real import activate, gettext
activate('en')
print(gettext('Hello, world.'))
activate('zh-sg')
print(gettext('Hello, world.'))
activate('zh-hk')
print(gettext('Hello, world.'))
}}}
Fails with:
{{{
$ python script.py
Hello, world.
Hello, world.
Traceback (most recent call last):
File "script.py", line 21, in <module>
activate('zh-hk')
File "/Users/***/.virtualenvs/cumutmp/lib/python2.7/site-
packages/django/utils/translation/trans_real.py", line 194, in activate
_active.value = translation(language)
File "/Users/***/.virtualenvs/cumutmp/lib/python2.7/site-
packages/django/utils/translation/trans_real.py", line 184, in translation
current_translation = _fetch(language, fallback=default_translation)
File "/Users/***/.virtualenvs/cumutmp/lib/python2.7/site-
packages/django/utils/translation/trans_real.py", line 147, in _fetch
res._info = res._info.copy()
AttributeError: 'NoneType' object has no attribute '_info'
}}}
This is django 1.4.10 btw. (I've replaced my username with *)
--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/062.fcb945d5bddfa088c4e4a4ba4ddd4d0b%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.