简体   繁体   中英

Android translation lint check - how to disable when only two out of 3 translations is required?

I have an app that usually translates into 3 different languages. Thai, indonesia and english (default). but on occasion i have a feature that is only applicable to thailand and english and indonesia does not need translations so i have left indonesia local string file empty.

Lets take a look at an example using android studios strings translations editor:

在此处输入图片说明

as you can see these a1,a2,a3,a4 are only required in thailand and english (default). so i left indonesia empty. Now lint gives off warnings that i am missing translations for indonesia. Is there any flag i can use to stop the lint check or is the best practice to still copy the string into indonesia even though its not used ?

There's no way to specify what you want exactly since your use case is I guess not widely used and it didn't make it into lint.

You can however use the tools:ignore="MissingTranslation"

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
  <string name="foo" tools:ignore="MissingTranslation">1</string>
</resources>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM