Thursday, August 7, 2014
PirateBox for Android - I18N
This post will show how to add your own translations in a few easy steps ...
The language files are stored inside the piratebox/html/i18n* folder. The file names have the following format: i18n_ISO.properties
The ISO part specified the ISO 639-1 code which defines the language. Here is a list of available ISO language codes: Language Codes according to ISO 639-1
To add your own translation copy the English translation i18n_en.properties file and rename it to your desired language. To take French as an example, the file would be named i18n_fr.properties.
It is important to note that the file encoding has to be ISO-8859-1, otherwise you might have issues displaying the characters correctly inside the web interface.
Now you can start editing the file. The file contains key value pairs separated by an equals (=) sign. All you have to do is to translate the right hand side of the euqation.
Here is an example, the original in English on the left and the French translation on the right:
If all lines have been translated, copy the new file to the piratebox/html/i18n folder and you are almost done.
To select the new language simply go to the preferences of the PirateBox app and select Web Interface Language. If everything worked well the language should be available for selection.
After a restart of the server the web interface should show the new translation.
Besides English the web interface is already translation into German. If you have made your own translation, you can send it to me** and I'll include it in the next release***.
Have fun and I hope everything is working as it should ...
* Base directory: /data/data/de.fun2code.android.piratebox/files/
** Mail: jochen[at]fun2code.de
*** If there are multiple for the same language, I'll pick one...