I have a site using Django 1.10 with German and English as available 
languages, where German is the source language. Dynamic content is 
translated with django-modeltranslation and for static strings I am using 
Django's built-in `trans` template tag.

I want Django to return the page in the visitor's preferred language. I 
have read how Django discovers language preference 
<https://docs.djangoproject.com/en/dev/topics/i18n/translation/#how-django-discovers-language-preference>
 
several times, and I think I have everything right. As I change my language 
settings in my browser, the value of the `LANGUAGE_CODE` variable when 
displayed in a template always changes accordingly, and also the dynamic 
content is always returned in the expected language by 
django-modeltranslation. The locale middleware is of course in place, and 
so are the *.po and *.mo files as well. The browser request headers also 
look fine. But *it's only the `trans` template tag that is not picking my 
browser's language preference*. Instead, *it seems to directly resort to 
the initial value of the `LANGUAGE_CODE` variable as it is originally set 
in the settings file, without going through the algorithm described in the 
link above*.

Is this known? Certainly not what I expected, and it took me a lot of 
effort to narrow down the issue.

Thanks in advance for your help,

Joan

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/40954b21-3fb9-4596-8f19-7261ed3e8172%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to