Adding Occitan language code 'oc' in LANG_INFO

110 views
Skip to first unread message

Yann Sionneau

unread,
Oct 25, 2019, 7:56:04 AM10/25/19
to Django developers (Contributions to Django itself)
Hello,

Do you think there would be any show stopper preventing from adding
Occitan language in

django/conf/locale/__init__.py LANG_INFO ?

That would (I think) allow Django apps to use 'oc' translations.

Cheers,

--

Yann

Adam Johnson

unread,
Oct 25, 2019, 9:00:46 AM10/25/19
to django-d...@googlegroups.com
Hi Yann,

I'm no translation expert, but I believe you can add your own language codes in your project and translate your project's strings. To be added to core django I think we need (at least some) translation coverage. The last language added was Armenian, in this PR: https://github.com/django/django/pull/10830 . The translations were first submitted on Transifex: https://docs.djangoproject.com/en/dev/internals/contributing/localizing/#translations

Thanks,

Adam

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/aa5f8eb8-4ad3-e52b-16b8-38aa911a7c2e%40sionneau.net.


--
Adam

Yann Sionneau

unread,
Oct 27, 2019, 8:34:58 AM10/27/19
to django-d...@googlegroups.com

Hi,

Thanks Adam for your quick answer!

I investigated this a bit more in depth.

It seems that Django cannot use any translation that the visitor would want (via cookie or via Accept-Language header) if the language code is not in settings.LANGUAGES.

If I read documentation about settings.LANGUAGES : https://docs.djangoproject.com/en/2.2/ref/settings/#languages

it says :

"Generally, the default value should suffice. Only set this setting if you want to restrict language selection to a subset of the Django-provided languages."

So the documentation is talking about *restricting* the list, not expanding it.

Anyway, I tried to expand it, it seemed to work.

I did this in my settings file:

LANGUAGES.append(
    ('oc', gettext_lazy('Occitan')),
)

Would you say that my understanding is correct? Is my solution correct? The best one?

Thanks!

Yann

Adam Johnson

unread,
Oct 29, 2019, 11:49:22 AM10/29/19
to django-d...@googlegroups.com
That looks good to me. To avoid mutating Django's default setting (though it's unlikely to do any harm), I'd do:

from django.conf import global_settings
LANGUAGES = global_settings.LANGUAGES + [('oc', gettext_lazy('Occitan'))]

Would you like to make a documentation PR to reword it to not just talk about restricting? There are many more languages in the world than in Django right now!

Yann Sionneau

unread,
Oct 30, 2019, 4:54:14 AM10/30/19
to django-d...@googlegroups.com, Adam Johnson

Thanks a lot!

Yes I think the documentation can improve a bit to make it more clear that this extension can be done.

I'll have a look at that in the next days.

Cheers

Yann

Yann Sionneau

unread,
Jan 5, 2020, 8:31:17 AM1/5/20
to django-d...@googlegroups.com, Adam Johnson

Hello Adam,

With a bit of delay, here it is: https://github.com/django/django/pull/12278

thanks for your help!

Reply all
Reply to author
Forward
0 new messages