189

I can't compile/debug our Android app, because the localization files are not perfect yet.

My IDE's validation tool Lint create errors saying:

newCardsOrderVals is not translated in ar, bg, ca, cs

Compiling/installing/running with Ant works fine, but I would like to use my IDE to ease debugging.

Is there a way to turn off this particular check, or ideally make it a warning rather than an error?

I understand that before release we will really need to get localisation files right, but for the time being it is not a priority as the screens themselves are being modified very frequently.

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
  • 1
    Is there a way to configure which all languages are flagged as "not translated?" I get errors like "es, he, and iw". Why do I get those languages? How do I configure my Android app to restrict the set to "en" only? – inder Apr 24 '13 at 22:12
  • @inder: Maybe because you have directories like "values-he" etc in your res/ folder? – Nicolas Raoul Apr 25 '13 at 00:20
  • 1
    No, I dont have any such directories. Only, values, layout, and drawable. – inder Apr 26 '13 at 02:13
  • 7
    es, he and iw come from the Facebook SDK library. – madej Sep 02 '13 at 21:12
  • 2
    This is a bug in Android Lint: https://code.google.com/p/android/issues/detail?id=50525 – altumano Mar 09 '14 at 18:47

13 Answers13

348

Android Studio:

  • "File" > "Settings" and type "MissingTranslation" into the search box

Eclipse:

  • Windows/Linux: In "Window" > "Preferences" > "Android" > "Lint Error Checking"
  • Mac: "Eclipse" > "Preferences" > "Android" > "Lint Error Checking"

Find the MissingTranslation line, and set it to Warning as seen below:

Missing translations, is not translated in

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
86

You can set the attribute translatable="false" on the definition like this:

<string name="account_setup_imap" translatable="false">IMAP</string>

For more information: http://tools.android.com/recent/non-translatablestrings

efor18
  • 1,256
  • 10
  • 5
  • 1
    I said "the localization files are not perfect **yet**". They are being filled little by little. translatable="false" would prevent anybody from translating. – Nicolas Raoul Nov 05 '12 at 07:38
  • 3
    While the answer is not directly related to the question, I guess, it provide brilliant solution for folks like me who found this topic when Google "how to make lint don't worry about my app constants/parameters". Thank you, efor18! – aka_sh Jun 13 '14 at 09:02
83

To ignore this in a gradle build add this to the android section of your build file:

lintOptions {
   disable 'MissingTranslation'
}
Janusz
  • 187,060
  • 113
  • 301
  • 369
23

This will cause Lint to ignore the missing translation error for ALL strings in the file, yet other string resource files can be verified if needed.

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" 
    tools:ignore="MissingTranslation">
Tom Bollwitt
  • 10,849
  • 1
  • 17
  • 11
  • This is probably the most correct way to proceed, without disabling lint for all the project – MatPag Apr 04 '17 at 10:19
11

If you want to turn off the warnings about the specific strings, you can use the following:

strings.xml

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

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

</resources>

If you want to warn on specific strings instead of an error, you will need to build a custom Lint rule to adjust the severity status for a specific thing.

http://tools.android.com/tips/lint-custom-rules

Eduard
  • 3,482
  • 2
  • 27
  • 45
  • 1
    +1 Good way to do it once for all, so that all developers of the team don't have to modify their IDE settings. Any way to make it a warning, rather than suppress completely? – Nicolas Raoul May 31 '14 at 11:24
  • You can build a custom Lint rule to adjust the severity status for a specific thing. There is an example here: http://tools.android.com/tips/lint-custom-rules – Eduard May 31 '14 at 15:20
9

Insert in the lint.xml file this:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    ...

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

For more details: Suppressing Lint Warnings.

Brais Gabin
  • 5,827
  • 6
  • 57
  • 92
9

add the lines in your /res/values.xml file in resource root tab like this:

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

tools:locale set the local language to English, no need of language translation later on that for all resource strings and tools:ignore let Lint to isnore the missing translations of the resource string values.

Purvik Rana
  • 331
  • 7
  • 17
6

Add following to your gradle file in android section

    lintOptions {
       disable 'MissingTranslation'
    }
chzahid
  • 149
  • 2
  • 4
5

In addition,

Not project dependent properities, Eclipse Preferences.
In Mac, Eclipse > Preferences

enter image description here

Jinbom Heo
  • 7,248
  • 14
  • 52
  • 59
4

Another approach is to indicate the languages you intend to support and filter out the rest using the 'resConfigs' option with Gradle.

Check out this other answer for details

This is better, I think, because you don't have to completely ignore legitimate translation mistakes for languages you actually want to support

Community
  • 1
  • 1
kip2
  • 6,473
  • 4
  • 55
  • 72
1

You can also put resources which you do not want to translate to file called donottranslate.xml.

Example and explanation: http://tools.android.com/recent/non-translatablestrings

Michal Vician
  • 2,486
  • 2
  • 28
  • 47
1

Many of them has a given a different working answers, and i too got the same lint errors i make it ignore by doing the following with eclipse.

  1. click on Windows
  2. click on preferences
  3. select android > Lint Error Checking.
  4. click on ignore All > Apply > Ok.

Thats it.

raju
  • 1,254
  • 13
  • 18
1

The following worked for me.

  • Click on Windows
  • Click on preferences
  • Select android > Lint Error Checking.
  • Find and select the relevant Lint checking and
  • Set the severity to 'Ignore' (on bottom right)
Pang
  • 9,564
  • 146
  • 81
  • 122