In order to play with translations, you need to have gettext
installed on your pc.
gettext is generally easy to install on any linux OS.
For Debian-like distos:
apt-get update && apt-get install gettext
You can follow those instructions to install gettext on OSX.
For windows, it a bit more complicated.
Everything is detailed in this thread.
In general, you need to:
- Download this file and this file.
- Extract the content of the zip somewhere in your computer (you will need to add these paths to your PATH env variable)
- Add the extract
/bin
paths to thePATH
environment variable. - Restart your terminal and you should be able to call
gettext
.
For this project, most of the translations can be done through the interface. Although, there are some translations that need to be done on the server side.
The website translations are stored into website/locale/<language>
.
To translate a new language, you must run the following command inside the website
folder:
django-admin makemessages -l en
It will generate a django.po
file inside /website/locale/en/LC_MESSAGES
directory.
You can edit manually those files to translate them.
Once you're done translating the files, you must compile them!
To do so, run the following command inside the website
folder:
django-admin compilemessages
The django.po
files should be compiled into django.mo
files. At this point, translations should be loaded
into your website!