Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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

Solution 2:

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

Solution 3:

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

Post a Comment for "How To Localize Android System String Resources?"