-
Notifications
You must be signed in to change notification settings - Fork 4
Translations
Translating FinSL-signbank to other languages is made pretty easy, follow these instructions to master the whole process.
Before you can begin translating Signbank to the languages of your choice, make sure that it is added in the settings files. In signbank/settings/base.py add your languages here:
# A list of all available languages.
# The list is a list of two-tuples in the format (language code, language name) - for example, ('ja', 'Japanese').
LANGUAGES = (
('fi', _('Finnish')),
('en', _('English')),
)
You can find all the possible language codes here: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
To be able to translate the whole app/site, you need to make two types of translations.
There are two types of pages in the app, static pages that do not change based on user input, and dynamic pages that change according to user input.
These static pages are pages that you can add and edit in Pages app. You can add these pages from Django adminpages where you can also determine if you want to link them in the site menu. Editing them for different languages is easy enough, you simply write the same page for different languages via the adminpages or by pressing the edit button in Signbank (it should show up if you have the rights to edit the page).
All the different languages will have their own django_summernote editor like this:
Once you have added languages into simply run (in your python virtual environment) https://docs.djangoproject.com/en/1.8/ref/django-admin/#makemessages:
$ python bin/develop.py makemessages
This command creates a new updated django.po files for the locales you chose (or for all of them) in locale//LC_MESSAGES/django.po
To make translations, open the django.po file and for each msgid "texthere" there is a msgstr "" where you should place the translation of the text inside the quotes of msgid.
Once you have made the translations, make sure you put the new file on the server (overwrite the old one).
To activate the translations in the application, you have to run the following command which compiles the translation file https://docs.djangoproject.com/en/1.8/ref/django-admin/#compilemessages:
$ python bin/develop.py compilemessages
To be able to use the translations on the site that is currently running, you have to use the following command in the shell:
$ touch signbank/wsgi.py
Or you can use the reload_signbank feature in Signbank. Another way is to simply restart the webserver.