Best practice for language independent strings

My Android app contains a number of language independent strings such as rates and support phone numbers. I have placed an XML file in /res/values

containing, for example:

<string name="helpdesk_number">0900 12345678</string>
<string name="helpdesk_tariff">60p</string>
<string name="helpdesk_address1">221B Baker Street</string>
<string name="helpdesk_address2">London NW1 6XE</string>


Lint complains that these lines are not translated into other languages:

Locale de lacks translations for: helpdesk_number, helpdesk_number, helpdesk_address1, helpdesk_address2 ... (56 others)

While it makes sense to display a different rate for other languages, the support team is located in only one country.

Does it make sense to copy these lines to other languages? Or is there a way for Lint to ignore those specific lines (or a line file)?


source to share

6 answers

the upcoming (hopefully soon) ADT17 will bring some functionality to ignore some of the lint warnings:

so with ADT 17 you can put lint.xml in your project folder containing:

<issue id="MissingTranslation" severity="ignore" />

or perhaps you can also do it per line with:


but the doc is not 100% clear about this, and I don't have time to do the 17 test at the moment.

A Follow-UP: ADT17 was released shortly after you asked and should solve your problems!



In recent versions of Lint, you can ignore the specific "MissingTranslation" lines :


<?xml version="1.0" encoding="utf-8"?>

    <!--suppress MissingTranslation -->
    <string name="some_string">ignore my translation</string>




Straight from the Lint tool:

If the string does not need to be translated, you can add the translatable = "false" attribute on the element, or you can define all of your untranslated strings in a resource file called donottranslate.xml. Or you can ignore the problem using the tools: ignore = "MissingTranslation".

Just create a "donottranslate.xml" file inside the default res / values ​​folder and Lint will ignore it. I put all my app keys / IDs, etc. Here, as well as the settings, since they do not need to be "translated" and simply take up space in other files.



another way to avoid this message is by adding to the resource file:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="" tools:ignore="MissingTranslation">




 > Best practice for language-independent strings


In my application I have two strings file files, one of them is called "NonTranslatabable.xml", which will receive those strings that will not be translated (username, filenames, ..).

When translating an application into another language, I don't have to think if the string should be translated or not.



Add this to your Gradle app file under "android"

lintOptions {
    disable 'MissingTranslation'




All Articles