Anton Egorov
Anton Egorov

Reputation: 1194

Djando CMS with USE_I18N = False

I have a Django-CMS project in a Russian language. I want to disable urls localization and language switcher. I can do it by settings USE_I18N = False. It works, but... Template translation became English, not Russian. My user has ru language and django settings looks like

LANGUAGE_CODE = 'ru'
LANGUAGES = (
    ('ru', gettext('ru')),
)

How to force my default language for toolbar and other templates?

Upvotes: 0

Views: 3410

Answers (2)

Anton Egorov
Anton Egorov

Reputation: 1194

It was my bad undestanding of how Django localization works

https://docs.djangoproject.com/en/1.6/topics/i18n/#definitions

The words “internationalization” and “localization” often cause confusion; here’s a simplified definition:

internationalization Preparing the software for localization. Usually done by developers. localization Writing the translations and local formats. Usually done by translators.

And warning about settings variable names

Translation and formatting are controlled by USE_I18N and USE_L10N settings respectively. However, both features involve internationalization and localization. The names of the settings are an unfortunate result of Django’s history.

So if you turn off i18n, you will have your web app not translated

https://docs.djangoproject.com/en/1.6/ref/settings/#std:setting-USE_I18N

If this is set to False, Django will make some optimizations so as not to load the translation machinery.

To disable localized urls, edit your urls.py to use django.conf.urls.patterns instead of django.conf.urls.i18n.i18n_patterns, Captain Obvious said.

Upvotes: 3

digi604
digi604

Reputation: 1090

remove the LanguageCookieMiddleware.

Upvotes: -1

Related Questions