Error: "select_city_zzdw" is not translated in "zh" (Chinese) [MissingTranslation]

在用Android Studio生成带签名的apk时报的这个错误。

原因

If an application has more than one locale, then all the strings declared in one language should also be translated in all other languages.
Android Studio里要求每个string在每个语言环境里的xml资源文件里都要翻译。

解法

1、把所有字符串在每种语言下都翻译

这是推荐的做法。

2、对于不想翻译的字符串,添加translatable=”false”属性

<string name="app_name" translatable="false">sample</string>

3.Settings设置

File->Settings->Editor->Inspections右边列表里有Incomplete translation或者直接在File->Settings的搜索框里搜索MissingTranslation关键字,然后选中Incomplete translation不右边的Severity改为Warning或者更低级别。
这个方法我验证没通过,不过也写在这儿吧,看着很有道理的方法

补充

关于这部分的知识,可以参考下面的一段话。

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 attribute translatable=”false” on the element, or you can define all your non-translatable strings in a resource file called donottranslate.xml. Or, you can ignore the issue with a tools: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 variable ANDROID_LINT_COMPLETE_REGIONS.
You can tell lint (and other tools) which language is the default language in your res/values/ folder by specifying tools:locale=”languageCode” for the root element in your resource file. (The tools prefix refers to the namespace declaration http://schemas.android.com/tools.)

你可能感兴趣的:(apk,android,Studio,translated)