Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lint: How to ignore "<key> is not translated in <language>" errors?

Android Studio:

  • "File" > "Settings" and type "MissingTranslation" into the search box

Eclipse:

  • Windows/Linux: In "Window" > "Preferences" > "Android" > "Lint Error Checking"
  • Mac: "Eclipse" > "Preferences" > "Android" > "Lint Error Checking"

Find the MissingTranslation line, and set it to Warning as seen below:

Missing translations, is not translated in


You can set the attribute translatable="false" on the definition like this:

<string name="account_setup_imap" translatable="false">IMAP</string>

For more information: http://tools.android.com/recent/non-translatablestrings


To ignore this in a gradle build add this to the android section of your build file:

lintOptions {
   disable 'MissingTranslation'
}

This will cause Lint to ignore the missing translation error for ALL strings in the file, yet other string resource files can be verified if needed.

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

If you want to turn off the warnings about the specific strings, you can use the following:

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>    

    <!--suppress MissingTranslation -->
    <string name="some_string">ignore my translation</string>
    ...

</resources>

If you want to warn on specific strings instead of an error, you will need to build a custom Lint rule to adjust the severity status for a specific thing.

http://tools.android.com/tips/lint-custom-rules