Of course you do.
Definitions vary, but the basic idea is generally easily summarised:
- Internationalisation is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes.
- Localisation is the process of adapting internationalized software for a specific region or language by adding locale-specific components and translating text.
These two terms usually go hand-in-hand as the term 'globalisation'. See?
.. Course you do.
Each language is given a language code such as 'en-au' for Australian English, or 'en-us' for American English. These language codes are two-letter lowercase ISO language codes (such as "en") as defined by ISO 639-1.
But how do we use this? And how can we easily apply these concepts to our Android programming?
.. Good question!
Best practices in Android suggests defining all your string resources in a 'strings.xml' file (you're doing this already, right?) and placing that file in the 'res\values' folder in your project.
Localisation in Android is as simple as creating a new version of this file and folder, renaming the 'values' folder to 'values' + the language code you wish to support.
For example, all your Italian translations would be located in 'res\values-it\strings.xml', your Chinese translations in 'res\values-zh\strings.xml' as seen here:
If you don't happen to have a friend from whatever country you're trying to translate your app for, just use Google translate.
Once you're done your app is one simple step away from global domination.
All you need to do is copy those freshly translate strings back into a strings.xml file in Eclipse, and, as long as the folder the strings.xml file is located in has the name of 'values' + the language code you're wishing to support, magically any user who has their phone locale set to a locale that uses that language, your translated strings will be used.
No code changes are required.
Handy eh?
You wrote "i10n", but it should be "i18n".
ReplyDeleteHi Nicolas,
ReplyDelete.. You're absolutely right, thanks for that, I've now corrected it.
Thanks for this article. I always wanted to improve my application through translation. Now I believe your guidance will help me.
ReplyDelete> If you don't happen to have a friend from whatever country you're trying to translate your app for, just use Google translate.
Recently I've found great tool crowdin. Thay may be better way to get your app localized. In case if any one interested: http://crowdin.net/page/android-localization
Thanks Dies, excellent suggestion, I'll check it out.
ReplyDeleteGlenn, Very helpful quick guide to internationalization of an app - thanks! Do you know if it is easy to get the current locale. I have extensive documentation stored as HTML (displayed with a WebView widget) so I'd want to point to the correct HTML file at runtime.
ReplyDeleteHi Dave, is this what you're looking for? finding users language settings settings via code.
ReplyDeleteThat's it! Thank you again!
ReplyDeleteStop! Protest! Please, please, please: DO NEVER EVER translate your apps using Google Translate or another such automated translation! The results are horrible! Much better have only an english version than an unusable ugly german or other version which the user cannot change. Please! :)
ReplyDeleteHaha.. Yeh, I understand your point Bachi, but I disagree that it's much better to have just an English version.
DeleteI have had users of my apps offer to help correct the translations in my apps, and therefore improve them, and I give those users credit in my apps, which helps build a bit of community.
Exposure to non-english speaking markets is also very important.
Would you stop using a great app just because the translations aren't correct? I wouldn't.
Sure, it may not appear as professional as proper translations, but the exposure to new users I believe is worth it, especially as it is those users who can help improve your app.
In any respect, the main point of this article wasn't 'use Google translate'.
Have a good day,
Glenn :)
Pretty simple!
ReplyDeleteThanks man! :))
But how to localize database?
ReplyDeleteHi Maweceq,
DeleteI don't think you can really localize a database, but you can get the users language settings via code and then choose different database fields containing different translations based on that language.
Cheers,
Glenn