views:

42

answers:

1

Choosing language I see http://github.com/ and OpenBSD.org got 2 examples how to. Github has a dropdown and openbsd.org just links. Which kind of UI for this use case could you recommend? I now take the parameter hl=el for instance for greek which switches i18n internals to greek or other language and present available languages like this

{% get_current_language as LANGUAGE_CODE %}&nbsp;<b>{{ LANGUAGE_CODE }}</b>{% get_available_languages as LANGUAGES %}{% for LANGUAGE in LANGUAGES %}{% ifnotequal LANGUAGE_CODE LANGUAGE.0 %}&nbsp;<a href='?hl={{ LANGUAGE.0 }}'>{{ LANGUAGE.0 }}</a>{% endifnotequal %}{% endfor %}

It's possible to think other parameter handling than for instance http get hl=el for a greek ui and there is no obvious standard. Most sites seem to use a dropdown where a combined dropdown with most common languages directly by links also look feasible option. I hope you can comment or recommend these alternatives.

+1  A: 

The default l10n middleware looks for a session variable or cookie with the name django_language.

Ignacio Vazquez-Abrams
By default I set this variable to http accept language header. Do you agree that's a good idea? It's possible to imagine a Greek user using a computer in London that has english http accept header needing a user defined variable to know to display in greek. I now do it with get parameter hl=el also conceivable as locale=el
LarsOn
If you only look at that header then you don't need to set the variable; like the documentation says, it looks at that first.
Ignacio Vazquez-Abrams
Thanks for the info. So I understand that django will make the choice by default when i18n is loaded in the templates.
LarsOn