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?
如果您使用@android:string/
引用,系统会自动处理系统关键字的本地化(取消确定)。
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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.