【轉】Android應用程式打包時,出現錯誤:"XXX" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic).....

來源:互聯網
上載者:User

標籤: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”一下項目,方法如下:

這樣就可以解決以上問題了。

 

原文連結:39120415

【轉】Android應用程式打包時,出現錯誤:"XXX" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic).....

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.