码迷,mamicode.com
首页 > 移动开发 > 详细

【转】Android应用程序打包时,出现错误:"XXX" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic).....

时间:2018-05-07 19:39:41      阅读:377      评论:0      收藏:0      [点我收藏+]

标签:man   原因   sdk   str   detail   can   流程   android应用   .net   

"app_name" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "en-rGB" (English: United Kingdom), "en-rIN" (English: India), "es" (Spanish), "es-rUS" (Spanish: United States), "et-rEE" (Estonian: Estonia), "fa" (Persian), "fi" (Finnish), "fr" (French), "fr-rCA" (French: Canada), "hi" (Hindi), "hr" (Croatian), "hu" (Hungarian), "hy-rAM" (Armenian: Armenia), "in" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ka-rGE" (Georgian: Georgia), "km-rKH" (Khmer: Cambodia), "ko" (Korean), "lo-rLA" (Lao: Lao People‘s Democratic Republic), "lt" (Lithuanian), "lv" (Latvian), "mn-rMN" (Mongolian: Mongolia), "ms-rMY" (Malay: Malaysia), "nb" (Norwegian Bokm?l), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "pt-rPT" (Portuguese: Portugal), "ro" (Romanian), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sr" (Serbian), "sv" (Swedish), "sw" (Swahili), "th" (Thai), "tl" (Tagalog), "tr" (Turkish), "uk" (Ukrainian), "vi" (Vietnamese), "zh-rCN" (Chinese: China), "zh-rHK" (Chinese: Hong Kong), "zh-rTW" (Chinese: Taiwan, Province of China), "zu" (Zulu)


Issue: Checks for incomplete translations where not all strings are translated


Id: 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.)

根据错误提示的log,自己尝试 :

(1)忽略:tools:ignore="MissingTranslation" 和(2)指定文件的语言:tools:locale="zh-rCN"

结果:设置res/value/string.xml文件的 tools:ignore="MissingTranslation" 属性,可以忽略导出apk时产生的错误。

技术分享图片
<resources 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="MissingTranslation"
    >   
    <string name="app_name">XXXX</string>
</resources>
技术分享图片

—— - - - ——- - - —— - - - -- -—— —— —— - -—— - —— - -—— --—— -

以下是转载:

问题:当我们开发完成一个Android应用程序后,在发布该应用程序之前必须要经过的一步时打包应用程序。

至于从打包程序到发布的完整过程可以参考: Android 应用程序发布流程---碗豆荚发布流程

选择Eclipse ADT打包应用程序的过程如下:

技术分享图片

可是在这时,会出现如下提示:

技术分享图片

并且原本没有错误的程序(values/strings.xml)也会出现如下错误提示:

技术分享图片
"app_name" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), 
 "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "en-rGB" (English: United Kingdom), "en-rIN" (English: 
 India), "es" (Spanish), "es-rUS" (Spanish: United States), "et-rEE" (Estonian: Estonia), "fa" (Persian), 
 "fi" (Finnish), "fr" (French), "fr-rCA" (French: Canada), "hi" (Hindi), "hr" (Croatian), "hu" (Hungarian), "hy-
 rAM" (Armenian: Armenia), "in" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ka-rGE" (Georgian: 
 Georgia), "km-rKH" (Khmer: Cambodia), "ko" (Korean), "lo-rLA" (Lao: Lao People‘s Democratic Republic), 
 "lt" (Lithuanian), "lv" (Latvian), "mn-rMN" (Mongolian: Mongolia), "ms-rMY" (Malay: Malaysia), "nb" (Norwegian 
 Bokm?l), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "pt-rPT" (Portuguese: Portugal), "ro" (Romanian), 
 "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sr" (Serbian), "sv" (Swedish), "sw" (Swahili), "th" (Thai), 
 "tl" (Tagalog), "tr" (Turkish), "uk" (Ukrainian), "vi" (Vietnamese), "zh-rCN" (Chinese: China), "zh-rHK" (Chinese: 
 Hong Kong), "zh-rTW" (Chinese: Taiwan, Province of China), "zu" (Zulu)
技术分享图片

是什么原因呢?原因如下:

 

 

在Android SDK Tool r19之后, Export的时候遇到xxx is not translated in yyy, zzz的问题。

例如说"auto_name" is not translated in zh, zh_CN.

这是因为Android SDK Tool 將 ANDROID_LINT_COMPLETE_REGIONS 改为了需要检查。

 

如何解决呢?

技术分享图片

其实,以上提示已经给我们答案。一种是“fix these before running Export ”,另一种是“turn off ‘Run full error check when exporting app‘”

方法如下:

先说后者:“turn off ‘Run full error check when exporting app‘“

(1)在Eclipse中打开Preference,按下图操作:

技术分享图片

(2)再说前者:“fix these before running Export ”

操作如下图所示:

技术分享图片

双击选择4,会在5的左侧出现对该问题的描述,如下:

 

技术分享图片

框中也给我们三种解决方法。
即:
1》If the string should not be translated, you can add the attribute translatable="false" on the <string> element,

技术分享图片

这种方法只适合数量较少的情况下。

2》字符串数量较大的情况,会很麻烦,这时可以采用另一种方法:

or you can define all your non-translatable strings in a resource file called donottranslate.xml.

即我们可以将所有不需要non-translatable 的字符串统一放入一个名叫donottranslate.xml的文件中。

在values新建donottranslate.xml文件,并把不需要non-translatable 的字符串放入其中.

donottranslate.xml:

技术分享图片
<span style="font-size:14px;"><?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">UMengDemo</string>
    <string name="action_settings" >Settings</string>
    <string name="sharePic_text" >分享本地图片</string></span><pre name="code" class="html" style="text-indent: 0.10000000149011612px;"><span style="font-size:14px;"></resources></span>
技术分享图片

3》Or, you can ignore the issue with a tools:ignore="MissingTranslation" attribute.

第三种方法,就是用tools:ignore="MissingTranslation“ 属性直接忽略这个问题

 

 

以上操作完成后,最好选择“Clean”一下项目,方法如下:

技术分享图片

技术分享图片

这样就可以解决以上问题了。

 

原文链接:https://blog.csdn.net/cxc19890214/article/details/39120415

【转】Android应用程序打包时,出现错误:"XXX" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic).....

标签:man   原因   sdk   str   detail   can   流程   android应用   .net   

原文地址:https://www.cnblogs.com/ryq2014/p/9004029.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!