Hi all is there a way for me to translate my application to a different language and not to pay for others to translate it for me? I have seen in google play there is an option suggesting that I should upload my strings.xml file and they will translate it for me.
Asked
Active
Viewed 1,349 times
2
-
http://developer.android.com/guide/topics/resources/localization.html – aga May 19 '14 at 11:55
1 Answers
5
You can put your string values in res/values-XX where XX is the language code, but you have to translate by yourself. Here's a list of languages code : http://www.loc.gov/standards/iso639-2/php/code_list.php Pick up one from "ISO 639-1 Code" column.
If you want to "upload" your string.xml on Google Play developer Console, you'll have to pay for it.

Rogue
- 751
- 1
- 17
- 36
-
So just to make sure I understood correctly I create a new string.xml file with the name string-XX.xml in the same folder where the original string.xml is? Also how do I call it? how will my app know which string XML to load? – user3182266 May 19 '14 at 11:52
-
No, let's take an example. You want to translate in french. You put a string.xml file in res/values-fr/string.xml with the exact same content than in your res/values/string.xml, but you translate theses in french. In your layouts file, use @string/stringResourceName. In your java code use Context.getResources().getString(R.string.stringResourceName); – Rogue May 19 '14 at 11:53
-
Ok i think I understood that thank you. But how can I set a condition for the translation. I mean can it be for example: if you are in China and you download the app the language displayed in the app is Chinese and not English? Because with the method getString()....etc I just call for the string. – user3182266 May 19 '14 at 12:01
-
It should automatically use the language the user of your app has set as its system language. If it's available, that is. And you set the name of your map correctly. – SvenT23 May 19 '14 at 12:02
-
In fact, you don't have to deal with that. When you ask for a string value with getString() or with @string, android choose the language to pick. In you example, Android will detect : user is Chinese (the system language is, at least), so i'll give you values from res/values-cn/string.xml. So you don't have to precise which string you want. – Rogue May 19 '14 at 12:04
-
Also, if the user language is not present in your values, android will pick values from res/values/string.xml, which is the default language. – Rogue May 19 '14 at 12:04
-
LOL epic nice ... so I dont have to pay anything to Google if I translate it on my own? – user3182266 May 19 '14 at 12:05
-
If you speak the language, no, you don't. Bu I assume you're not a perfect speaker for every language in the world... So you might have to, depending on the situation :) – Rogue May 19 '14 at 12:06
-
I just want it to be translated to only 1 language... my native language so I think I can handle that :D Thanks again for your help mate appreciate it!!! (bow) – user3182266 May 19 '14 at 12:08
-