Avoid Android Lint complains about not-translated string

后端 未结 11 1617
轻奢々
轻奢々 2020-12-02 13:06

is it possible to specify that the strings in a file within the value-* directories are purposely not translated into other languages? I have a bunch of strings

相关标签:
11条回答
  • 2020-12-02 13:22

    And here is a Android Studio solution for disabling this fatal Lint error:

    enter image description here

    0 讨论(0)
  • 2020-12-02 13:22

    To avoid warnings in Android Studio, open Preferences ==> Inspections, uncheck "Incomplete translations". But it won't affect Gradle build.

    0 讨论(0)
  • 2020-12-02 13:23

    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>
    
    0 讨论(0)
  • 2020-12-02 13:23

    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>
    
    0 讨论(0)
  • 2020-12-02 13:33

    There is also the "Translation editor" (right click on string.xml "Open Translation Editor").

    Then check the 'Untranslatable' box on a string.

    https://developer.android.com/studio/write/translations-editor

    0 讨论(0)
提交回复
热议问题