Lint: How to ignore “ is not translated in ” errors?

后端 未结 13 1821
长情又很酷
长情又很酷 2020-11-27 10:46

I can\'t compile/debug our Android app, because the localization files are not perfect yet.

My IDE\'s validation tool Lint create errors saying:

相关标签:
13条回答
  • 2020-11-27 10:59

    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

    0 讨论(0)
  • 2020-11-27 10:59

    Insert in the lint.xml file this:

    <?xml version="1.0" encoding="UTF-8"?>
    <lint>
        ...
    
        <issue
            id="MissingTranslation"
            severity="ignore" />
    </lint>
    

    For more details: Suppressing Lint Warnings.

    0 讨论(0)
  • 2020-11-27 10:59

    Add following to your gradle file in android section

        lintOptions {
           disable 'MissingTranslation'
        }
    
    0 讨论(0)
  • 2020-11-27 11:00

    Another approach is to indicate the languages you intend to support and filter out the rest using the 'resConfigs' option with Gradle.

    Check out this other answer for details

    This is better, I think, because you don't have to completely ignore legitimate translation mistakes for languages you actually want to support

    0 讨论(0)
  • 2020-11-27 11:02

    add the lines in your /res/values.xml file in resource root tab like this:

    <resources
    xmlns:tools="http://schemas.android.com/tools" 
        tools:locale="en" tools:ignore="MissingTranslation">
    

    tools:locale set the local language to English, no need of language translation later on that for all resource strings and tools:ignore let Lint to isnore the missing translations of the resource string values.

    0 讨论(0)
  • 2020-11-27 11:07

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

    lintOptions {
       disable 'MissingTranslation'
    }
    
    0 讨论(0)
提交回复
热议问题