It's the ignore
attribute of the tools
namespace in your strings file, as follows:
<?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>
I don't know how to ignore all the file, but you can do it string by string using:
<string name="hello" translatable="false">hello</string>
Add to build.gradle
:
android {
lintOptions {
disable 'MissingTranslation'
}
}
There are 3 ways that I know of :
To apply the modification value by value : Set the attribute translatable="false"
on the <string>
definition:
<string name="account_setup_imap" translatable="false">IMAP</string>
If you have a lot of resources that should not be translated, you can place them in a file named donottranslate.xml
and lint will consider all of them non-translatable resources.
Another way I discovered while browsing Hackers Keyboard project sources:
You can add the prefix donottranslate-
to your resource file.
As in the previous example, lint will consider all of them non-translatable resources.
In your case, you can replace unlocalized-strings.xml
by donottranslate-strings.xml
.
It seems to work, but I haven't found any documentation for this tip.
See: Android Tools Project Site: Non-translatable Strings
And here is a Android Studio solution for disabling this fatal Lint error:
I think that what you need instead of disabling lint is to mark them with attribute
translatable="false"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With