I have a res/values
folder containing a strings.xml
file and a res/values-XX
folder containing a strings.xml
file (for each of the languages XX
I support). At the moment, all my strings.xml
files contain the same strings (same string names, different string values). Is there a way I can add a string to the res/values/strings.xml
file without having to add it to all my res/values-XX/strings.xml
files, and such that the app will pick up on this default string regardless of the phone's language setting? At the moment the compiler aborts and complains that the string has not been translated for each of my supported languages.
How to add a string to the default values folder only?
3.9k Views Asked by Adil Hussain AtThere are 3 best solutions below

res
folder contains the data which is only readable. For more information please refer the Android Developers Document for Providing Resources and Accessing Resources.

Lint errors and warning will prevent the compiler from compiling, but you can always clear them and compile anyway. You can also instruct Lint to ignore all missing translations.
You can use the Lint Warnings view to instruct Lint to ignore certain errors or warnings within certain scopes (specific strings, files or entire project). All of these instructions will be automatically placed in lint.xml
in your project.
Android recommends placing non-translatable strings in a donottranslate.xml
file. Lint will always ignore that there are no translations for it.
You can also make another XML file with any other name, and simply add an instruction for Lint to ignore that the strings in this file don't have translations.
Remember that you are not limited to one strings.xml
file. It's just standard beginner practice, but if you have a lot of strings, you can organize them into multiple XML files.
The "compiler" will not "abort" because you have an untranslated string. You may get lint errors, but
ant clean debug
,ant clean release
, and their Eclipse equivalents work fine. Make sure you are on the current edition of the SDK tools (and the ADT plugin if you are using Eclipse).To get rid of the lint errors, have your
<resources>
element where the untranslated string appears look like this: