Frage

I live in Canada but decided to publish a simple app with only Korean language.

When I try to export this app into .apk file, I get bunch of Lint warnings that

my strings.xml and arrays.xml are not translated

Lint gives me two suggestions:

  1. If the string should not be translated, you can add the attribute translatable="false" on the element, or you can define all your non-translatable strings in a resource file called donottranslate.xml. Or, you can ignore the issue with a tools:ignore="MissingTranslation" attribute.

  2. You can tell lint (and other tools) which language is the default language in your res/values/ folder by specifying tools:locale="languageCode" for the root element in your resource file. (The tools prefix refers to the namespace declaration http://schemas.android.com/tools.

However, i dont know where to put tools:ignore statements. I tried several places in my strings.xml none seems to work. Also the website link to http://schemas.android.com/tools not working for me. I guess the language code for korean is ko.

War es hilfreich?

Lösung

"schemas.android.com" is gone. new tools resource is this: http://tools.android.com/tech-docs/tools-attributes

Andere Tipps

You asked where to put tools:ignore statements.

In the file shown at the head of your build error (probably similar to ..\app\src\main\res\values\arrays.xml), to skip this lint error, replace this line near the top of your file:

<resources>

With this line:

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

This tells lint not to halt the build process due to missing translations. Whatever translations you have implemented will still be in effect, but lint won't warn you any more of untranslated items.

xmlns stands for "XML NameSpace" and simply tells lint what your tools reference refers to. A thorough rundown on xmlns is found at https://stackoverflow.com/a/1181936/5025060.

A good reference on Android's xmlns:tools attributes including samples of various usages is http://tools.android.com/tech-docs/tools-attributes

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top