arun8
arun8

Reputation: 1211

How to localize android system string resources?

If I define my string resource in my strings.xml, I can localize my app by defining language specific strings.xml. But, When I use(for instance) the android system resource string "@android:string/no" for the word "Cancel",
how can I localize "Cancel" for different languages?

Upvotes: 5

Views: 5338

Answers (3)

Shobhit Puri
Shobhit Puri

Reputation: 26007

If you want you can declare a no string in string.xml and refer strings as @string/no. If you see http://developer.android.com/training/basics/supporting-devices/languages.html ,then you can define string.xml in different folders. Eg: values-fr for french and so on. So you can define the strings in different languages in these string.xml files and put them in appropriate folder. Android will pick up the work from relevant string.xml.

YourProject/
    res/
       values/
           strings.xml
       values-es/
           strings.xml
       values-fr/
           strings.xml

Upvotes: 3

DevWithZachary
DevWithZachary

Reputation: 3675

Created a strings.xml file for each language. Place them in that languages values folder see http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources

And then within your strings.xml files make sure they all have a string with the name no

Upvotes: 1

x90
x90

Reputation: 2170

Android handle localization of system keywords(cancel ok no) automatically if you refer to them using @android:string/.

Upvotes: 3

Related Questions