Fixed
Status Update
Comments
uc...@google.com <uc...@google.com> #2
Not reproduced, tested in latest Android studio version 3.5.1.
ka...@gmail.com <ka...@gmail.com> #3
I just reproduced the issue in Android Studio 3.5.1. Unless I add a block to ignore it in lint.xml, I see Android --> Lint --> Correctness --> Messages --> Unused quantity translations for every Russian plurals.
I did misspeak earlier that it's an error - it's correctly at "warning" level, but it's still a false positive.
Even if it were fixed in Studio, the version of lint available in the standalone tools (26.1.1) has this problem. I need to use the standalone lint in order to run lint in CI environments.
I did misspeak earlier that it's an error - it's correctly at "warning" level, but it's still a false positive.
Even if it were fixed in Studio, the version of lint available in the standalone tools (26.1.1) has this problem. I need to use the standalone lint in order to run lint in CI environments.
ka...@gmail.com <ka...@gmail.com> #4
I tried to make a sample app, but I'm not able to reproduce by creating a simple app with just a single plurals in English and Russian.
What might be affecting lint in my main app? I'd like to be helpful in tracking this down, but I'm at a loss as to why my main app would have this problem but not a sample app.
What might be affecting lint in my main app? I'd like to be helpful in tracking this down, but I'm at a loss as to why my main app would have this problem but not a sample app.
tn...@google.com <tn...@google.com> #5
Can you double check that in your strings file (/res/values-ru/strings.xml) you don't accidentally have a tools:locale="en" on the root <resources> element?
ka...@gmail.com <ka...@gmail.com> #6
#@%$! Thanks for that pointer. We get our non-english strings.xml files from a translation service, and I never even thought to check that.
tn...@google.com <tn...@google.com> #7
So that was it? You know, I think I'm going to make lint emit a warning if you put tools:locale in a file in a locale specific folder. That attribute is really meant for when you're in a folder where the locale is unknown (e.g. values/, or say values-ldrtl/), at least if the locale is in conflict with the one implied from the folder.
E.g. in values-ru/ it's okay to have tools:locale="ru-RU", but not "en-RU".
E.g. in values-ru/ it's okay to have tools:locale="ru-RU", but not "en-RU".
tn...@google.com <tn...@google.com> #8
Ok here's from the unit test what lint will emit now:
res/values-nb/strings.xml:3: Error: Suspicious tools:locale declaration of language en; the parent folder values-nb implies language nb [MissingTranslation]
xmlns:tools="http://schemas.android.com/tools " tools:locale="en">
~~
1 errors, 0 warnings
res/values-nb/strings.xml:3: Error: Suspicious tools:locale declaration of language en; the parent folder values-nb implies language nb [MissingTranslation]
xmlns:tools="
~~
1 errors, 0 warnings
ka...@gmail.com <ka...@gmail.com> #9
That was exactly the problem. Thanks for adding a new lint check for it. I might suggest changing the category for it, as "MissingTranslation" doesn't quite seem right.
Description
Example:
/res/values-ru/strings.xml:
<plurals name="name">
<item quantity="one">...</item>
<item quantity="other">...</item>
<item quantity="few">...</item>
<item quantity="many">...</item>
</plurals>
This gives the error: .../res/values-ru/strings.xml:2560: Error: For language "en" (English) the following quantities are not relevant: few, many [UnusedQuantity]
This seems to be running the English check on a non-English language. I also get the same issue with Indonesian, which only uses "other".
Version: 26.1.1