Monday, July 16, 2012

Localize Android app

You have created this great android app.

Then you discover that the world is actually flat and your app will be downloaded by dudes all over the planet, and they want your app in their own language.

How can you localize your app?

  1. Be sure that all of the text in the app is using strings.xml, please note that the actual java files as well as the layout xml files should refer to the strings.xml file.
  2. Create a directory for each language you want your app to be localized to, so if you want your app to be localized to 11 languages you will need to create 11 additional directories; These directories should be located in the "res" directory and should be named values-XX where XX is a 2 letter country code, which you can find here:  http://www.loc.gov/standards/iso639-2/php/code_list.php
  3. Copy your strings.xml file into each one of those directories
  4. Translate each one of those strings.xml files to their relevant languages (I managed to have those files translated in one go using google's service:  http://translate.google.com/ by clicking on "translate a document", but if you want a much more accurate translation, let a pro work on it.
  5. Clean the results (did the automatic translation add unneeded spaces? did it ruin some of your xml values?

That's it - Mission accomplished.



Now, I suppose many of my readers ask themselves, isn't there any automatic way of doing it?
Didn't anyone build an app which connects google translate's api and does all of it automatically?


Where there were several utilities built for this exact purpose, but then google closed their gates, and started charging money for their translation services!

All of the working apps doing these services don't work any more.


Things one need to note when creating translations - The translation is good till you add your first additional language strings into strings.xml, this string won't be present in all of your other language files and so it will be shown in your main language (English) even for those localized to any other language.


There ARE several services online which have your app updated all of the time and keep track of your strings.xml, but it costs money...


I suppose building a nice app (maybe an eclipse plugin [which will replace the current eclipse plugin which doesn't work anymore]) which will read your "res" directory and present you with a table having each column for a different language and each row will present a different word.

This app will have an api to access external translations apis like google translate (in which case it will cost you of course) or bing translate etc, in which case you will be able to insert your username & password for those services.


Till I have time to build something like this, feel free to check out the following interesting projects:



Avi.

No comments: