You can do this by ignoring based on a regular expression against the error message in your lint.xml
file:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="MissingTranslation">
<ignore regexp='^".*" is not translated in "ru" \(Russian\)$'/>
</issue>
</lint>
This will suppress the MissingTranslation error for Russian, but not for any other languages. Basing the ignore on the error message is a bit gross—everything might break if they change the wording—but it's the only solution currently working that I know of.
Note that while the regex is documented as matching against "the error message," it's actually only applied to a portion of the text printed to the screen. The regex anchors in the above example show the bounds.
Some reasonable approaches that did not work for me are:
- Adding
tools:ignore="MissingTranslation"
to a partially translated locale's <resources>
element.
- Adding
<ignore path="src/main/res/values-ru/strings.xml"/>
to the MissingTranslation issue block in lint.xml
.
If you happen to be the very particular situation of wanting to suppress MissingTranslation errors for a region-specific strings file that only partially overrides your defaults strings file (e.g., default file is English, and you want some overrides in values-en-rUS/strings.xml
), see this answer for a solution.