Django: unable to change default language

I have been developing en-gb language code for some time. Now, approaching the release date, I was going to switch the default language to en-us , but no matter what I do, the original request.LANGUAGE_CODE set to en-gb even for unregistered users.

FYI, I would really like to leave time_zone in London and just change the default language to American English. At the moment, I changed both to make it work, but there is still no joy.

 #TIME_ZONE = 'Europe/London' TIME_ZONE = 'US/Eastern' LANGUAGE_CODE = 'en-us' #LANGUAGE_CODE = 'en-gb' ugettext = lambda s: s LANGUAGES = ( ('en', ugettext('American English')), ('en-gb', ugettext('British English')) ) USE_I18N = True USE_L10N = True USE_TZ = True 

What can i skip? Thanks

+4
source share
2 answers

LANGUAGE_CODE is only the default when Django cannot find which language to use. You probably already have en-gb in your session or the cookie that Django is typing.

Read How Django Detects Language Preferences for more information on the steps that Django takes to determine the query language.

+4
source

See how Django detects language preferences .

In your case, I'm sure you have LocaleMiddleware turned LocaleMiddleware , and it gets your language from the Accept-Language header, which your browser sends with every request. You can change this title in your browser settings, although many users are not aware of this and do not stop at what was default on their system. In Firefox, for example, you can change this in the settings, content, select (under the languages).

0
source

All Articles