Multilanguage support is easy done for android. Create a new values directory for the language with the suffix of the language code. For german: values-de or french: values-fr than copy your string. xml into that and translate each entry.
You can provide support for different locales by using the resources directory in your Android project. You can specify resources tailored to the culture of the people who use your app. You can provide any resource type that is appropriate for the language and culture of your users.
I have always used resource files for multi-language applications.
The are many articles on the web explaining how to use them.
I have used two different ways:
The resource file / form, is easier to implement, you only need to enter the values in the resource file, but I find this approach harder to maintain, since the labels are dispersed throughout the application.
The global resource file allows you to centralise all the labels (images etc.) in one file (per language), but it means manually setting the labels in the form load. This file can also be used for error messages etc.
A question of taste...
One last point, I write programs in English and French, I use "en" and "fr" and not "en-US" and "fr-FR". Do not complicate things, the different dilelects of English (American, English, Australian etc) have few enough differences to use only one (the same goes for French).
I recently wrote a program with both German and English language support. I was surprised to find out that if I simply named my english resources LanguageResources.resx and my German resources LanguageResources.de.resx, it automatically selected the correct language. The ResXFileCodeGenerator took care of it all for me.
Note that the fields in the two files were the same and any not yet entered German fields would show up in the application as English as the most non specific file language wise is the default file. When looking for a string it goes from most specific (ex .de-DE.resx) to least specific (ex. .resx).
To get at your strings use the ResourceManager.GetString or ResourceManager.GetObject calls. The application should give you the ResourceManager for free.
For the benefit of others who may come across this (1+ years after the last post), I'm the author of a professional localization product that makes the entire translation process extremely easy. It's a Visual Studio add-in that will extract all ".resx" strings from any arbitrary solution and load them into a single file that can be translated using a free standalone application (translators can download this from my site). The same add-in will then import the translated strings back into your solution. Extremely easy to use with many built-in safeguards, lots of bells and whistles, and online help (you won't need it much). See http://www.hexadigm.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With