Opened 11 years ago
Closed 11 years ago
#558 closed enhancement (fixed)
Honour user's browser language preference
|Reported by:||spaetz||Owned by:|
A user accepting "klingon, de-de, de, it" will currently be served english web sites, as we try to serve the 1st choice and fall back to english if not available.
(WHY don't we have a klingon translation by the way???)
We need to fetch a list of available translations and match that up again the browsers accepted languages coming up with the best choice to use.
For this we can use 2 options: werkzeug.accepted_languages.best_match(['de', 'en']) which would be good, but probably is not sufficiently clever: initial test seems to show that preferred: "de-de, "en" available: "de", "en" would negotiate "en".
Alternatively there is "babel.negotiate" which seems to be cleverer and return "de" if preferred "de-de, en" and available "de, en".
Investigate and fix.
Change History (1)
comment:1 by , 11 years ago
|Status:||new → closed|
Fixed for now. (BTW, we never packaged translation files until today). There are still things to fix:
Like for example not caching a "JinjaEnv" per localization, but simply setting the translation in the JinjaEnv. (or at least we need to examine if this can be done in a thread safe manner). But for now this bug is fixed.