Android 导出签名应用程序包错误

10

当我尝试为谷歌地图导出已签名的应用程序包时,我在我的res/value/string.xml文件上遇到了这个错误。我该怎么办?

app_name" is not translated in af, am, ar, be, bg, ca, cs, da, de, el, en-rGB, es, es-rUS, et, fa, fi, fr, hi, hr, hu, in, it, iw, ja, ko, lt, lv, ms, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rTW, zu
Issue: Checks for incomplete translations where not all strings are translated
Id: MissingTranslation
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 <string> 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 <resources> element in your resource file. (The tools prefix refers to the namespace declaration http://schemas.android.com/tools.)

你是否创建了以value-afvalue-am等形式命名的文件夹? - Tushar
5个回答

39
"窗口" > "首选项" > "Android" > "Lint错误检查" 中: 跳转到MissingTranslation行,将其设置为警告:

图片描述


这对我没有效果。我仍然收到错误信息。 - Ali Ashraf

11

试一下这个方法

打开Eclipse -> 窗口选项卡 -> 首选项 -> Android -> 检查Lint错误 -> 取消勾选完整错误检查运行

这可能会有帮助


6
在string.xml文件中,只需向字符串添加translatable="false",就像这样。
<string name="app_name" translatable="false">Example App</string>

2
虽然其他答案都是正确的,但另一个选项是在XML文件中添加 tools:ignore="MissingTranslation" 属性:
<?xml version="1.0" encoding="utf-8"?>
<resources
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="MissingTranslation" >

    <!-- your strings here; no need now for the translatable attribute -->
</resources>

我更喜欢这种方法,因为a)它不需要更改每个字符串值,b)它不是应用程序设置,因此可以提交到git。另一方面,如果错误出现在你没有写访问权限的引用项目中,这种方法就无法帮助你。


0
只需将string.xml文件重命名为donottranslate.xml。这样或许能帮到您。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接