You are a mobile developer with an app on the store, serving thousands of people in different languages. But localizing the app — back and forth with your in-house translators every time you release a build — is a pain. Here is how to fix that, with a relatively undocumented yet open source software called GlotPress.
Goal: Host an internal website where translators can login. Import strings from your iOS and Android builds. Export back the translated strings. Preview.
Setup
- GlotPress is written in PHP and uses MySQL. Setup the LAMP stack, create a database and in htdocs (or equivalent):
svn co http://svn.glotpress.org/trunk/ .
- Copy gp-config-sample.php located in the root directory to gp-config.php. Edit the file to enter in your database configuration in GPDB_* defines. Also go here and replace the *_KEY values.
- Run the installer by going to the domain pointing to your server. Login.
- Create a new project named Android. Expand Project Actions and click Import Originals. Upload the strings.xml file from your Android project.
- Go back to the project. You would not see anything yet because you have just added the originals yet, not Translation Sets (ie. other languages). Expand Project Actions, click New Translation Set and add a locale.
- If you have existing translations for the locale, scroll down and click Import Translations.
- Adding the iOS project: Follow the same procedure as in step 4, but this time select the Mass-create Translation Sets option to import the settings from the Android project. I will leave rest of the nifty automated processes that GlotPress offers for you to discover.
- Google Translation (nice to have): This shows a small “Translation from Google” link below the translation box. It can fetch an auto-generated translation from Google that the human translator can correct. However it requires a (paid) Google Translate API key. To enable it, you need to edit gp-config.php and add this:
define('GP_GOOGLE_TRANSLATE_KEY', '<API KEY>');
- Exporting: Go to the locale to export translations from, select Android XML and hit export.
- Adding translators: There is no user management GUI in GlotPress yet. More on this below. To add a translator, copy this script into scripts/add-new-user.php. Then run this command from the htdocs directory:
./scripts/add-new-user.php -u <username> -e <email> -p <password>
Further
- For Android developers: If you are new to localization, read Google’s documentation on managing strings. You can also set some strings to be not translated if you use strings.xml to also store API keys etc.
- Automated Import/Export from App’s Git Repository (because automated translation handling isn’t enough): I had developed a tool for LimeSurvey about 3 years ago that would run as a cron, automatically add new strings into GlotPress and commit new translations. To make it work with mobile apps would take some effort.
- Structuring Projects: Check out how WordPress (parent project of GlotPress) uses it.
- Handbook for translators: WordPress also has a small tutorial you can link your translators to.
- Why there is no user management: GlotPress has been in existence for 7 years, but it has received relatively less attention. I think it’s only WordPress.org that uses GlotPress extensively, and since one can replace GlotPress user tables with WordPress’, no work was probably done to add user management into GlotPress itself. It will probably be made into a WordPress plugin soon. Update: Until then, this seems to be worth a try.