rxz99 / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 0 forks source link

Using Android Analytics in multi-language app causes MissingTranslation Lint errors #733

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Name of affected component: Mobile Tracking

Name of related library and version, if applicable (e.g. Android, iOS,
Snippets, etc.): Android , app dependency: 
'com.google.android.gms:play-services-analytics:7.3.0', buildscript dependency: 
'com.google.gms:google-services:1.3.1'

Issue summary: Using Android Analytics in a multi-language app causes 
MissingTranslation Lint errors during build because the keys 'ga_trackingId' 
and 'gcm_defaultSenderId' are not translated to other languages AND not marked 
as untranslatable. 

Steps to reproduce issue:
1. Create app with multiple languages
2. Add Google Android Analytics
3. Compile

Expected output: Clean build.

Actual results:
**app build path 
removed**/build/generated/res/google-services/clientServerdemo03/release/values/
values.xml:3: Error: "ga_trackingId" is not translated in "nl" (Dutch) 
[MissingTranslation]
    <string name="ga_trackingId"> ** REMOVED ** </string>
            ~~~~~~~~~~~~~~~~~~~~
**app build path 
removed**/build/generated/res/google-services/clientServerdemo03/release/values/
values.xml:4: Error: "gcm_defaultSenderId" is not translated in "nl" (Dutch) 
[MissingTranslation]
    <string name="gcm_defaultSenderId"> ** REMOVED ** </string>
            ~~~~~~~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "MissingTranslation":
   If an application has more than one locale, then all the strings declared
   in one language should also be translated in all other languages.

   If the string should not be translated, you can add the attribute
   translatable="false" on the <string> element, or you can define all your
   non-translatable strings in a resource file called donottranslate.xml. Or,
   you can ignore the issue with a tools:ignore="MissingTranslation"
   attribute.

   By default this detector allows regions of a language to just provide a
   subset of the strings and fall back to the standard language strings. You
   can require all regions to provide a full translation by setting the
   environment variable ANDROID_LINT_COMPLETE_REGIONS.

   You can tell lint (and other tools) which language is the default language
   in your res/values/ folder by specifying tools:locale="languageCode" for
   the root <resources> element in your resource file. (The tools prefix
   refers to the namespace declaration http://schemas.android.com/tools.)

Original issue reported on code.google.com by aaa...@gmail.com on 11 Sep 2015 at 7:57

GoogleCodeExporter commented 8 years ago
This is still happening with the 8.1.0 Google Play Services library, and the 
1.4.0-beta3 dependency. I had to suppress it with 
buildTypes { release { lintOptions { disable 'MissingTranslation } } } 
in the app build.gradle.

Original comment by hikarite...@gmail.com on 2 Oct 2015 at 3:11

GoogleCodeExporter commented 8 years ago
Another way to work it around is to add

  <string name="gcm_defaultSenderId"><YOUR_SENDERID></string>

to all languages except the default. This way you don't have to disable the 
'MissingTranslation' lint. Credits: http://stackoverflow.com/a/32905586/952135

Original comment by viliam.d...@kios.sk on 15 Oct 2015 at 4:54

GoogleCodeExporter commented 8 years ago
Still happening with the 1.5.0-beta1 version. It is not a good solution to 
disable the lint-tests.

Original comment by nilsmag...@gmail.com on 4 Nov 2015 at 11:25

GoogleCodeExporter commented 8 years ago
This issue should be fixed with 8.3.0 Google Play Services and 1.5.0-beta2 
dependency.

Original comment by zhangxio...@gmail.com on 6 Nov 2015 at 3:59

GoogleCodeExporter commented 8 years ago
Still happening under 1.5.0-beta2, gms-8.3.0

Original comment by bski...@gmail.com on 10 Nov 2015 at 1:43

GoogleCodeExporter commented 8 years ago
This is fixed for defaultSenderId, but someone forgot about google_app_id; 
Please fix it for it too(1.5.0-beta2, gms-8.3.0)

Original comment by apollo2t...@gmail.com on 18 Nov 2015 at 11:18

GoogleCodeExporter commented 8 years ago
Looks like all the string resource should be marked as non-translatable. 

Original comment by zhangxio...@gmail.com on 18 Nov 2015 at 3:47

GoogleCodeExporter commented 8 years ago
google app id and ga_trackingID in the generated values.xml still have these 
errors

Original comment by zekam...@gmail.com on 19 Nov 2015 at 4:23

GoogleCodeExporter commented 8 years ago
Just add translatable="false" like here:
<string name="gcm_defaultSenderId" translatable="false">

Original comment by zekam...@gmail.com on 19 Nov 2015 at 4:31

GoogleCodeExporter commented 8 years ago
Ad #9: the file is generated, the edit will be overwritten after project clean 
or so.

Original comment by viliam.d...@kios.sk on 19 Nov 2015 at 4:40

GoogleCodeExporter commented 8 years ago
My workaround for this is to add the string to the strings.xml of all languages 
except the default (English) one.
As long as that string is static, it works...

Original comment by jochen.m...@daimler.com on 19 Nov 2015 at 4:45

GoogleCodeExporter commented 8 years ago
#10, i know, im just saying that this is an easy fix, not more that 5-10 
minutes, why it is still not fixed by the google guys

Original comment by zekam...@gmail.com on 20 Nov 2015 at 10:34

GoogleCodeExporter commented 8 years ago
Here is my lint.xml. Good luck!

<lint>
    <issue id="MissingTranslation">
        <ignore regexp="ga_trackingId"/>
        <ignore regexp="gcm_defaultSenderId"/>
    </issue>
</lint>

Original comment by skyi...@gmail.com on 21 Nov 2015 at 6:03