Question

What is the best way to combine user-agent language and django i18n? Example: I've set LANGUAGES in my settings.py:

LANGUAGES = (
    ('en', ('English')),
    ('pt-br', ('Brazilian Portuguese')),
)

If the client user-agent is configured to Portuguese as default, The Django i18n machinery will use Brazilian Portuguese as default language for my website, otherwise it will remain in English

Is it better to use the language based on user-agent default or based on client IP location?

Was it helpful?

Solution

I would go for user agent because the user is able to set his preferred language in his browser. IP location says nothing about the language the user actually speaks nor does the user have any influence on it. In both cases you can still provide a language selector on your page as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top