I have a Django project and would like to use i18n to have support of diferent languages.
In my template I write:
{% load i18n l10n %}
<span>{% trans 'Sun' %}</span>
then I create required directories inside my BASE_DIR:
./locale/LC_MESSAGES/ar
./locale/LC_MESSAGES/ru
My settings:
LANGUAGE_CODE = 'en-us'
LANGUAGES = (
('en', _('English')),
('ar', _('Arabic')),
('ru', _('Russian')),
)
LOCALE_PATHS = (
join(BASE_DIR, 'locale'),
)
Then I run python manage.py makemessages -a, the .po files are getting created. So far, so good..
Examining the .po files I see the folowing (among tons of other lines):
#: myproject/web/templates/reports/mycalendar.html:24
#: venv/lib/python3.5/site-packages/django/utils/dates.py:11
msgid "Sun"
msgstr ""
Hey, do they want me to translate all messages from Django myself??
Lets open a file venv/lib/python3.5/site-packages/django/conf/locale/ar/LC_MESSAGES/django.po:
msgid "Sun"
msgstr "أحد"
So, the translation already exists for this word!
Running python manage.py compilemessages - this has no effect for this word, it became English.
I've tried to include native django's locale path LOCALE_PATHS:
from django.conf import locale as django_locale
DJANGO_LOCALE_PATH = abspath(dirname(django_locale.__file__))
LOCALE_PATHS = (
DJANGO_LOCALE_PATH,
join(BASE_DIR, 'locale'),
)
No way. Still the line presents in my .po file and still msgstr is empty. I tried to delete these lines from my .po file, but after makemessages they appear again.
Now the question is: Why the native .po file is ignored and how to make it used?
Django==1.8.12