Avoid Android Lint complains about not-translated string

Gianni Costanzi picture Gianni Costanzi · Sep 25, 2012 · Viewed 64.6k times · Source

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 that are common for all the languages and need no translation, so I've created an unlocalized-strings.xml file within values directory.. Running Android Lint to check for problems it keeps saying that some translations are missing.. I do not want to disable this check on the whole project, I'd like to disable it only in some XML files.. is it possible?

"title_widget_updater_service" is not translated in de, en, en-rUS, it

Issue: Checks for incomplete translations where not all strings are translated
Id: MissingTranslation

If an application has more than one locale, then all the strings declared in one language     
should also be translated in all other languages.

By default this detector allows regions of a language to just provide a subset of the 
strings and fall back to the standard language strings. You can require all regions to 
provide a full translation by setting the environment variable 
ANDROID_LINT_COMPLETE_REGIONS.

How can defined this region of unlocalized strings?

Answer

Adil Hussain picture Adil Hussain · Dec 10, 2012

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>