The latest PirateBox for Android version 0.5.2 adds i18n support to the web interface. It is now possible to change the language of the web interface independent of the phone's langue settings.
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:
button.thanks=Thanks button.thanks=Merci
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...
Great work. I'd found Piratebox via the Biblebox and Librarybox forks and was waiting for someone to build an Android version. Two useful additions for some users would be to easily adjust the welcome message, and to be able to disable the upload function so that the box can be used to distribute files without the risk of others being uploaded. In the context I'm using it I want to be careful not to encourage sharing of copyrighted material.
ReplyDeleteI'd also be interested to know what level of functionaility is possible in an unrooted phone?
Is it possible to have a user-selectable language setting from within the web interface? That is, serve up the same content in English and another language as well?
ReplyDelete