今天在打包apk時出現了"xxx" is not translated in "zh" (Chinese) [MissingTranslation]的錯誤。android
解決方法:app
看它的描述能夠直接解決問題:ide
Incomplete translation
If an application has more than one locale, then all the strings declared in one language should also be translated in all other languages.
If the string should not be translated, you can add the attributetranslatable="false"
on the <string>
element, or you can define alui
l your non-translatable strings in a resource file called donottranslate.xml
. Or, you can ignore the issue with atools:ignore="MissingTranslation"
attribute.
By default this detector allows regions of a language to just provide a subset of the strings and fall back to the standard language strings. You can require all regions to provide a full translation by setting the environment variableANDROID_LINT_COMPLETE_REGIONS
.
You can tell lint (and other tools) which language is the default language in yourres/values/
folder by specifying tools:locale="languageCode"
for the root<resources>
element in your resource file. (The tools
prefix refers to the namespace declarationhttp://schemas.Android.com/tools
.)this
若是一個字符串不須要翻譯,能夠添加屬性translatable="false"
在<string>標籤裏。如:spa
<string name="name" translatable="false">Android</string> 或者把你不須要翻譯的字符串統一放到一箇中去。或者給根標籤加一個屬性來忽略這個問題。如:donottranslate.xmltools:ignore="MissingTranslation"
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
參考:http://blog.csdn.net/gentlemanyc/article/details/50578466.net