Reputation: 9261
I read on Android Developers' Supporting Different Languages
that in order for your application to support multiple language, you have to make multiple values folder inside your "res" folder - "values", "values-es", "values-fr". Say in your original English "values" folder you also had colors.xml
, and dimens.xml
, would you need to copy those over into each language "values" folder?
The document only says
At runtime, the Android system uses the appropriate set of string resources based on the locale currently set for the user's device.
which I interpreted as "Android will use strings.xml from the right folder".
If you could, I think it would be good to reduce redundancy if you only have colors.xml
and dimens.xml
in one folder(all the others could share)
Upvotes: 0
Views: 168
Reputation: 1494
Android will first search for values in the folder of the current language, that means if language is french it will first search in values-fr
. If it doesn't find it there it will go to the default values
folder.
This does not only apply to colors.xml
and other files, it also applies to strings inside string.xml
. If a string is the same in english and in another language (if it's a name for example) just don't include the translated string and it will choose the default one.
Upvotes: 1
Reputation: 28856
You only need a separate file (strings.xml, colors.xml, dimen.xml etc.) if you want to override the default values (in the values folder). Usually colors and dimensions are language independent so there's no need to create those files in the language specific folders.
Upvotes: 1