S
S
Stanislav2017-07-12 13:49:03
Django
Stanislav, 2017-07-12 13:49:03

Django 1.11: How to include a translation file in JavaScriptCatalog?

File with translation from locale\ru\LC_MESSAGES to JavaScriptCatalog is not picked up.
settings.py

LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True

LANGUAGES = [
    ('ru', _('Russian')),
    ('en', _('English')),
]
LOCALE_PATHS = (
    os.path.join(BASE_DIR, 'locale'),
)

urls.py
urlpatterns += i18n_patterns(
url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
)

django-admin makemessages -l ru
Editing the translation in locale\ru\LC_MESSAGES\django.po
django-admin makemessages -d djangojs -l ru
django-admin compilemessages

The file locale\ru\LC_MESSAGES\django.po is created
And at 127.0.0.1:8000/ru/jsi18n there is only a basic translation that does not include the translation from locale\ru\LC_MESSAGES\django.po

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav, 2017-08-06
@Chebaa

Asked this question on stackoverflow, django forum - nobody knows. Filed it as a bug to the django developers, but was sent to tinker with the tests
There is a ​specific test for that in the Django test suite. It may be the test is missing something, but you should explore that yourself and explain it if it's the case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question