Avoid Android Lint complains about not-translated string

后端 未结 11 1654
轻奢々
轻奢々 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:09

    There are 3 ways that I know of :

    To apply the modification value by value : Set the attribute translatable="false" on the definition:

    IMAP
    

    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

提交回复
热议问题