I determine the preference of the user language through the third service, which he also registered. This service provides me with the locale code (e.g. en_US ). If I don't have the appropriate language code in settings.LANGUAGES , Django provides some integrated (easy) way to determine the best choice from settings.LANGUAGES (e.g. en-gb ).
Of course, I know that I could do a couple of lines of comparing the language code, etc., just be curious if there is a more efficient solution!
python django internationalization locale
Bernhard vallant
source share