[Django] #25709: Template tag get_available_languages si doing unwanted translation

4 views
Skip to first unread message

Django

unread,
Nov 8, 2015, 4:24:47 AM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
I have this defined in my settings.py:


{{{
LANGUAGES = (
('sk', u'Slovenčina'),
('en', u'English'),
)
}}}


I don't want the language names to be translated and this is why i don't
used _(). While using template tag get_available_languages to get list of
available langauges, the language names are getting translated anyway.

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

Django

unread,
Nov 8, 2015, 4:52:18 AM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
-----------------------------+----------------------------

Reporter: azurit | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------+----------------------------
Changes (by azurit):

* Attachment "patchfile" added.

Django

unread,
Nov 8, 2015, 4:52:37 AM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------

Reporter: azurit | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.8
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 azurit):

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


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

Django

unread,
Nov 8, 2015, 6:46:18 AM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+------------------------------------

Reporter: azurit | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by iljamaas):

* stage: Unreviewed => Accepted


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

Django

unread,
Nov 8, 2015, 10:08:09 AM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+------------------------------------

Reporter: azurit | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by azurit):

Can i ask which Django version will include this fix and approximately
when it will be released? Thank you.

--
Ticket URL: <https://code.djangoproject.com/ticket/25709#comment:3>

Django

unread,
Nov 8, 2015, 2:05:33 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by claudep):

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


Comment:

The fact that the language name is translated is documented:
https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#get-
available-languages

If you want to get the untranslated language name, you can access it
through `get_language_info`:
https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#get-
language-info

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

Django

unread,
Nov 8, 2015, 2:11:50 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by azurit):

Using get_language_info is not the solution as it is NOT reading langauge
names from settings.py - it is simply not using my own names but some kind
of Django defined names (which it generates based on country code). I
don't understand why get_available_languages is translating langauge
names, if someone wants translated names, he/she can use _() in
settings.py (which also documentation suggests).

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

Django

unread,
Nov 8, 2015, 2:20:26 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by azurit):

What is the point in translating language names into current language?
Language names should always be in the local translation so everyone will
understand them. This seems to me like an old Nokia mobile joke where you
just switched a language of friends phone to Chinese and Nokia was
displaying also language names in Chinese so he/she was unable to switch
it back without trying all languages and finding the correct one.

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

Django

unread,
Nov 8, 2015, 3:01:17 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by claudep):

In the use case of a user having to switch into her own language, you are
right. But there are also other valid use cases where you want to present
language names with the current language. That's why Django offers both
possibilities either through `get_available_languages` or
`get_language_info`.

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

Django

unread,
Nov 8, 2015, 3:05:54 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by azurit):

As i stated before, get_language_info is NOT reading language names from
settings.py so it won't fix my problem. Currently, i workarounded the
unwanted translation by suffixing language names with a space, which is
REALLY ugly hack but there's no other simple solution :(

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

Django

unread,
Nov 8, 2015, 3:18:56 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by claudep):

Note that language names in the default `settings.LANGUAGES` are in
English. `get_language_info` uses the `django.conf.locale.LANG_INFO`
dictionary which already contains untranslated language name for all
supported locales.

If you have specific needs not covered by the utilities from Django, it
should not be hard to provide your own piece of code for that (view
context if this is for a specific page, context processor or custom tag if
you need it more globally).

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

Django

unread,
Nov 8, 2015, 3:28:23 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by azurit):

I know there are lots of other solutions but i wanted a simple and nice
one - for a gods sake, i just want to show untranslated langauge name of
my choice! :) By the way, slovak local language name returned by
get_language_info is grammatically incorrect.

--
Ticket URL: <https://code.djangoproject.com/ticket/25709#comment:10>

Django

unread,
Nov 8, 2015, 4:40:30 PM11/8/15
to django-...@googlegroups.com
#25709: Template tag get_available_languages si doing unwanted translation
---------------------------------+--------------------------------------
Reporter: azurit | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 1.8
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by claudep):

Replying to [comment:10 azurit]:


> By the way, slovak local language name returned by get_language_info is
grammatically incorrect.

Could you please open a separate ticket for that?

--
Ticket URL: <https://code.djangoproject.com/ticket/25709#comment:11>

Reply all
Reply to author
Forward
0 new messages