Alex
Alex

Reputation: 11

Android Strings

I wrote a big app with thousands of string in the code.... very bad idea, because now I want to translate each string.... big problem. Copying all strings to the strings.xml takes a long time.

Eclipse has an option to take all selected strings and put them into messages.properties.

Does this work similiar like strings.xml? When, why all people use strings.xml.

Or should is use eclipse to seperate each string and than I should copy them to string.xml?

Upvotes: 0

Views: 425

Answers (2)

Martyn
Martyn

Reputation: 16622

In Eclipse you can use the shortcut keys Alt + Shift A, S to extract an inline string in to the strings.xml file via a popup dialog - might be a bit easier than doing it by hand. And as the others say, yes you should ALWAYS use the strings.xml file so that you only have to look in one place when you want to change a string, instead of having to search through all your code.

Upvotes: 0

Whiler
Whiler

Reputation: 8086

All people are using strings.xml because this is the normal way to do it on Android. You don't have to manage the load of the strings, to call any locale function in your script.

You can see the documentation here : http://developer.android.com/guide/topics/resources/index.html

BTW, you can easily transform your eclipse generated file to an strings.xml file after the extraction.

Upvotes: 2

Related Questions