1 // 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html#License 3 /* 4 ******************************************************************************* 5 * Copyright (C) 2009-2013, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9 package com.ibm.icu.impl; 10 11 import java.util.MissingResourceException; 12 13 14 /** 15 * Utilities for mapping between old and new language, country, and other 16 * locale ID related names. 17 */ 18 public class LocaleIDs { 19 20 /** 21 * Returns a list of all 2-letter country codes defined in ISO 3166. 22 * Can be used to create Locales. 23 * @stable ICU 3.0 24 */ 25 public static String[] getISOCountries() { 26 return _countries.clone(); 27 } 28 29 /** 30 * Returns a list of all 2-letter language codes defined in ISO 639 31 * plus additional 3-letter codes determined to be useful for locale generation as 32 * defined by Unicode CLDR. 33 * Can be used to create Locales. 34 * [NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. 35 * The list this function returns includes both the new and the old codes for the 36 * languages whose codes have changed.] 37 * @stable ICU 3.0 38 */ 39 public static String[] getISOLanguages() { 40 return _languages.clone(); 41 } 42 43 /** 44 * Returns a three-letter abbreviation for the provided country. If the provided 45 * country is empty, returns the empty string. Otherwise, returns 46 * an uppercase ISO 3166 3-letter country code. 47 * @exception MissingResourceException Throws MissingResourceException if the 48 * three-letter country abbreviation is not available for this locale. 49 * @stable ICU 3.0 50 */ 51 public static String getISO3Country(String country){ 52 53 int offset = findIndex(_countries, country); 54 if(offset>=0){ 55 return _countries3[offset]; 56 }else{ 57 offset = findIndex(_obsoleteCountries, country); 58 if(offset>=0){ 59 return _obsoleteCountries3[offset]; 60 } 61 } 62 return ""; 63 } 64 /** 65 * Returns a three-letter abbreviation for the language. If language is 66 * empty, returns the empty string. Otherwise, returns 67 * a lowercase ISO 639-2/T language code. 68 * The ISO 639-2 language codes can be found on-line at 69 * <a href="ftp://dkuug.dk/i18n/iso-639-2.txt"><code>ftp://dkuug.dk/i18n/iso-639-2.txt</code></a> 70 * @exception MissingResourceException Throws MissingResourceException if the 71 * three-letter language abbreviation is not available for this locale. 72 * @stable ICU 3.0 73 */ 74 public static String getISO3Language(String language) { 75 76 int offset = findIndex(_languages, language); 77 if(offset>=0){ 78 return _languages3[offset]; 79 } else { 80 offset = findIndex(_obsoleteLanguages, language); 81 if (offset >= 0) { 82 return _obsoleteLanguages3[offset]; 83 } 84 } 85 return ""; 86 } 87 88 public static String threeToTwoLetterLanguage(String lang) { 89 90 /* convert 3 character code to 2 character code if possible *CWB*/ 91 int offset = findIndex(_languages3, lang); 92 if (offset >= 0) { 93 return _languages[offset]; 94 } 95 96 offset = findIndex(_obsoleteLanguages3, lang); 97 if (offset >= 0) { 98 return _obsoleteLanguages[offset]; 99 } 100 101 return null; 102 } 103 104 public static String threeToTwoLetterRegion(String region) { 105 106 /* convert 3 character code to 2 character code if possible *CWB*/ 107 int offset = findIndex(_countries3, region); 108 if (offset >= 0) { 109 return _countries[offset]; 110 } 111 112 offset = findIndex(_obsoleteCountries3, region); 113 if (offset >= 0) { 114 return _obsoleteCountries[offset]; 115 } 116 117 return null; 118 } 119 120 /** 121 * linear search of the string array. the arrays are unfortunately ordered by the 122 * two-letter target code, not the three-letter search code, which seems backwards. 123 */ 124 private static int findIndex(String[] array, String target){ 125 for (int i = 0; i < array.length; i++) { 126 if (target.equals(array[i])) { 127 return i; 128 } 129 } 130 return -1; 131 } 132 133 134 /** 135 * Tables used in normalizing portions of the id. 136 */ 137 /* tables updated per http://lcweb.loc.gov/standards/iso639-2/ 138 to include the revisions up to 2001/7/27 *CWB*/ 139 /* The 3 character codes are the terminology codes like RFC 3066. 140 This is compatible with prior ICU codes */ 141 /* "in" "iw" "ji" "jw" & "sh" have been withdrawn but are still in 142 the table but now at the end of the table because 143 3 character codes are duplicates. This avoids bad searches 144 going from 3 to 2 character codes.*/ 145 /* The range qaa-qtz is reserved for local use. */ 146 147 /* This list MUST be in sorted order, and MUST contain the two-letter codes 148 if one exists otherwise use the three letter code */ 149 private static final String[] _languages = { 150 "aa", "ab", "ace", "ach", "ada", "ady", "ae", "af", 151 "afa", "afh", "agq", "ain", "ak", "akk", "ale", "alg", 152 "alt", "am", "an", "ang", "anp", "apa", "ar", "arc", 153 "arn", "arp", "ars", "art", "arw", "as", "asa", "ast", 154 "ath", "aus", "av", "awa", "ay", "az", 155 "ba", "bad", "bai", "bal", "ban", "bas", "bat", "bax", 156 "bbj", "be", "bej", "bem", "ber", "bez", "bfd", "bg", 157 "bh", "bho", "bi", "bik", "bin", "bkm", "bla", "bm", 158 "bn", "bnt", "bo", "br", "bra", "brx", "bs", "bss", 159 "btk", "bua", "bug", "bum", "byn", "byv", 160 "ca", "cad", "cai", "car", "cau", "cay", "cch", "ce", 161 "ceb", "cel", "cgg", "ch", "chb", "chg", "chk", "chm", 162 "chn", "cho", "chp", "chr", "chy", "ckb", "cmc", "co", 163 "cop", "cpe", "cpf", "cpp", "cr", "crh", "crp", "cs", 164 "csb", "cu", "cus", "cv", "cy", 165 "da", "dak", "dar", "dav", "day", "de", "del", "den", 166 "dgr", "din", "dje", "doi", "dra", "dsb", "dua", "dum", 167 "dv", "dyo", "dyu", "dz", "dzg", 168 "ebu", "ee", "efi", "egy", "eka", "el", "elx", "en", 169 "enm", "eo", "es", "et", "eu", "ewo", 170 "fa", "fan", "fat", "ff", "fi", "fil", "fiu", "fj", 171 "fo", "fon", "fr", "frm", "fro", "frr", "frs", "fur", 172 "fy", 173 "ga", "gaa", "gay", "gba", "gd", "gem", "gez", "gil", 174 "gl", "gmh", "gn", "goh", "gon", "gor", "got", "grb", 175 "grc", "gsw", "gu", "guz", "gv", "gwi", 176 "ha", "hai", "haw", "he", "hi", "hil", "him", "hit", 177 "hmn", "ho", "hr", "hsb", "ht", "hu", "hup", "hy", 178 "hz", 179 "ia", "iba", "ibb", "id", "ie", "ig", "ii", "ijo", 180 "ik", "ilo", "inc", "ine", "inh", "io", "ira", "iro", 181 "is", "it", "iu", 182 "ja", "jbo", "jgo", "jmc", "jpr", "jrb", "jv", 183 "ka", "kaa", "kab", "kac", "kaj", "kam", "kar", "kaw", 184 "kbd", "kbl", "kcg", "kde", "kea", "kfo", "kg", "kha", 185 "khi", "kho", "khq", "ki", "kj", "kk", "kkj", "kl", 186 "kln", "km", "kmb", "kn", "ko", "kok", "kos", "kpe", 187 "kr", "krc", "krl", "kro", "kru", "ks", "ksb", "ksf", 188 "ksh", "ku", "kum", "kut", "kv", "kw", "ky", 189 "la", "lad", "lag", "lah", "lam", "lb", "lez", "lg", 190 "li", "lkt", "ln", "lo", "lol", "loz", "lt", "lu", 191 "lua", "lui", "lun", "luo", "lus", "luy", "lv", 192 "mad", "maf", "mag", "mai", "mak", "man", "map", "mas", 193 "mde", "mdf", "mdr", "men", "mer", "mfe", "mg", "mga", 194 "mgh", "mgo", "mh", "mi", "mic", "min", "mis", "mk", 195 "mkh", "ml", "mn", "mnc", "mni", "mno", "mo", "moh", 196 "mos", "mr", "ms", "mt", "mua", "mul", "mun", "mus", 197 "mwl", "mwr", "my", "mye", "myn", "myv", 198 "na", "nah", "nai", "nap", "naq", "nb", "nd", "nds", 199 "ne", "new", "ng", "nia", "nic", "niu", "nl", "nmg", 200 "nn", "nnh", "no", "nog", "non", "nqo", "nr", "nso", 201 "nub", "nus", "nv", "nwc", "ny", "nym", "nyn", "nyo", 202 "nzi", 203 "oc", "oj", "om", "or", "os", "osa", "ota", "oto", 204 "pa", "paa", "pag", "pal", "pam", "pap", "pau", "peo", 205 "phi", "phn", "pi", "pl", "pon", "pra", "pro", "ps", 206 "pt", 207 "qu", 208 "raj", "rap", "rar", "rm", "rn", "ro", "roa", "rof", 209 "rom", "ru", "rup", "rw", "rwk", 210 "sa", "sad", "sah", "sai", "sal", "sam", "saq", "sas", 211 "sat", "sba", "sbp", "sc", "scn", "sco", "sd", "se", 212 "see", "seh", "sel", "sem", "ses", "sg", "sga", "sgn", 213 "shi", "shn", "shu", "si", "sid", "sio", "sit", 214 "sk", "sl", "sla", "sm", "sma", "smi", "smj", "smn", 215 "sms", "sn", "snk", "so", "sog", "son", "sq", "sr", 216 "srn", "srr", "ss", "ssa", "ssy", "st", "su", "suk", 217 "sus", "sux", "sv", "sw", "swb", "swc", "syc", "syr", 218 "ta", "tai", "te", "tem", "teo", "ter", "tet", "tg", 219 "th", "ti", "tig", "tiv", "tk", "tkl", "tl", "tlh", 220 "tli", "tmh", "tn", "to", "tog", "tpi", "tr", "trv", 221 "ts", "tsi", "tt", "tum", "tup", "tut", "tvl", "tw", 222 "twq", "ty", "tyv", "tzm", 223 "udm", "ug", "uga", "uk", "umb", "und", "ur", "uz", 224 "vai", "ve", "vi", "vo", "vot", "vun", 225 "wa", "wae", "wak", "wal", "war", "was", "wen", "wo", 226 "xal", "xh", "xog", 227 "yao", "yap", "yav", "ybb", "yi", "yo", "ypk", "yue", 228 "za", "zap", "zbl", "zen", "zh", "znd", "zu", "zun", 229 "zxx", "zza" }; 230 231 private static final String[] _replacementLanguages = { 232 "id", "he", "yi", "jv", "sr", "nb",/* replacement language codes */ 233 }; 234 235 private static final String[] _obsoleteLanguages = { 236 "in", "iw", "ji", "jw", "sh", "no", /* obsolete language codes */ 237 }; 238 239 /* This list MUST contain a three-letter code for every two-letter code in the 240 list above, and they MUST ne in the same order (i.e., the same language must 241 be in the same place in both lists)! */ 242 private static final String[] _languages3 = { 243 "aar", "abk", "ace", "ach", "ada", "ady", "ave", "afr", 244 "afa", "afh", "agq", "ain", "aka", "akk", "ale", "alg", 245 "alt", "amh", "arg", "ang", "anp", "apa", "ara", "arc", 246 "arn", "arp", "ars", "art", "arw", "asm", "asa", "ast", 247 "ath", "aus", "ava", "awa", "aym", "aze", 248 "bak", "bad", "bai", "bal", "ban", "bas", "bat", "bax", 249 "bbj", "bel", "bej", "bem", "ber", "bez", "bfd", "bul", 250 "bih", "bho", "bis", "bik", "bin", "bkm", "bla", "bam", 251 "ben", "bnt", "bod", "bre", "bra", "brx", "bos", "bss", 252 "btk", "bua", "bug", "bum", "byn", "byv", 253 "cat", "cad", "cai", "car", "cau", "cay", "cch", "che", 254 "ceb", "cel", "cgg", "cha", "chb", "chg", "chk", "chm", 255 "chn", "cho", "chp", "chr", "chy", "ckb", "cmc", "cos", 256 "cop", "cpe", "cpf", "cpp", "cre", "crh", "crp", "ces", 257 "csb", "chu", "cus", "chv", "cym", 258 "dan", "dak", "dar", "dav", "day", "deu", "del", "den", 259 "dgr", "din", "dje", "doi", "dra", "dsb", "dua", "dum", 260 "div", "dyo", "dyu", "dzo", "dzg", 261 "ebu", "ewe", "efi", "egy", "eka", "ell", "elx", "eng", 262 "enm", "epo", "spa", "est", "eus", "ewo", 263 "fas", "fan", "fat", "ful", "fin", "fil", "fiu", "fij", 264 "fao", "fon", "fra", "frm", "fro", "frr", "frs", "fur", 265 "fry", 266 "gle", "gaa", "gay", "gba", "gla", "gem", "gez", "gil", 267 "glg", "gmh", "grn", "goh", "gon", "gor", "got", "grb", 268 "grc", "gsw", "guj", "guz", "glv", "gwi", 269 "hau", "hai", "haw", "heb", "hin", "hil", "him", "hit", 270 "hmn", "hmo", "hrv", "hsb", "hat", "hun", "hup", "hye", 271 "her", 272 "ina", "iba", "ibb", "ind", "ile", "ibo", "iii", "ijo", 273 "ipk", "ilo", "inc", "ine", "inh", "ido", "ira", "iro", 274 "isl", "ita", "iku", 275 "jpn", "jbo", "jgo", "jmc", "jpr", "jrb", "jav", 276 "kat", "kaa", "kab", "kac", "kaj", "kam", "kar", "kaw", 277 "kbd", "kbl", "kcg", "kde", "kea", "kfo", "kon", "kha", 278 "khi", "kho", "khq", "kik", "kua", "kaz", "kkj", "kal", 279 "kln", "khm", "kmb", "kan", "kor", "kok", "kos", "kpe", 280 "kau", "krc", "krl", "kro", "kru", "kas", "ksb", "ksf", 281 "ksh", "kur", "kum", "kut", "kom", "cor", "kir", 282 "lat", "lad", "lag", "lah", "lam", "ltz", "lez", "lug", 283 "lim", "lkt", "lin", "lao", "lol", "loz", "lit", "lub", 284 "lua", "lui", "lun", "luo", "lus", "luy", "lav", 285 "mad", "maf", "mag", "mai", "mak", "man", "map", "mas", 286 "mde", "mdf", "mdr", "men", "mer", "mfe", "mlg", "mga", 287 "mgh", "mgo", "mah", "mri", "mic", "min", "mis", "mkd", 288 "mkh", "mal", "mon", "mnc", "mni", "mno", "mol", "moh", 289 "mos", "mar", "msa", "mlt", "mua", "mul", "mun", "mus", 290 "mwl", "mwr", "mya", "mye", "myn", "myv", 291 "nau", "nah", "nai", "nap", "naq", "nob", "nde", "nds", 292 "nep", "new", "ndo", "nia", "nic", "niu", "nld", "nmg", 293 "nno", "nnh", "nor", "nog", "non", "nqo", "nbl", "nso", 294 "nub", "nus", "nav", "nwc", "nya", "nym", "nyn", "nyo", 295 "nzi", 296 "oci", "oji", "orm", "ori", "oss", "osa", "ota", "oto", 297 "pan", "paa", "pag", "pal", "pam", "pap", "pau", "peo", 298 "phi", "phn", "pli", "pol", "pon", "pra", "pro", "pus", 299 "por", 300 "que", 301 "raj", "rap", "rar", "roh", "run", "ron", "roa", "rof", 302 "rom", "rus", "rup", "kin", "rwk", 303 "san", "sad", "sah", "sai", "sal", "sam", "saq", "sas", 304 "sat", "sba", "sbp", "srd", "scn", "sco", "snd", "sme", 305 "see", "seh", "sel", "sem", "ses", "sag", "sga", "sgn", 306 "shi", "shn", "shu", "sin", "sid", "sio", "sit", 307 "slk", "slv", "sla", "smo", "sma", "smi", "smj", "smn", 308 "sms", "sna", "snk", "som", "sog", "son", "sqi", "srp", 309 "srn", "srr", "ssw", "ssa", "ssy", "sot", "sun", "suk", 310 "sus", "sux", "swe", "swa", "swb", "swc", "syc", "syr", 311 "tam", "tai", "tel", "tem", "teo", "ter", "tet", "tgk", 312 "tha", "tir", "tig", "tiv", "tuk", "tkl", "tgl", "tlh", 313 "tli", "tmh", "tsn", "ton", "tog", "tpi", "tur", "trv", 314 "tso", "tsi", "tat", "tum", "tup", "tut", "tvl", "twi", 315 "twq", "tah", "tyv", "tzm", 316 "udm", "uig", "uga", "ukr", "umb", "und", "urd", "uzb", 317 "vai", "ven", "vie", "vol", "vot", "vun", 318 "wln", "wae", "wak", "wal", "war", "was", "wen", "wol", 319 "xal", "xho", "xog", 320 "yao", "yap", "yav", "ybb", "yid", "yor", "ypk", "yue", 321 "zha", "zap", "zbl", "zen", "zho", "znd", "zul", "zun", 322 "zxx", "zza" }; 323 324 private static final String[] _obsoleteLanguages3 = { 325 /* "in", "iw", "ji", "jw", "sh", */ 326 "ind", "heb", "yid", "jaw", "srp", 327 }; 328 329 /* ZR(ZAR) is now CD(COD) and FX(FXX) is PS(PSE) as per 330 http://www.evertype.com/standards/iso3166/iso3166-1-en.html 331 added new codes keeping the old ones for compatibility 332 updated to include 1999/12/03 revisions *CWB*/ 333 334 /* RO(ROM) is now RO(ROU) according to 335 http://www.iso.org/iso/en/prods-services/iso3166ma/03updates-on-iso-3166/nlv3e-rou.html 336 */ 337 /* This list MUST be in sorted order, and MUST contain only two-letter codes! */ 338 private static final String[] _countries = { 339 "AD", "AE", "AF", "AG", "AI", "AL", "AM", 340 "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", 341 "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", 342 "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", 343 "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", 344 "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", 345 "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", 346 "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", 347 "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", 348 "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", 349 "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", 350 "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", 351 "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", 352 "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", 353 "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", 354 "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", 355 "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", 356 "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", 357 "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", 358 "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", 359 "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", 360 "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", 361 "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", 362 "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", 363 "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", 364 "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", 365 "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", 366 "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", 367 "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", 368 "WS", "YE", "YT", "ZA", "ZM", "ZW" }; 369 370 private static final String[] _deprecatedCountries = { 371 "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR" /* deprecated country list */ 372 }; 373 374 private static final String[] _replacementCountries = { 375 /* "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR" */ 376 "CW", "MM", "RS", "DE", "BJ", "FR", "BF", "VU", "ZW", "RU", "TL", "GB", "VN", "YE", "RS", "CD" /* replacement country codes */ 377 }; 378 379 /* this table is used for three letter codes */ 380 private static final String[] _obsoleteCountries = { 381 "AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR", /* obsolete country codes */ 382 }; 383 384 /* This list MUST contain a three-letter code for every two-letter code in 385 the above list, and they MUST be listed in the same order! */ 386 private static final String[] _countries3 = { 387 /* "AD", "AE", "AF", "AG", "AI", "AL", "AM", */ 388 "AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", 389 /* "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", */ 390 "AGO", "ATA", "ARG", "ASM", "AUT", "AUS", "ABW", "ALA", "AZE", 391 /* "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", */ 392 "BIH", "BRB", "BGD", "BEL", "BFA", "BGR", "BHR", "BDI", 393 /* "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", */ 394 "BEN", "BLM", "BMU", "BRN", "BOL", "BES", "BRA", "BHS", "BTN", "BVT", 395 /* "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", */ 396 "BWA", "BLR", "BLZ", "CAN", "CCK", "COD", "CAF", "COG", 397 /* "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", */ 398 "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI", 399 /* "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", */ 400 "CUB", "CPV", "CUW", "CXR", "CYP", "CZE", "DEU", "DJI", "DNK", 401 /* "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", */ 402 "DMA", "DOM", "DZA", "ECU", "EST", "EGY", "ESH", "ERI", 403 /* "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", */ 404 "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", "FRA", 405 /* "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", */ 406 "GAB", "GBR", "GRD", "GEO", "GUF", "GGY", "GHA", "GIB", "GRL", 407 /* "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", */ 408 "GMB", "GIN", "GLP", "GNQ", "GRC", "SGS", "GTM", "GUM", 409 /* "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", */ 410 "GNB", "GUY", "HKG", "HMD", "HND", "HRV", "HTI", "HUN", 411 /* "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS" */ 412 "IDN", "IRL", "ISR", "IMN", "IND", "IOT", "IRQ", "IRN", "ISL", 413 /* "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", */ 414 "ITA", "JEY", "JAM", "JOR", "JPN", "KEN", "KGZ", "KHM", "KIR", 415 /* "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", */ 416 "COM", "KNA", "PRK", "KOR", "KWT", "CYM", "KAZ", "LAO", 417 /* "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", */ 418 "LBN", "LCA", "LIE", "LKA", "LBR", "LSO", "LTU", "LUX", 419 /* "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", */ 420 "LVA", "LBY", "MAR", "MCO", "MDA", "MNE", "MAF", "MDG", "MHL", "MKD", 421 /* "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", */ 422 "MLI", "MMR", "MNG", "MAC", "MNP", "MTQ", "MRT", "MSR", 423 /* "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", */ 424 "MLT", "MUS", "MDV", "MWI", "MEX", "MYS", "MOZ", "NAM", 425 /* "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", */ 426 "NCL", "NER", "NFK", "NGA", "NIC", "NLD", "NOR", "NPL", 427 /* "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", */ 428 "NRU", "NIU", "NZL", "OMN", "PAN", "PER", "PYF", "PNG", 429 /* "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", */ 430 "PHL", "PAK", "POL", "SPM", "PCN", "PRI", "PSE", "PRT", 431 /* "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", */ 432 "PLW", "PRY", "QAT", "REU", "ROU", "SRB", "RUS", "RWA", "SAU", 433 /* "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", */ 434 "SLB", "SYC", "SDN", "SWE", "SGP", "SHN", "SVN", "SJM", 435 /* "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", */ 436 "SVK", "SLE", "SMR", "SEN", "SOM", "SUR", "SSD", "STP", "SLV", 437 /* "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", */ 438 "SXM", "SYR", "SWZ", "TCA", "TCD", "ATF", "TGO", "THA", "TJK", 439 /* "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", */ 440 "TKL", "TLS", "TKM", "TUN", "TON", "TUR", "TTO", "TUV", 441 /* "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", */ 442 "TWN", "TZA", "UKR", "UGA", "UMI", "USA", "URY", "UZB", 443 /* "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", */ 444 "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", 445 /* "WS", "YE", "YT", "ZA", "ZM", "ZW", */ 446 "WSM", "YEM", "MYT", "ZAF", "ZMB", "ZWE" }; 447 448 private static final String[] _obsoleteCountries3 = { 449 /* "AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR" */ 450 "ANT", "BUR", "SCG", "FXX", "ROM", "SUN", "TMP", "YMD", "YUG", "ZAR", 451 }; 452 453 454 public static String getCurrentCountryID(String oldID){ 455 int offset = findIndex(_deprecatedCountries, oldID); 456 if (offset >= 0) { 457 return _replacementCountries[offset]; 458 } 459 return oldID; 460 } 461 462 public static String getCurrentLanguageID(String oldID){ 463 int offset = findIndex(_obsoleteLanguages, oldID); 464 if (offset >= 0) { 465 return _replacementLanguages[offset]; 466 } 467 return oldID; 468 } 469 470 471 } 472