LANGUAGE_CODE

139 views
Skip to first unread message

Yves de Champlain

unread,
Jul 28, 2019, 6:09:04 PM7/28/19
to Django users
HI

Django translation works very well for me, except that when I try to change LANGUAGE_CODE in settings.py, my site remains in French. I need to change my OS system settings to see the English version.

I have two languages, English as default and a French Translation.

LANGUAGES = (
    ('en', _('English')),
    ('fr', _('French')),
)

LANGUAGE_CODE = 'en'

Thanks for your insights !

yves


Aldian Fazrihady

unread,
Jul 29, 2019, 2:57:42 AM7/29/19
to django...@googlegroups.com
Hi Yves, please clear cookies and refresh your django app page afterwards.

It is possible to not use cookies at all regarding i18n if you use language code as part of URL. I always prefer using URL for i18n. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3a301603-3237-4674-9d8d-2f6362d3154e%40googlegroups.com.


--
Regards,

Yves de Champlain

unread,
Jul 29, 2019, 11:51:42 AM7/29/19
to django...@googlegroups.com

Yves de Champlain

unread,
Aug 10, 2019, 6:12:14 PM8/10/19
to Django users
Hi

I looked for the cookie, but did not find it. 

How do you find them when running django server on localhost:8000 ?

yves


Le dimanche 28 juillet 2019 22:57:42 UTC-4, Aldian Fazrihady a écrit :
Hi Yves, please clear cookies and refresh your django app page afterwards.

It is possible to not use cookies at all regarding i18n if you use language code as part of URL. I always prefer using URL for i18n. 

On Mon, Jul 29, 2019 at 1:08 AM Yves de Champlain <yes...@gmail.com> wrote:
HI

Django translation works very well for me, except that when I try to change LANGUAGE_CODE in settings.py, my site remains in French. I need to change my OS system settings to see the English version.

I have two languages, English as default and a French Translation.

LANGUAGES = (
    ('en', _('English')),
    ('fr', _('French')),
)

LANGUAGE_CODE = 'en'

Thanks for your insights !

yves


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

DANIEL URBANO DE LA RUA

unread,
Aug 10, 2019, 6:19:04 PM8/10/19
to django...@googlegroups.com
Prefix_default_language in urls file inside i18n_patterns

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

DANIEL URBANO DE LA RUA

unread,
Aug 10, 2019, 6:27:17 PM8/10/19
to django...@googlegroups.com
It may be not getting yor locale from your folders 

On Sun, 28 Jul 2019, 20:09 Yves de Champlain <yes...@gmail.com wrote:

Yves de Champlain

unread,
Aug 11, 2019, 6:51:17 PM8/11/19
to Django users
OK, I dogged a bit deeper and found something maybe worth mentioning.

My original problem was that my browser's LC is overriding settings.py:LANGUAGE_CODE. This means that changing the LANGUAGE_CODE does not change the site's language, but changing the language preference at system level does.

Now I found that one of my page does not follow that rule, a forms.py page.

Does anyone understand anything about this behaviour ?

Attached are the forms.py file and 2 screenshots where you see that the sidebar and footer language and the form language match or don't match depending on settings.py:LANGUAGE_CODE.

It might be a coincidence, but I have to comment out some lines (27-30 and 53-59) in that specific forms.py file for my migrations to work, else they fail with an unrecognized class error : django.db.utils.ProgrammingError: relation "core_programme" does not exist

Thanks !

LANGUAGE_CODE=en or none.png
LANGUAGE_CODE=fr.png
forms.py
Reply all
Reply to author
Forward
0 new messages