回答
你可以叫他們English.lproj
,Spanish.lproj
等
的 「縮寫名稱」 實際上IETF language tags(即BCP 47),除非您使用pt_PT.lproj
代替pt-PT.lproj
。
實際解釋例程是在https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/PlugIn.subproj/CFBundle_Locale.c,由CFBundleGetLocalizationInfoForLocalization
函數確定。這裏複製:
| lproj identifiers | L# | C# | Display name |
|:-------------------------------|:----|:----|:---------------------------|
| en_US = en = English | 0 | 0 | English (United States) |
| en_GB | 0 | 2 | English (United Kingdom) |
| en_AU | 0 | 15 | English (Australia) |
| en_CA | 0 | 82 | English (Canada) |
| en_SG | 0 | 100 | English (Singapore) |
| en_IE | 0 | 108 | English (Ireland) |
| fr_FR = fr = French | 1 | 1 | French (France) |
| fr_CA | 1 | 11 | French (Canada) |
| fr_CH | 1 | 18 | French (Switzerland) |
| fr_BE | 1 | 98 | French (Belgium) |
| de_DE = de = German | 2 | 3 | German (Germany) |
| de_CH | 2 | 19 | German (Switzerland) |
| de_AT | 2 | 92 | German (Austria) |
| it_IT = it = Italian | 3 | 4 | Italian (Italy) |
| it_CH | 3 | 36 | Italian (Switzerland) |
| nl_NL = nl = Dutch | 4 | 5 | Dutch (Netherlands) |
| nl_BE | 34 | 6 | Dutch (Belgium) |
| sv_SE = sv = Swedish | 5 | 7 | Swedish (Sweden) |
| es_ES = es = Spanish | 6 | 8 | Spanish (Spain) |
| es_XL | 6 | 86 | Spanish (Latin America) |
| da_DK = da = Danish | 7 | 9 | Danish (Denmark) |
| pt_BR = pt = Portuguese | 8 | 71 | Portuguese (Brazil) |
| pt_PT | 8 | 10 | Portuguese (Portugal) |
| nb_NO = nb = no = Norwegian | 9 | 12 | Norwegian Bokmål (Norway) |
| nn_NO = nn = Nynorsk | 151 | 101 | Norwegian Nynorsk (Norway) |
| he_IL = he = Hebrew | 10 | 13 | Hebrew (Israel) |
| ja_JP = ja = Japanese | 11 | 14 | Japanese (Japan) |
| ar = Arabic | 12 | 16 | Arabic |
| fi_FI = fi = Finnish | 13 | 17 | Finnish (Finland) |
| el_GR = el = Greek | 14 | 20 | Greek (Greece) |
| el_CY | 14 | 23 | Greek (Cyprus) |
| is_IS = is = Icelandic | 15 | 21 | Icelandic (Iceland) |
| mt_MT = mt = Maltese | 16 | 22 | Maltese (Malta) |
| tr_TR = tr = Turkish | 17 | 24 | Turkish (Turkey) |
| hr_HR = hr = Croatian | 18 | 68 | Croatian (Croatia) |
| zh_TW = zh-Hant | 19 | 53 | Chinese (Taiwan) |
| zh_CN = zh = zh-Hans = Chinese | 33 | 52 | Chinese (China) |
| ur_PK = ur = Urdu | 20 | 34 | Urdu (Pakistan) |
| ur_IN | 20 | 96 | Urdu (India) |
| hi_IN = hi = Hindi | 21 | 33 | Hindi (India) |
| th_TH = th = Thai | 22 | 54 | Thai (Thailand) |
| ko_KR = ko = Korean | 23 | 51 | Korean (South Korea) |
| lt_LT = lt = Lithuanian | 24 | 41 | Lithuanian (Lithuania) |
| pl_PL = pl = Polish | 25 | 42 | Polish (Poland) |
| hu_HU = hu = Hungarian | 26 | 43 | Hungarian (Hungary) |
| et_EE = et = Estonian | 27 | 44 | Estonian (Estonia) |
| lv_LV = lv = Latvian | 28 | 45 | Latvian (Latvia) |
| se = Sami | 29 | 46 | Northern Sami |
| fo_FO = fo = Faroese | 30 | 47 | Faroese (Faroe Islands) |
| fa_IR = fa = Farsi | 31 | 48 | Persian (Iran) |
| ru_RU = ru = Russian | 32 | 49 | Russian (Russia) |
| ga_IE = ga = Irish | 35 | 50 | Irish (Ireland) |
| sq = Albanian | 36 | -1 | Albanian |
| ro_RO = ro = Romanian | 37 | 39 | Romanian (Romania) |
| cs_CZ = cs = Czech | 38 | 56 | Czech (Czech Republic) |
| sk_SK = sk = Slovak | 39 | 57 | Slovak (Slovakia) |
| sl_SI = sl = Slovenian | 40 | 66 | Slovenian (Slovenia) |
| yi = Yiddish | 41 | -1 | Yiddish |
| sr_CS = sr = Serbian | 42 | 65 | Serbian (Serbia) |
| mk_MK = mk = Macedonian | 43 | 67 | Macedonian (Macedonia) |
| bg_BG = bg = Bulgarian | 44 | 72 | Bulgarian (Bulgaria) |
| uk_UA = uk = Ukrainian | 45 | 62 | Ukrainian (Ukraine) |
| be_BY = be = Byelorussian | 46 | 61 | Belarusian (Belarus) |
| uz_UZ = uz = Uzbek | 47 | 99 | Uzbek (Uzbekistan) |
| kk = Kazakh | 48 | -1 | Kazakh |
| hy_AM = hy = Armenian | 51 | 84 | Armenian (Armenia) |
| ka_GE = ka = Georgian | 52 | 85 | Georgian (Georgia) |
| mo = Moldavian | 53 | -1 | Moldavian |
| ky = Kirghiz | 54 | -1 | Kyrgyz |
| tg = Tajiki | 55 | -1 | Tajik |
| tk = Turkmen | 56 | -1 | Turkmen |
| mn = Mongolian | 58 | -1 | Mongolian |
| ps = Pashto | 59 | -1 | Pashto |
| ku = Kurdish | 60 | -1 | Kurdish |
| ks = Kashmiri | 61 | -1 | Kashmiri |
| sd = Sindhi | 62 | -1 | Sindhi |
| bo = Tibetan | 63 | 105 | Tibetan |
| ne_NP = ne = Nepali | 64 | 106 | Nepali (Nepal) |
| sa = Sanskrit | 65 | -1 | Sanskrit |
| mr_IN = mr = Marathi | 66 | 104 | Marathi (India) |
| bn = Bengali | 67 | 60 | Bengali |
| as = Assamese | 68 | -1 | Assamese |
| gu_IN = gu = Gujarati | 69 | 94 | Gujarati (India) |
| pa = Punjabi | 70 | 95 | Punjabi |
| or = Oriya | 71 | -1 | Oriya |
| ml = Malayalam | 72 | -1 | Malayalam |
| kn = Kannada | 73 | -1 | Kannada |
| ta = Tamil | 74 | -1 | Tamil |
| te = Telugu | 75 | -1 | Telugu |
| si = Sinhalese | 76 | -1 | Sinhala |
| my = Burmese | 77 | -1 | Burmese |
| km = Khmer | 78 | -1 | Khmer |
| lo = Lao | 79 | -1 | Lao |
| vi_VN = vi = Vietnamese | 80 | 97 | Vietnamese (Vietnam) |
| id = Indonesian | 81 | -1 | Indonesian |
| tl = Tagalog | 82 | -1 | Tagalog |
| ms = Malay | 83 | -1 | Malay |
| am = Amharic | 85 | -1 | Amharic |
| ti = Tigrinya | 86 | -1 | Tigrinya |
| om = Oromo | 87 | -1 | Oromo |
| so = Somali | 88 | -1 | Somali |
| sw = Swahili | 89 | -1 | Swahili |
| rw = Kinyarwanda | 90 | -1 | Kinyarwanda |
| rn = Rundi | 91 | -1 | Rundi |
| Nyanja | 92 | -1 | Nyanja |
| mg = Malagasy | 93 | -1 | Malagasy |
| eo = Esperanto | 94 | 103 | Esperanto |
| cy = Welsh | 128 | 79 | Welsh |
| eu = Basque | 129 | -1 | Basque |
| ca_ES = ca = Catalan | 130 | 73 | Catalan (Spain) |
| la = Latin | 131 | -1 | Latin |
| qu = Quechua | 132 | -1 | Quechua |
| gn = Guarani | 133 | -1 | Guarani |
| ay = Aymara | 134 | -1 | Aymara |
| tt = Tatar | 135 | -1 | Tatar |
| ug = Uighur | 136 | -1 | Uyghur |
| dz_BT = dz = Dzongkha | 137 | 83 | Dzongkha (Bhutan) |
| jv = Javanese | 138 | -1 | Javanese |
| su = Sundanese | 139 | -1 | Sundanese |
| gl = Galician | 140 | -1 | Galician |
| af_ZA = af = Afrikaans | 141 | 102 | Afrikaans (South Africa) |
| br = Breton | 142 | 77 | Breton |
| iu_CA = iu = Inuktitut | 143 | 78 | Inuktitut (Canada) |
| gd = Scottish | 144 | 75 | Scottish Gaelic |
| gv = Manx | 145 | 76 | Manx |
| to_TO = to = Tongan | 147 | 88 | Tongan (Tonga) |
| grc | 148 | 40 | Ancient Greek |
| kl = Greenlandic | 149 | 107 | Kalaallisut |
| az = Azerbaijani | 150 | -1 | Azerbaijani |
這裏:
- L#是語言代碼和C#是國家代碼。如果他們共享相同的語言和國家代碼,我認爲兩個標識符相同。
- 我只列出了出現源文件的字符串。它也承認類似
zh_HK
和Traditional Chinese
(兩者的編號與zh_TW
相同),可能是通過更復雜的CFLocale列表。
由於iOS的10.3.1中,以下lproj名單實際使用的蘋果:
- 丹麥語,荷蘭語,英語,法語,德語,意大利語,日語,波蘭語,葡萄牙文,俄文,西班牙文,瑞典文
- ar,bo,ca,cs,da,de,el,en,es,fi,fr,he,hi,hr,hu,id,it,ja,ko,ms, nb,nl,no,pa,pl,pt,ro,ru,sk,sv,th,tr,uk,ur,vi,chr(注意:chr = Cherokee)
- EN_AU,en_CA,en_CN,EN_GB,en_ID,en_IN,en_JP,en_MY,en_NZ,en_SG
- ES_419,es_AR,es_CL,ES_CO,es_CR,es_GT,es_MX,es_PA,es_PE,es_US
- ar_SA,da_DK, de_AT,將de_CH,fi_FI,fr_BE,fr_CA,fr_CH表示,he_IL,it_CH,ms_MY,nb_NO,nl_BE,nl_NL,pt_BR表示,PT_PT,ru_RU,sv_SE,th_TH,tr_TR,yue_CN,zh_CN的,了zh_HK,zh_TW的
德國是de
,西班牙文是es
。這些代碼的一般格式是 languageCode_CountryCode
或 languageCode
(用作指定語言時的默認值,但不是國家)。
所以你可以做這樣的事情en
(通用英語),en_GB
(英語,但來自英國)fr_FR
(法語來自法國)和fr_CH
(瑞士法語)。
語言代碼是ISO 639-1 standard的一部分,國家代碼來自ISO 3166 standard。
不久,您應該使用兩個字母代碼,大多數情況下,由BCP 47 codes指定。
更長,按照official Apple documentation的規定,您應該使用BCP 47 codes。
現在的經驗法則是使用最合適的代碼。你應該使用它,因爲這可以最大化類似區域的覆蓋範圍。
例如,如果您使用俄語本地化,則應該只使用ru
代碼,而不是像ru-RU
這樣的替代方法。這很重要,因爲如果您使用短代碼,來自其他國家講俄語的用戶將會看到您的俄文版應用程序。否則,只有俄羅斯使用俄語的人才會顯示俄語。
如果你想了解的語言代碼的詳細信息,包括推薦的代碼最常用的語言,你應該讀一段文章,我寫了一年多以前http://blog.i18n.ro/simplified-locale-codes/更多 - 請記住,有關於葡萄牙和一些技巧中文,但對於其他語言,您可以使用下面的列表。
Arabic (ar), Czech (cs), Danish (da), German (de), Greek (el), Finnish (fi), Hebrew (he), Hungarian (hu), Italian (it), Japanese (ja), Korean (ko), Norwegian (nb), Dutch (nl), Polish (pl), Romanian (ro), Russian (ru), Swedish (sv), Turkish (tr), Ukrainian (uk).
這個問題已經回答了,但我覺得做由多種來源更加混亂。事實是,iOS有30種語言可以識別爲.lproj文件夾。它不會接受任何區域代碼,因此告訴它fr-CA不會讓你加拿大法語,而是簡單地使用你的英文字符串。您需要爲該語言使用雙字母代碼(en.lproj,fr.lproj,es.lproj,de.lproj等)。這條規則的唯一例外是中文,應爲zh_Hans爲簡體中文,zh_Hant爲繁體中文。
更令人困惑的是,iTunes App Store有一個不同的它理解的語言集合,它確實承認許多區域版本,如澳大利亞英語和巴西葡萄牙語。
還有就是目前支持的語言和語言代碼在這裏不論是iOS和iTunes的一個完整的(和更新的)名單:
不知道這是什麼時候發生變化,但現在可以做法語加拿大地區專用語言翻譯。在XCode中,轉到Project,Info,Localizations,按下+按鈕,然後向下滾動到語言列表的底部,直到您看到Other右箭頭,這將打開一個不錯的大列表,其中包含語言的區域變體。 – 2014-08-25 10:03:13
- 1. Laravel使用語言環境的語言環境代碼
- 2. Sylius語言環境代碼不正確
- 3. Android語言環境中奇怪的語言代碼
- 4. 如何獲取語言環境的ISO2語言代碼?
- 5. Rails/Devise - 在語言環境文件中添加ruby代碼?
- 6. 從語言環境代碼獲取本地化語言名稱
- 7. 設置我的語言環境iphone
- 8. 獲取哪些語言環境有自己的值文件夾
- 9. 如果語言環境沒有代碼頁,如何檢測語言環境/語言?
- 10. 在iPhone上安裝語言環境
- 11. 語言環境文件同步
- 12. 從當前線程文化獲取語言環境代碼
- 13. WP在插件代碼中獲取語言環境
- 14. 適用於iPhone的本地化字符串的語言環境代碼
- 15. 困惑的語言環境和編碼
- 16. NSDateFormatter語言環境
- 17. Symfony2語言環境
- 18. swprintf語言環境
- 19. 將語言和國家/地區代碼附加「變體」的語言環境
- 20. 語言文件夾
- 21. java語言環境標記語言環境顯示名稱
- 22. 流浪文件。爲ssh代理設置語言環境
- 23. Facebook Javascript SDK語言環境語言
- 24. Android - 更改語言環境(語言)
- 25. 系統語言環境語言設置
- 26. Android:默認語言環境語言「hd」
- 27. 語言環境語言縮減器
- 28. Android語言環境語言支持
- 29. 從沒有解釋的語言環境生成代碼
- 30. 如何更改下面的代碼,以支持語言環境
其實我看到這個在這裏:HTTP://www.cilinder。 be/docs/next/NeXTStep/3.3/nd/Concepts/Localization.htmld/index.html有趣的。史蒂夫喬布斯的NeXT經驗直到今天真的影響到蘋果! – Moshe 2010-06-14 20:37:45
爲什麼有一些雙打?馬來語,蒙古語,阿塞拜疆語 – slf 2010-06-14 21:19:32
讓我預祝Old Norse被支持 – slf 2010-06-14 21:24:35