I have a template file templates/admin/base_site.html
which includes one trans
tag: {% trans "Event List" %}
.
settings.py
includes:
LANGUAGE_CODE = 'sv'
LOCALE_PATHS = (
'/srv/mysite/locale/',
)
The Django-admin pages are correctly translated into Swedish, apart from the text in the trans
tag.
When I run python manage.py makemessages -l sv
it correctly generates a locale/sv/LC_MESSAGES/django.po
file, whose last few lines are:
#: templates/admin/base_site.html:9
msgid "Event List"
msgstr "Event List"
I then change it to:
#: templates/admin/base_site.html:9
msgid "Event List"
msgstr "Händelselista"
When I run python manage.py runserver
again, the string is not translated on the web page.
The rest of the admin page is still translated into Swedish, as it was before.
What am I missing?
django.po
files are only meant for editing purpose. You must compile them to django.mo
files so that they are interpreted:
python manage.py compilemessages
See also Django docs.