I've been working away at getting i18n working and having multi lingual versions of my website.
I have a few people kindly doing translations for me, but since I've come into a few problems, scouring the web it seems like a few people have a hard time starting with django's internationalisation and localisation modules.
The main issues that I've come across thus far are:
- django.po files do not update when running django-admin.py makemessages -a
- When the language files are there when the language is changed there are no changes on the website other than what is pre-built with the django package.†
- The i18n/setlang view doesn't work.††
Now, it's only point 1 that I have unresolved. Firstly what's going on that's making makemessages not update? I'm using -a to update all the files I've previously made (de, da, fi) and fi is the only language file that's actually got translations added (the rest are just empty translation strings currently)
†I've now resolved number 2. It seems that when makemessages creates the .po file it does so with a fuzzy tag.
#, fuzzy
According to some research I've done this treats the file as if it's needing to be updated as like the no-op option that comes with the trans tag.
{% trans "translation string" noop %}
Upon removing the #, fuzzy line it has solved this issue.
††I've added number 3 in, just for reference as I've solved that myself.
You need to ensure LocaleMiddleware is present in your MIDDLEWARE_CLASSES
MIDDLEWARE_CLASSES = (
'django.middleware.locale.LocaleMiddleware',
)