StudyDroid Translation – A review of my experiences with Android’s i18n system
It’s interesting how much of the internet, and android applications, are in English. It seems to have become the default language of the internet. Of course it made sense when I was first releasing StudyDroid to make it in English. I speak English, the G1 had only been released in America, and the primary users were English-speaking Americans.
However, over the last couple of months I have seen a huge surge in users from France, Germany, Japan, China, and all over Europe and Asia, while the American user base (which still makes up the majority of users) has grown much more slowly. This is obviously due to the rapid growth in the past couple of months in android phones in foreign areas.
This did pose a unique problem that I hadn’t encountered before, how to translate my Android App. This was something I wasn’t really prepared for. I am still a student, and while my classes have prepared me well for many of the obstacles that I’ve had to overcome while developing StudyDroid, translation and internationalization are things that you don’t really learn about. So I did my homework on Android’s translation system. I’ve had a little experience using gettext and CSV files in ZEND’s translation object in PHP, but I found Android’s XML system interesting.
Android has adopted their Strings.xml system to work with internationalization. You can see the detailed documentation here but, basically, you need all of your strings to be in a translated strings.xml file in a properly named folder. This system at first seems to make sense, but I’m wondering if something similar to Zend’s $translator->_() system wouldn’t be easier for something as important as Internationalization.
Obviously if I has started out by using good programming practices and put all of my static strings into a strings.xml file, this would have made my life very easy, just pop the file to a translator, and cut and paste it into the right folder. But let’s be real here, of course I didn’t do this and just hard coded all my strings into the code itself because if was easier at the time. So I had to cut and paste all of my strings into a blank strings.xml file and name them individually. This complicated XML file then had to be forwarded to translators who cut the English out and put in their respective languages. Retrofitting my code would have been much simpler if all I had to do was wrap _() around the printable strings and then use a tool like poedit to scrape my code for translatable strings.
This system also poses problems for updates. When I add new buttons or text for the new features that I’m coding, I can’t just wrap my strings in a function and know that everything will be handled. I have to make a new string variable in the XML and then make sure that every single translated XML file has, at the very least, a reference to my string, lest my app display the dreaded, and highly uninformative “Force Close” window. An object with the translation object inside it, that would just display the English text if no translation was found would be much easier and more stable.
tl;dr : Android needs to seriously reconsider their i18n system, and if you’re making a new app, start out by having all of your printable strings in the strings.xml file. You’ll thank yourself later.
P.S. I’d like to thank all the translators again. Thank you guys for your work swimming around and trying to make sense of my strings.xml files.
Chinese (Traditional) – HiAPK.com
Chinese (Simplified) - HiAPK.com
Czech – Martin Janda
Italian - Luca F
Spanish - Pepe Rodriguez
Varun MC said,
look here: http://varunmc133.blogspot.com/2009/10/android-internationalization.html
Michael said,
You won’t get a FC if a language-specific XML file doesn’t contain a string, as long as the string exists in the language-neutral values/ directory.
That said, I agree that updates are problematic. I’ve written a tool to convert between Android’s XML files and gettext: http://github.com/miracle2k/android2po
Maybe you’ll find it useful.
Sebastian said,
Hi Dan,
thanks for this article. I’m currently facing the same problem. My apps have been prepared for translation just from the beginning, I’m doing the source strings in English and do the German translation by myself.
I today received an mail from hiapk.com about their offer of translating apps to CHT/CHS. By googling a bit I found this blog post and wanted to ask you about your experience with hiapk?
Any feedback would be great! Thanks in advance
Best regards,
Sebastian
Add A Comment