Table of Contents
Translating Sahana
This document shows how to add a new, currently unsupported language to Sahana.
If instead, you wish to activate an already-supported language, please see the Localization doc.
Introduction
Sahana uses GNU Gettext for Localization/Internationalization of the Sahana interface.
The gettext tutorial has a section for translators, you can take a look at it and get an idea on how gettext translation works.
Basic Steps
For translating Sahana the basic steps would be,
- Download the latest message template (for a new translation).
- Open the Sahana.pot file using a text editor that supports UTF-8
- Insert the translated strings.
- Save the file and commit it (or email the file to sudheera@opensource.lk).
Downloading the sahana.pot file
If you have Sahana Launchpad access you can checkout Sahana; or if you don't have Launchpad access follow these installation instructions.
You can find the sahana.pot file inside the '<sahana root>/res/locale/' directory (<sahana root>/res/locale/sahana.pot).
Doing the translation
After downloading the file open it using your favorite (UTF enabled) text editor (e.g: gedit). Make sure you select UTF-8 when you edit and save the sahana.po file. When you open the file you will see a list of strings from the Sahana interface.
e.g: #: ../inc/lib_security/acl_action_form.inc:50 #: ../inc/lib_security/acl_action_form.inc:145 msgid "Description:" msgstr ""
When translating you have to enter the translated word for the 'msgid' (that's “Description:” in the example) between “” of the 'msgstr'.
msgid "Description:" msgstr "<the translation of 'Description:'>"
e.g: #: ../inc/lib_security/acl_action_form.inc:50 #: ../inc/lib_security/acl_action_form.inc:145 msgid "Description:" msgstr "විස්තර:"
please do not alter the 'msgid' string.
Uploading the translated file
After doing the translation, if you have Launchpad commit rights, create the directory structure with the correct language code and the country code in side the <sahana root>/res/locale/ directory.
e.g.: si_LK/LC_MESSAGES/ si - language code LK - country code
save the translated file in side of the new 'LC_MESSAGES/' directory as sahana.po
e.g.: si_LK/LC_MESSAGES/sahana.po
then add the file to the Launchpad repository. Then commit the file. After this you can use the 'sahana.po' file in the specific locale directory (e.g. 'si_LK/LC_MESSAGES/sahana.po') for updating the translation.
- If you don't have Launchpad access save the file as sahana_<language code>_<country code>.po (e.g. sahana_si_LK.po) and upload it to the BugTracker