[Internationalization] Django not falling back to base language

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Internationalization] Django not falling back to base language

Dibya Chakravorty
Hi everyone,

I set the LANGUAGE_SESSION_KEY key in the current user's session to "en_US" (also tried with "en-us"), and my LANGUAGES settings is as follows:

LANGUAGES = [
    ('de', _('German')),
    ('en', _('English')),
]


According to the docs, Django should fall back to the base language "en" in this case. However, it doesn't.

While hunting down the bug, I stumbled upon django.utils.translation.trans_real, where the function responsible for discovering the appropriate
language is defined. It's called get_language_from_request.

At first glance, it looks like this function falls back to the base language for all the other modes of language discovery (URL, Cookies, Accept-Language header etc.)
but not when it reads from the user's session.

If anyone has knowledge about this issue, I would like to know:

1. Is this intended behavior or is this a bug?
2. Or am I doing something totally stupid?

Thanks for your help,
Dibya

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/120ad219-a8c5-4e23-8760-499e30245e67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.