On Wed 24 Sep 03:17, Lemonfiend wrote:

On Tue 02 Sep 13:46, Sönke Ludwig wrote:

On Tue, 02 Sep 2014 10:20:20 GMT, Sönke Ludwig wrote:

On Mon, 01 Sep 2014 22:35:52 +0200, Lemonfiend wrote:

As far as I can tell, localization via .po files is chosen based on
HTTP
headers.
Is it also possible to manually choose the language?
I would like to let the user choose their language, instead of forcing
ie. German on everyone in Germany, even through they're a foreigner, or
have different preferences.

Thanks :)

Currently there is no hook to override that, but I'll add that for
the next version. But the languages can also be configured in the
user's browser and are not dependent on the location. They are
usually chosen at installation time based on the system locale settings.

Done:
da90308

I finally got a chance to look into this a bit further.

Am I correct in that you have to choose between EITHER the
Accept-Language header, OR determineLanguage, but not both?

As in, when returning null from determineLanguage it defaults to the
TranslationContext's languages default (the first?), and disregards the
header completely? This means you HAVE to have a default language which
is the same for everyone, which is bad.

I'd like it to first check determineLanguage. If it return non-null, use
that. If it's null, use the regular headers method.
This would make the following common scenario possible.
User visits page: language == header
User chooses language/logs in: language == determineLanguage (via a
sessionvar).

Thanks!

While the example works fine, I had some trouble getting it to work in
my own project. I finally realized the difference: render vs renderCompat.
It works in render, but not in renderCompat!