Delgermurun
Delgermurun

Reputation: 658

Django 1.3 LANGUAGE_CODE doesn't correctly

At first sorry for my English :).

LANGUAGE_CODE setting doesn't work correctly.

When I configured LANGUAGE_CODE="mn", but default language code is "en".

from django.utils.translation import get_language print get_language()

>>> en

then I tried to configure LANGUAGES setting

LANGUAGES = ( ("mn": "Mongolia"), ("en": "English"), )

but still "en"

changed LANGUAGES setting

LANGUAGES = ( ("mn": "Mongolia"), ("en-us": "English"), )

now it is "mn"

but want above settings

LANGUAGE_CODE = "mn" LANGUAGES = ( ("mn": "Mongolia"), ("en": "English"), )

It doesn't work correctly. Is it BUG ? or something else?

I also tried creating "mn", "en" locale.

Hope help me. Thanks.

Upvotes: 1

Views: 2137

Answers (2)

Matt Hanger
Matt Hanger

Reputation: 61

If you haven't already, be sure to read this specific topic in the Django documentation:

How Django discovers language preference https://docs.djangoproject.com/en/1.3/topics/i18n/deployment/#how-django-discovers-language-preference

We're not using Django 1.3 yet, but we are using Django with multiple languages.

The first item to check is to verify the Accept-Language HTTP header being sent by your browser. Use Fiddler or Charles Proxy or similar tool to verify. Sounds like your browser may be sending "en-us" as a language preference.

Upvotes: 2

brianz
brianz

Reputation: 7448

In your settings file, make sure USE_L10N and USE_I18N are set to True.

https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n

Upvotes: 1

Related Questions