Search code examples
pythondjangointernationalizationtranslation

Django: Can't change default language


I have been developing for some time in en-gb language code. Now arriving closer to the release date I was going to switch the default language to en-us, but whatever I do the initial request.LANGUAGE_CODE is set to en-gb even for unregistered users.

FYI, I would actually like to keep the time_zone to London and simply change the default language to American English. For now I have changed both just to get it working, but 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 could I be missing? Thanks


Solution

  • LANGUAGE_CODE is only the default when Django can't find what language to use. You probably already have en-gb in your session or a cookie which Django picks up on.

    Have a read through How Django discovers language preference for more information on the steps Django takes to determine a request's language.