On Tue, May 6, 2014 at 1:38 PM, 'Tor Norbye' via adt-dev <
[email protected]> wrote:

> If you want to ignore all folders except for one or two you'll probably
> need to write a regexp which includes all but those folders. Make sure
> you're using the 0.10 version of the Gradle plugin, since the regexp
> version of <ignore> was added recently and probably wasn't available in the
> 0.9 and older versions.
>

The problem is even the @path version is not working as I was expecting.
 However, if I use <ignore path="res/values/strings.xml"/> it *does* work,
and ignores *all* MissingTranslation errors for all localized variants.
 That is not what I wanted either.

So it seems that the reason this isn't working like I thought it would is
because the actual lint error is occurring on res/values/strings.xml, with
an error that *references* the other localized variant(s) of the resource.
 So the error is stating "this is not translated in es, de, ... etc", but
the source of the lint failure is in the default (english) version of the
resource.  That's why ignoring the "-de" or "-es" versions has no impact at
all, because the lint check is executing on the default resource, not the
variant.

Is there any way to get Lint to handle this type of failure differently
based on the variant it is comparing against?


Here is a simple use case to describe what I'm looking for:

res/values/strings.xml:
<string name="one">one</string>
<string name="two">two</string>
<string name="three">three</string>

res/values-de/strings.xml:
<string name="one">eins</string>
<string name="two">zwei</string>

res/values-es/strings.xml:
<string name="two">dos</string>
<string name="three">tres</string>

The MissingTranslation lint issue gets executed *only* on
"res/values/string.xml" -- but for each resource found in that file, it
also checks if there is a matching resources in _every_
res/values-*/strings.xml, and if not, raises an error.

I am looking for some way to indicate that I only want the "-es" version to
be checked (for example), but I do not care about other variants.  So I
would want an error that says "String resource 'one' is not translated in:
es", but I *do not* want an error about "String resource 'three' is not
translated in: de"

Perhaps a new tools attribute that I can add in res/values/strings.xml
(e.g., similar to the default locale attribute <
http://tools.android.com/tech-docs/tools-attributes#TOC-tools:locale>):

    <resources tools:requiredTranslations="es,fr">
        ...
    </resources>


That way any variant resources that I don't care about that just *happen*
to have been translated is a bonus.. but if it's not translated, so be it
(ignore);
but if there's a string resource that is missing in one of the languages I
*do* care about, I want that to be a fatal lint error.


On Mon, May 5, 2014 at 9:26 AM, Joe Hansche <[email protected]> wrote:
>
>> Are there any other suggestions for this?  I am not able to get the
>> <ignore path="res/values-*/strings.xml" /> feature to work at all.  I have
>> about a dozen languages, but I only care about 2 of them to be "fatal"
>> during the lintVitalRelease step.  The rest should be ignored (or maybe
>> generate warnings when I run the "lint" step -- I just don't want them to
>> be "fatal" during a release task).  I thought the <ignore/> feature was
>> exactly what I was looking for, but it still doesn't work.
>>
>> lint.xml:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <lint>
>>     <issue id="MissingTranslation">
>>         <ignore path="res/values-de/strings.xml" />
>>     </issue>
>> </lint>
>>
>> This still fails to build due to MissingTranslation in the values-de
>> file.  The only way I can get it to truly ignore the errors is by
>> overriding the severity of the entire issue:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <lint>
>>     <issue id="MissingTranslation" severity="ignore" />
>> </lint>
>>
>> That works, but then it won't catch the missing translations in the
>> languages that I *do* want to be warned about.  Why does <ignore/> not work
>> correctly then?
>>
>> My project structure is set up using the old Eclipse/Ant style structure:
>>
>> ./ - root
>> ./res/
>> ./src/
>>   ... etc
>>
>> My lint.xml file is in the project root.  I also tried using:  <ignore
>> regex=".*/values-.*/.*\.xml" /> to no avail...
>>
>> I want missing translations in the values-es/ directory to trigger the
>> fatal MissingTranslation error, but I want to ignore all the other
>> languages.  What needs to happen for this to work?
>>
>> Both the CLI tool and the Gradle task are showing the same problem.
>>
>> On Thursday, January 16, 2014 4:12:31 PM UTC-5, Michael Barany wrote:
>>>
>>> thanks! that worked.
>>>
>>> On Thursday, January 16, 2014 4:54:33 AM UTC-5, Dal wrote:
>>>>
>>>> I had this same issue - try app/src/main/res/values/qa-strings.xml
>>>>
>>>> On Wednesday, 15 January 2014 08:31:01 UTC, Michael Barany wrote:
>>>>>
>>>>> Anyone know what I'm doing wrong?
>>>>>
>>>>>
>>>>> *My project structure is pretty straight forward.*
>>>>> /build.gradle
>>>>> /app/build.gradle
>>>>> /app/lint.xml
>>>>>
>>>>> *lint options in /app/build.gradle:*
>>>>>     lintOptions {
>>>>>         abortOnError false
>>>>>         absolutePaths false
>>>>>         lintConfig file("lint.xml")
>>>>>     }
>>>>>
>>>>> *lint.xml file contents:*
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <lint>
>>>>>     <issue id="MissingTranslation">
>>>>>         <ignore path="res/values/qa-strings.xml" />
>>>>>     </issue>
>>>>> </lint>
>>>>>
>>>>> I also tried the path src/main/res/values/qa-strings.xml
>>>>>
>>>>> The Lint Report still tells me "MissingTranslation: Incomplete
>>>>> translation" in that file I'm trying to ignore.
>>>>>
>>>>> thanks!
>>>>>
>>>>  --
>> You received this message because you are subscribed to the Google Groups
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "adt-dev" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/adt-dev/xWSUOAq3RCM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Joe Hansche
Senior Applications Architect
<http://www.meetme.com/>
100 Union Square Drive
New Hope, PA 18938
[email protected]

<https://www.facebook.com/pages/MeetMe/21931227129>
<https://twitter.com/meetme>
   <http://www.youtube.com/user/MeetMeVideos>

The public market leader in social discovery. (NYSE MKT: MEET)

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to