Fallback to "en_US" if browser does not send preferred languages
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Tue, 4 Dec 2012 08:44:07 +0000 (09:44 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Tue, 4 Dec 2012 08:44:07 +0000 (09:44 +0100)
commitc39b9afc83d5e0bfd9312d762a7b16955ba949ca
tree167cb865c794381e115305dc18270d8662b5c507
parent78d932e7928a39311309e4e89a47fb3d992feac7
Fallback to "en_US" if browser does not send preferred languages

E.g. in our test suite we don't send an "accepted languages" header, which
caused the language matching to fail. So we need to explicitely fallback to
en_US, in case request.accepted_languages is None. This fixes the tests and
all cases where user browsers don't send preferred languages.

This also fixes issue #562, the AVAILABLE_LOCALES are already case-normalized
and we don't need to fudge the preferred language through the lower_upper_locale
thing for each and every request.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
mediagoblin/tools/translate.py