Search code examples
androidandroid-lint

Best practice for language-independent strings


My Android application contains a number of language-independent strings, such as tariffs and support phone numbers. I've placed a XML file in /res/values containing for instance:

<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 is complaining that these strings aren't translated to the other languages:

Locale de is missing translations for: helpdesk_number, helpdesk_number, helpdesk_address1, helpdesk_address2... (56 more)

While it might make sense to display a different tariff for other languages, the helpdesk is only in one country.

Does it make sense to copy these strings to the other languages? Or is there some way of having Lint ignore these specific strings (or string file)?


Solution

  • the upcoming ( hopefully soon ) ADT17 will bring some features for ignoring some lint warnings:

    http://tools.android.com/recent/ignoringlintwarnings

    http://tools.android.com/tips/lint/suppressing-lint-warnings

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

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

    or perhaps you can also do it per string via:

    tools:ignore="MissingTranslation"

    but the document is not 100% clear about that and I have no time for betatesting 17 at the moment ..

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