[Django] #21055: Error when implementing unknown language

12 views
Skip to first unread message

Django

unread,
Sep 6, 2013, 1:30:09 PM9/6/13
to django-...@googlegroups.com
#21055: Error when implementing unknown language
------------------------------+--------------------
Reporter: beck | Owner: nobody
Type: Bug | Status: new
Component: Translations | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 1 | UI/UX: 0
------------------------------+--------------------
When trying to implement a language unknown to django (say Inuktitut, ISO
639-1 lang code "iu") an error is encountered.

Discovered while trying to answer:
https://groups.google.com/forum/#!msg/django-
users/tc0asF6iFBo/u3cBN0SlUl0J
https://code.djangoproject.com/ticket/18192

Tests to and patch in comments.

--
Ticket URL: <https://code.djangoproject.com/ticket/21055>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 6, 2013, 1:35:06 PM9/6/13
to django-...@googlegroups.com
#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
------------------------------+--------------------------------------
Changes (by beck):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Tests and patch: https://github.com/django/django/pull/1562

--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:1>

Django

unread,
Nov 12, 2013, 4:14:21 PM11/12/13
to django-...@googlegroups.com
#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 bouke):

How can I reproduce the problem? I've tried with the example below, but
that seems to be working allright.

{{{
from django.conf import settings
settings.configure(
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
)

from django.utils.translation.trans_real import activate, gettext
activate('iu-ca')
print(gettext('Hello, world.'))
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:2>

Django

unread,
Feb 3, 2014, 5:46:52 PM2/3/14
to django-...@googlegroups.com
#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

unread,
Feb 4, 2014, 11:44:25 PM2/4/14
to django-...@googlegroups.com
#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 anonymous):

Looks about right. The core issue is that an inappropriate IOError
exception in trans_real.translation() that results in downstream failure.

This section of code is difficult to debug and write fixes for. I've
closed my old pull in favor of a rewrite:
https://github.com/django/django/pull/2237

Some of this code hasn't been touched in ages.
I hope this pull is reviewed and merged so core django translations dev
can happen without hours of trying to untangle what is happening.

--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:4>

Django

unread,
Feb 5, 2014, 12:08:35 AM2/5/14
to django-...@googlegroups.com
#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 beck):

Replying to [comment:4 anonymous]:

Errr... didn't mean to post as anon

--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:5>

Django

unread,
Feb 7, 2014, 8:17:28 AM2/7/14
to django-...@googlegroups.com
#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: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by timo):

* easy: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:6>

Django

unread,
Apr 8, 2014, 7:09:56 PM4/8/14
to django-...@googlegroups.com
#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: 0 | UI/UX: 0
------------------------------+--------------------------------------

Comment (by timo):

#22409 was a duplicate.

--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:7>

Django

unread,
Apr 28, 2014, 8:09:47 PM4/28/14
to django-...@googlegroups.com
#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: 0 | UI/UX: 0
------------------------------+--------------------------------------

Comment (by timo):

Is #18192 a duplicate?

--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:8>

Django

unread,
Apr 30, 2014, 12:37:26 PM4/30/14
to django-...@googlegroups.com
#21055: Error when implementing unknown language
------------------------------+--------------------------------------
Reporter: beck | Owner: nobody
Type: Bug | Status: closed
Component: Translations | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a5f6cbce07b5f3ab48d931e3fd1883c757fb9b45"]:
{{{
#!CommitTicketReference repository=""
revision="a5f6cbce07b5f3ab48d931e3fd1883c757fb9b45"
Refactored DjangoTranslation class

Also fixes #18192 and #21055.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21055#comment:9>

Reply all
Reply to author
Forward
0 new messages