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