V
V
Vladimir Kuts2016-07-15 09:53:57
Django
Vladimir Kuts, 2016-07-15 09:53:57

Problem with Django locales?

Weird localization issue:
In settings.py:

LANGUAGE_CODE = 'ru-RU'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True

LANGUAGES = (
    ('ru', _('Russian')),
    ('en', _('English')),
)

LOCALE_PATHS = (
    BASE_DIR.child('locale'),
    os.path.join(BASE_DIR, 'app1', 'locale'),
    os.path.join(BASE_DIR, 'app2', 'locale'),
    os.path.join(BASE_DIR, 'app3', 'locale'),
    os.path.join(BASE_DIR, 'app4', 'locale'),
    os.path.join(BASE_DIR, 'app5', 'locale'),
)

The application folder structure is exactly the same. There are no problems with templates, migrations, imports and other things.
In the code of applications, models and other things, localization is done like:
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
...
verbose_name = _('Some name')
...

I execute :
./manage.py makemessages -l ru
and so - the folder structure appeared only in the root of the project.
Ok - I go through the folders and create the locale directories manually. I run
./manage.py makemessages -l ru again, locale
files appeared in two applications. In the rest - no.
The system where I perform these actions is windows
Who came across - tell me where to look so that these locale files are clearly created for all applications where they are involved.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question