What is the standard (ISO 639-1, IETF BCP 47, another) used in get_language?

123 views
Skip to first unread message

Fabio C. Barrionuevo da Luz

unread,
Sep 23, 2016, 9:12:39 AM9/23/16
to django-d...@googlegroups.com
Hello. What is the standard (ISO 639-1, ISO 639-2, IETF BCP47, another) used by django in get_language and to_locale functions?

I could not find in the documentation or on the source code, that explain exact what the standard is used

https://docs.djangoproject.com/en/1.10/topics/i18n/

the closest I came to discover the standard used was:

https://github.com/django/django/blob/master/django/utils/translation/trans_real.py#L35-L36


I found this topic, but as it's been more than 10 years, I'm not sure if anything has changed:


https://www.w3.org/TR/html5/dom.html#the-lang-and-xml:lang-attributes


all this is because I'm trying to solve this problem: https://github.com/yourlabs/django-autocomplete-light/pull/746

select2 js uses a another standard (who have not figured out what is) to define name the language js files.

I'm trying to figure out a way to make a table of equivalence from django language_code vs select2 language files



--
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul


Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e mandar o pull-request. Leia mais sobre como publicar em README.md e contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou louco para ler...

Claude Paroz

unread,
Sep 23, 2016, 10:49:48 AM9/23/16
to Django developers (Contributions to Django itself)
AFAIK Django receives the language tags from the browsers as IETF language tags, and then convert them in locale names suitable for gettext.
https://en.wikipedia.org/wiki/IETF_language_tag
https://www.gnu.org/software/gettext/manual/gettext.html#Locale-Names

Hope this helps,

Claude
Reply all
Reply to author
Forward
0 new messages