Gia*_*nzi 117 android android-resources android-lint
是否可以指定value-*
目录中文件中的字符串故意不转换为其他语言?我有一堆字符串,这些字符串对所有语言都很常见,不需要翻译,所以我unlocalized-strings.xml
在values
目录中创建了一个文件.运行Android Lint来检查问题,它一直说有些翻译丢失了......我不想要要对整个项目禁用此检查,我只想在某些XML文件中禁用它..是否可能?
"title_widget_updater_service" is not translated in de, en, en-rUS, it
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.
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.
Run Code Online (Sandbox Code Playgroud)
如何定义这个区域的未本地化的字符串?
Adi*_*ain 224
它是字符串文件中命名空间的ignore
属性tools
,如下所示:
<?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>
Run Code Online (Sandbox Code Playgroud)
Lui*_*uis 158
我不知道如何忽略所有文件,但你可以使用以下方法逐字符串地执行:
<string name="hello" translatable="false">hello</string>
Run Code Online (Sandbox Code Playgroud)
祝好运
Gir*_*ion 154
添加到build.gradle
:
android {
lintOptions {
disable 'MissingTranslation'
}
}
Run Code Online (Sandbox Code Playgroud)
Cyr*_*oux 23
我知道有三种方法:
要按值应用修改值:translatable="false"
在<string>
定义上设置属性:
<string name="account_setup_imap" translatable="false">IMAP</string>
Run Code Online (Sandbox Code Playgroud)
如果您有大量不应翻译的资源,可以将它们放在一个名为donottranslate.xml
lint 的文件中,lint会将所有这些资源都视为不可翻译的资源.
我在浏览Hackers Keyboard项目源时发现的另一种方法:
您可以将前缀添加donottranslate-
到资源文件中.与前面的示例一样,lint将考虑所有这些不可翻译的资源.
在您的情况下,您可以替换unlocalized-strings.xml
为donottranslate-strings.xml
.它似乎工作,但我没有找到任何有关此提示的文档.
Dzh*_*eyt 12
这是一个Android Studio解决方案,用于禁用此致命的Lint错误:
归档时间: |
|
查看次数: |
62448 次 |
最近记录: |