// Auto-generated by `tools/gen-locales.mjs`.
// Sources:
//   data/registry/registry.json   - IANA Language Subtag Registry (mattcg mirror)
//   data/ms-store-locales.csv     - Microsoft Store supported BCP-47 tags
// Re-run the generator after refreshing either file.
//
// Regions: 259    Languages: 185    Store tags: 350

use std::str::FromStr;

/// A Microsoft Store market, identified by an ISO 3166-1 alpha-2 region subtag.
///
/// Auto-generated by `tools/gen-locales.mjs` — do not edit by hand.
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Market {
    Ac,
    Ad,
    Ae,
    Af,
    Ag,
    Ai,
    Al,
    Am,
    Ao,
    Aq,
    Ar,
    As,
    At,
    Au,
    Aw,
    Ax,
    Az,
    Ba,
    Bb,
    Bd,
    Be,
    Bf,
    Bg,
    Bh,
    Bi,
    Bj,
    Bl,
    Bm,
    Bn,
    Bo,
    Bq,
    Br,
    Bs,
    Bt,
    Bv,
    Bw,
    By,
    Bz,
    Ca,
    Cc,
    Cd,
    Cf,
    Cg,
    Ch,
    Ci,
    Ck,
    Cl,
    Cm,
    Cn,
    Co,
    Cp,
    Cq,
    Cr,
    Cu,
    Cv,
    Cw,
    Cx,
    Cy,
    Cz,
    De,
    Dg,
    Dj,
    Dk,
    Dm,
    Do,
    Dz,
    Ea,
    Ec,
    Ee,
    Eg,
    Eh,
    Er,
    Es,
    Et,
    Eu,
    Ez,
    Fi,
    Fj,
    Fk,
    Fm,
    Fo,
    Fr,
    Ga,
    Gb,
    Gd,
    Ge,
    Gf,
    Gg,
    Gh,
    Gi,
    Gl,
    Gm,
    Gn,
    Gp,
    Gq,
    Gr,
    Gs,
    Gt,
    Gu,
    Gw,
    Gy,
    Hk,
    Hm,
    Hn,
    Hr,
    Ht,
    Hu,
    Ic,
    Id,
    Ie,
    Il,
    Im,
    In,
    Io,
    Iq,
    Ir,
    Is,
    It,
    Je,
    Jm,
    Jo,
    Jp,
    Ke,
    Kg,
    Kh,
    Ki,
    Km,
    Kn,
    Kp,
    Kr,
    Kw,
    Ky,
    Kz,
    La,
    Lb,
    Lc,
    Li,
    Lk,
    Lr,
    Ls,
    Lt,
    Lu,
    Lv,
    Ly,
    Ma,
    Mc,
    Md,
    Me,
    Mf,
    Mg,
    Mh,
    Mk,
    Ml,
    Mm,
    Mn,
    Mo,
    Mp,
    Mq,
    Mr,
    Ms,
    Mt,
    Mu,
    Mv,
    Mw,
    Mx,
    My,
    Mz,
    Na,
    Nc,
    Ne,
    Nf,
    Ng,
    Ni,
    Nl,
    No,
    Np,
    Nr,
    Nu,
    Nz,
    Om,
    Pa,
    Pe,
    Pf,
    Pg,
    Ph,
    Pk,
    Pl,
    Pm,
    Pn,
    Pr,
    Ps,
    Pt,
    Pw,
    Py,
    Qa,
    Re,
    Ro,
    Rs,
    Ru,
    Rw,
    Sa,
    Sb,
    Sc,
    Sd,
    Se,
    Sg,
    Sh,
    Si,
    Sj,
    Sk,
    Sl,
    Sm,
    Sn,
    So,
    Sr,
    Ss,
    St,
    Sv,
    Sx,
    Sy,
    Sz,
    Ta,
    Tc,
    Td,
    Tf,
    Tg,
    Th,
    Tj,
    Tk,
    Tl,
    Tm,
    Tn,
    To,
    Tr,
    Tt,
    Tv,
    Tw,
    Tz,
    Ua,
    Ug,
    Um,
    Un,
    Us,
    Uy,
    Uz,
    Va,
    Vc,
    Ve,
    Vg,
    Vi,
    Vn,
    Vu,
    Wf,
    Ws,
    Ye,
    Yt,
    Za,
    Zm,
    Zw,
}

impl Market {
    /// Returns the canonical code string.
    pub fn as_str(&self) -> &'static str {
        match self {
            Market::Ac => "AC",
            Market::Ad => "AD",
            Market::Ae => "AE",
            Market::Af => "AF",
            Market::Ag => "AG",
            Market::Ai => "AI",
            Market::Al => "AL",
            Market::Am => "AM",
            Market::Ao => "AO",
            Market::Aq => "AQ",
            Market::Ar => "AR",
            Market::As => "AS",
            Market::At => "AT",
            Market::Au => "AU",
            Market::Aw => "AW",
            Market::Ax => "AX",
            Market::Az => "AZ",
            Market::Ba => "BA",
            Market::Bb => "BB",
            Market::Bd => "BD",
            Market::Be => "BE",
            Market::Bf => "BF",
            Market::Bg => "BG",
            Market::Bh => "BH",
            Market::Bi => "BI",
            Market::Bj => "BJ",
            Market::Bl => "BL",
            Market::Bm => "BM",
            Market::Bn => "BN",
            Market::Bo => "BO",
            Market::Bq => "BQ",
            Market::Br => "BR",
            Market::Bs => "BS",
            Market::Bt => "BT",
            Market::Bv => "BV",
            Market::Bw => "BW",
            Market::By => "BY",
            Market::Bz => "BZ",
            Market::Ca => "CA",
            Market::Cc => "CC",
            Market::Cd => "CD",
            Market::Cf => "CF",
            Market::Cg => "CG",
            Market::Ch => "CH",
            Market::Ci => "CI",
            Market::Ck => "CK",
            Market::Cl => "CL",
            Market::Cm => "CM",
            Market::Cn => "CN",
            Market::Co => "CO",
            Market::Cp => "CP",
            Market::Cq => "CQ",
            Market::Cr => "CR",
            Market::Cu => "CU",
            Market::Cv => "CV",
            Market::Cw => "CW",
            Market::Cx => "CX",
            Market::Cy => "CY",
            Market::Cz => "CZ",
            Market::De => "DE",
            Market::Dg => "DG",
            Market::Dj => "DJ",
            Market::Dk => "DK",
            Market::Dm => "DM",
            Market::Do => "DO",
            Market::Dz => "DZ",
            Market::Ea => "EA",
            Market::Ec => "EC",
            Market::Ee => "EE",
            Market::Eg => "EG",
            Market::Eh => "EH",
            Market::Er => "ER",
            Market::Es => "ES",
            Market::Et => "ET",
            Market::Eu => "EU",
            Market::Ez => "EZ",
            Market::Fi => "FI",
            Market::Fj => "FJ",
            Market::Fk => "FK",
            Market::Fm => "FM",
            Market::Fo => "FO",
            Market::Fr => "FR",
            Market::Ga => "GA",
            Market::Gb => "GB",
            Market::Gd => "GD",
            Market::Ge => "GE",
            Market::Gf => "GF",
            Market::Gg => "GG",
            Market::Gh => "GH",
            Market::Gi => "GI",
            Market::Gl => "GL",
            Market::Gm => "GM",
            Market::Gn => "GN",
            Market::Gp => "GP",
            Market::Gq => "GQ",
            Market::Gr => "GR",
            Market::Gs => "GS",
            Market::Gt => "GT",
            Market::Gu => "GU",
            Market::Gw => "GW",
            Market::Gy => "GY",
            Market::Hk => "HK",
            Market::Hm => "HM",
            Market::Hn => "HN",
            Market::Hr => "HR",
            Market::Ht => "HT",
            Market::Hu => "HU",
            Market::Ic => "IC",
            Market::Id => "ID",
            Market::Ie => "IE",
            Market::Il => "IL",
            Market::Im => "IM",
            Market::In => "IN",
            Market::Io => "IO",
            Market::Iq => "IQ",
            Market::Ir => "IR",
            Market::Is => "IS",
            Market::It => "IT",
            Market::Je => "JE",
            Market::Jm => "JM",
            Market::Jo => "JO",
            Market::Jp => "JP",
            Market::Ke => "KE",
            Market::Kg => "KG",
            Market::Kh => "KH",
            Market::Ki => "KI",
            Market::Km => "KM",
            Market::Kn => "KN",
            Market::Kp => "KP",
            Market::Kr => "KR",
            Market::Kw => "KW",
            Market::Ky => "KY",
            Market::Kz => "KZ",
            Market::La => "LA",
            Market::Lb => "LB",
            Market::Lc => "LC",
            Market::Li => "LI",
            Market::Lk => "LK",
            Market::Lr => "LR",
            Market::Ls => "LS",
            Market::Lt => "LT",
            Market::Lu => "LU",
            Market::Lv => "LV",
            Market::Ly => "LY",
            Market::Ma => "MA",
            Market::Mc => "MC",
            Market::Md => "MD",
            Market::Me => "ME",
            Market::Mf => "MF",
            Market::Mg => "MG",
            Market::Mh => "MH",
            Market::Mk => "MK",
            Market::Ml => "ML",
            Market::Mm => "MM",
            Market::Mn => "MN",
            Market::Mo => "MO",
            Market::Mp => "MP",
            Market::Mq => "MQ",
            Market::Mr => "MR",
            Market::Ms => "MS",
            Market::Mt => "MT",
            Market::Mu => "MU",
            Market::Mv => "MV",
            Market::Mw => "MW",
            Market::Mx => "MX",
            Market::My => "MY",
            Market::Mz => "MZ",
            Market::Na => "NA",
            Market::Nc => "NC",
            Market::Ne => "NE",
            Market::Nf => "NF",
            Market::Ng => "NG",
            Market::Ni => "NI",
            Market::Nl => "NL",
            Market::No => "NO",
            Market::Np => "NP",
            Market::Nr => "NR",
            Market::Nu => "NU",
            Market::Nz => "NZ",
            Market::Om => "OM",
            Market::Pa => "PA",
            Market::Pe => "PE",
            Market::Pf => "PF",
            Market::Pg => "PG",
            Market::Ph => "PH",
            Market::Pk => "PK",
            Market::Pl => "PL",
            Market::Pm => "PM",
            Market::Pn => "PN",
            Market::Pr => "PR",
            Market::Ps => "PS",
            Market::Pt => "PT",
            Market::Pw => "PW",
            Market::Py => "PY",
            Market::Qa => "QA",
            Market::Re => "RE",
            Market::Ro => "RO",
            Market::Rs => "RS",
            Market::Ru => "RU",
            Market::Rw => "RW",
            Market::Sa => "SA",
            Market::Sb => "SB",
            Market::Sc => "SC",
            Market::Sd => "SD",
            Market::Se => "SE",
            Market::Sg => "SG",
            Market::Sh => "SH",
            Market::Si => "SI",
            Market::Sj => "SJ",
            Market::Sk => "SK",
            Market::Sl => "SL",
            Market::Sm => "SM",
            Market::Sn => "SN",
            Market::So => "SO",
            Market::Sr => "SR",
            Market::Ss => "SS",
            Market::St => "ST",
            Market::Sv => "SV",
            Market::Sx => "SX",
            Market::Sy => "SY",
            Market::Sz => "SZ",
            Market::Ta => "TA",
            Market::Tc => "TC",
            Market::Td => "TD",
            Market::Tf => "TF",
            Market::Tg => "TG",
            Market::Th => "TH",
            Market::Tj => "TJ",
            Market::Tk => "TK",
            Market::Tl => "TL",
            Market::Tm => "TM",
            Market::Tn => "TN",
            Market::To => "TO",
            Market::Tr => "TR",
            Market::Tt => "TT",
            Market::Tv => "TV",
            Market::Tw => "TW",
            Market::Tz => "TZ",
            Market::Ua => "UA",
            Market::Ug => "UG",
            Market::Um => "UM",
            Market::Un => "UN",
            Market::Us => "US",
            Market::Uy => "UY",
            Market::Uz => "UZ",
            Market::Va => "VA",
            Market::Vc => "VC",
            Market::Ve => "VE",
            Market::Vg => "VG",
            Market::Vi => "VI",
            Market::Vn => "VN",
            Market::Vu => "VU",
            Market::Wf => "WF",
            Market::Ws => "WS",
            Market::Ye => "YE",
            Market::Yt => "YT",
            Market::Za => "ZA",
            Market::Zm => "ZM",
            Market::Zw => "ZW",
        }
    }

    /// Returns the English name from the registry.
    pub fn english_name(&self) -> &'static str {
        match self {
            Market::Ac => "Ascension Island",
            Market::Ad => "Andorra",
            Market::Ae => "United Arab Emirates",
            Market::Af => "Afghanistan",
            Market::Ag => "Antigua and Barbuda",
            Market::Ai => "Anguilla",
            Market::Al => "Albania",
            Market::Am => "Armenia",
            Market::Ao => "Angola",
            Market::Aq => "Antarctica",
            Market::Ar => "Argentina",
            Market::As => "American Samoa",
            Market::At => "Austria",
            Market::Au => "Australia",
            Market::Aw => "Aruba",
            Market::Ax => "Åland Islands",
            Market::Az => "Azerbaijan",
            Market::Ba => "Bosnia and Herzegovina",
            Market::Bb => "Barbados",
            Market::Bd => "Bangladesh",
            Market::Be => "Belgium",
            Market::Bf => "Burkina Faso",
            Market::Bg => "Bulgaria",
            Market::Bh => "Bahrain",
            Market::Bi => "Burundi",
            Market::Bj => "Benin",
            Market::Bl => "Saint Barthélemy",
            Market::Bm => "Bermuda",
            Market::Bn => "Brunei Darussalam",
            Market::Bo => "Bolivia",
            Market::Bq => "Bonaire, Sint Eustatius and Saba",
            Market::Br => "Brazil",
            Market::Bs => "Bahamas",
            Market::Bt => "Bhutan",
            Market::Bv => "Bouvet Island",
            Market::Bw => "Botswana",
            Market::By => "Belarus",
            Market::Bz => "Belize",
            Market::Ca => "Canada",
            Market::Cc => "Cocos (Keeling) Islands",
            Market::Cd => "The Democratic Republic of the Congo",
            Market::Cf => "Central African Republic",
            Market::Cg => "Congo",
            Market::Ch => "Switzerland",
            Market::Ci => "Côte d'Ivoire",
            Market::Ck => "Cook Islands",
            Market::Cl => "Chile",
            Market::Cm => "Cameroon",
            Market::Cn => "China",
            Market::Co => "Colombia",
            Market::Cp => "Clipperton Island",
            Market::Cq => "Sark",
            Market::Cr => "Costa Rica",
            Market::Cu => "Cuba",
            Market::Cv => "Cabo Verde",
            Market::Cw => "Curaçao",
            Market::Cx => "Christmas Island",
            Market::Cy => "Cyprus",
            Market::Cz => "Czechia",
            Market::De => "Germany",
            Market::Dg => "Diego Garcia",
            Market::Dj => "Djibouti",
            Market::Dk => "Denmark",
            Market::Dm => "Dominica",
            Market::Do => "Dominican Republic",
            Market::Dz => "Algeria",
            Market::Ea => "Ceuta, Melilla",
            Market::Ec => "Ecuador",
            Market::Ee => "Estonia",
            Market::Eg => "Egypt",
            Market::Eh => "Western Sahara",
            Market::Er => "Eritrea",
            Market::Es => "Spain",
            Market::Et => "Ethiopia",
            Market::Eu => "European Union",
            Market::Ez => "Eurozone",
            Market::Fi => "Finland",
            Market::Fj => "Fiji",
            Market::Fk => "Falkland Islands (Malvinas)",
            Market::Fm => "Federated States of Micronesia",
            Market::Fo => "Faroe Islands",
            Market::Fr => "France",
            Market::Ga => "Gabon",
            Market::Gb => "United Kingdom",
            Market::Gd => "Grenada",
            Market::Ge => "Georgia",
            Market::Gf => "French Guiana",
            Market::Gg => "Guernsey",
            Market::Gh => "Ghana",
            Market::Gi => "Gibraltar",
            Market::Gl => "Greenland",
            Market::Gm => "Gambia",
            Market::Gn => "Guinea",
            Market::Gp => "Guadeloupe",
            Market::Gq => "Equatorial Guinea",
            Market::Gr => "Greece",
            Market::Gs => "South Georgia and the South Sandwich Islands",
            Market::Gt => "Guatemala",
            Market::Gu => "Guam",
            Market::Gw => "Guinea-Bissau",
            Market::Gy => "Guyana",
            Market::Hk => "Hong Kong",
            Market::Hm => "Heard Island and McDonald Islands",
            Market::Hn => "Honduras",
            Market::Hr => "Croatia",
            Market::Ht => "Haiti",
            Market::Hu => "Hungary",
            Market::Ic => "Canary Islands",
            Market::Id => "Indonesia",
            Market::Ie => "Ireland",
            Market::Il => "Israel",
            Market::Im => "Isle of Man",
            Market::In => "India",
            Market::Io => "British Indian Ocean Territory",
            Market::Iq => "Iraq",
            Market::Ir => "Islamic Republic of Iran",
            Market::Is => "Iceland",
            Market::It => "Italy",
            Market::Je => "Jersey",
            Market::Jm => "Jamaica",
            Market::Jo => "Jordan",
            Market::Jp => "Japan",
            Market::Ke => "Kenya",
            Market::Kg => "Kyrgyzstan",
            Market::Kh => "Cambodia",
            Market::Ki => "Kiribati",
            Market::Km => "Comoros",
            Market::Kn => "Saint Kitts and Nevis",
            Market::Kp => "Democratic People's Republic of Korea",
            Market::Kr => "Republic of Korea",
            Market::Kw => "Kuwait",
            Market::Ky => "Cayman Islands",
            Market::Kz => "Kazakhstan",
            Market::La => "Lao People's Democratic Republic",
            Market::Lb => "Lebanon",
            Market::Lc => "Saint Lucia",
            Market::Li => "Liechtenstein",
            Market::Lk => "Sri Lanka",
            Market::Lr => "Liberia",
            Market::Ls => "Lesotho",
            Market::Lt => "Lithuania",
            Market::Lu => "Luxembourg",
            Market::Lv => "Latvia",
            Market::Ly => "Libya",
            Market::Ma => "Morocco",
            Market::Mc => "Monaco",
            Market::Md => "Moldova",
            Market::Me => "Montenegro",
            Market::Mf => "Saint Martin (French part)",
            Market::Mg => "Madagascar",
            Market::Mh => "Marshall Islands",
            Market::Mk => "North Macedonia",
            Market::Ml => "Mali",
            Market::Mm => "Myanmar",
            Market::Mn => "Mongolia",
            Market::Mo => "Macao",
            Market::Mp => "Northern Mariana Islands",
            Market::Mq => "Martinique",
            Market::Mr => "Mauritania",
            Market::Ms => "Montserrat",
            Market::Mt => "Malta",
            Market::Mu => "Mauritius",
            Market::Mv => "Maldives",
            Market::Mw => "Malawi",
            Market::Mx => "Mexico",
            Market::My => "Malaysia",
            Market::Mz => "Mozambique",
            Market::Na => "Namibia",
            Market::Nc => "New Caledonia",
            Market::Ne => "Niger",
            Market::Nf => "Norfolk Island",
            Market::Ng => "Nigeria",
            Market::Ni => "Nicaragua",
            Market::Nl => "Netherlands",
            Market::No => "Norway",
            Market::Np => "Nepal",
            Market::Nr => "Nauru",
            Market::Nu => "Niue",
            Market::Nz => "New Zealand",
            Market::Om => "Oman",
            Market::Pa => "Panama",
            Market::Pe => "Peru",
            Market::Pf => "French Polynesia",
            Market::Pg => "Papua New Guinea",
            Market::Ph => "Philippines",
            Market::Pk => "Pakistan",
            Market::Pl => "Poland",
            Market::Pm => "Saint Pierre and Miquelon",
            Market::Pn => "Pitcairn",
            Market::Pr => "Puerto Rico",
            Market::Ps => "State of Palestine",
            Market::Pt => "Portugal",
            Market::Pw => "Palau",
            Market::Py => "Paraguay",
            Market::Qa => "Qatar",
            Market::Re => "Réunion",
            Market::Ro => "Romania",
            Market::Rs => "Serbia",
            Market::Ru => "Russian Federation",
            Market::Rw => "Rwanda",
            Market::Sa => "Saudi Arabia",
            Market::Sb => "Solomon Islands",
            Market::Sc => "Seychelles",
            Market::Sd => "Sudan",
            Market::Se => "Sweden",
            Market::Sg => "Singapore",
            Market::Sh => "Saint Helena, Ascension and Tristan da Cunha",
            Market::Si => "Slovenia",
            Market::Sj => "Svalbard and Jan Mayen",
            Market::Sk => "Slovakia",
            Market::Sl => "Sierra Leone",
            Market::Sm => "San Marino",
            Market::Sn => "Senegal",
            Market::So => "Somalia",
            Market::Sr => "Suriname",
            Market::Ss => "South Sudan",
            Market::St => "Sao Tome and Principe",
            Market::Sv => "El Salvador",
            Market::Sx => "Sint Maarten (Dutch part)",
            Market::Sy => "Syrian Arab Republic",
            Market::Sz => "Eswatini",
            Market::Ta => "Tristan da Cunha",
            Market::Tc => "Turks and Caicos Islands",
            Market::Td => "Chad",
            Market::Tf => "French Southern Territories",
            Market::Tg => "Togo",
            Market::Th => "Thailand",
            Market::Tj => "Tajikistan",
            Market::Tk => "Tokelau",
            Market::Tl => "Timor-Leste",
            Market::Tm => "Turkmenistan",
            Market::Tn => "Tunisia",
            Market::To => "Tonga",
            Market::Tr => "Türkiye",
            Market::Tt => "Trinidad and Tobago",
            Market::Tv => "Tuvalu",
            Market::Tw => "Taiwan, Province of China",
            Market::Tz => "United Republic of Tanzania",
            Market::Ua => "Ukraine",
            Market::Ug => "Uganda",
            Market::Um => "United States Minor Outlying Islands",
            Market::Un => "United Nations",
            Market::Us => "United States",
            Market::Uy => "Uruguay",
            Market::Uz => "Uzbekistan",
            Market::Va => "Holy See (Vatican City State)",
            Market::Vc => "Saint Vincent and the Grenadines",
            Market::Ve => "Venezuela",
            Market::Vg => "British Virgin Islands",
            Market::Vi => "U.S. Virgin Islands",
            Market::Vn => "Viet Nam",
            Market::Vu => "Vanuatu",
            Market::Wf => "Wallis and Futuna",
            Market::Ws => "Samoa",
            Market::Ye => "Yemen",
            Market::Yt => "Mayotte",
            Market::Za => "South Africa",
            Market::Zm => "Zambia",
            Market::Zw => "Zimbabwe",
        }
    }

    /// Iterates over every variant in code order.
    pub fn all() -> &'static [Market] {
        &[Market::Ac, Market::Ad, Market::Ae, Market::Af, Market::Ag, Market::Ai, Market::Al, Market::Am, Market::Ao, Market::Aq, Market::Ar, Market::As, Market::At, Market::Au, Market::Aw, Market::Ax, Market::Az, Market::Ba, Market::Bb, Market::Bd, Market::Be, Market::Bf, Market::Bg, Market::Bh, Market::Bi, Market::Bj, Market::Bl, Market::Bm, Market::Bn, Market::Bo, Market::Bq, Market::Br, Market::Bs, Market::Bt, Market::Bv, Market::Bw, Market::By, Market::Bz, Market::Ca, Market::Cc, Market::Cd, Market::Cf, Market::Cg, Market::Ch, Market::Ci, Market::Ck, Market::Cl, Market::Cm, Market::Cn, Market::Co, Market::Cp, Market::Cq, Market::Cr, Market::Cu, Market::Cv, Market::Cw, Market::Cx, Market::Cy, Market::Cz, Market::De, Market::Dg, Market::Dj, Market::Dk, Market::Dm, Market::Do, Market::Dz, Market::Ea, Market::Ec, Market::Ee, Market::Eg, Market::Eh, Market::Er, Market::Es, Market::Et, Market::Eu, Market::Ez, Market::Fi, Market::Fj, Market::Fk, Market::Fm, Market::Fo, Market::Fr, Market::Ga, Market::Gb, Market::Gd, Market::Ge, Market::Gf, Market::Gg, Market::Gh, Market::Gi, Market::Gl, Market::Gm, Market::Gn, Market::Gp, Market::Gq, Market::Gr, Market::Gs, Market::Gt, Market::Gu, Market::Gw, Market::Gy, Market::Hk, Market::Hm, Market::Hn, Market::Hr, Market::Ht, Market::Hu, Market::Ic, Market::Id, Market::Ie, Market::Il, Market::Im, Market::In, Market::Io, Market::Iq, Market::Ir, Market::Is, Market::It, Market::Je, Market::Jm, Market::Jo, Market::Jp, Market::Ke, Market::Kg, Market::Kh, Market::Ki, Market::Km, Market::Kn, Market::Kp, Market::Kr, Market::Kw, Market::Ky, Market::Kz, Market::La, Market::Lb, Market::Lc, Market::Li, Market::Lk, Market::Lr, Market::Ls, Market::Lt, Market::Lu, Market::Lv, Market::Ly, Market::Ma, Market::Mc, Market::Md, Market::Me, Market::Mf, Market::Mg, Market::Mh, Market::Mk, Market::Ml, Market::Mm, Market::Mn, Market::Mo, Market::Mp, Market::Mq, Market::Mr, Market::Ms, Market::Mt, Market::Mu, Market::Mv, Market::Mw, Market::Mx, Market::My, Market::Mz, Market::Na, Market::Nc, Market::Ne, Market::Nf, Market::Ng, Market::Ni, Market::Nl, Market::No, Market::Np, Market::Nr, Market::Nu, Market::Nz, Market::Om, Market::Pa, Market::Pe, Market::Pf, Market::Pg, Market::Ph, Market::Pk, Market::Pl, Market::Pm, Market::Pn, Market::Pr, Market::Ps, Market::Pt, Market::Pw, Market::Py, Market::Qa, Market::Re, Market::Ro, Market::Rs, Market::Ru, Market::Rw, Market::Sa, Market::Sb, Market::Sc, Market::Sd, Market::Se, Market::Sg, Market::Sh, Market::Si, Market::Sj, Market::Sk, Market::Sl, Market::Sm, Market::Sn, Market::So, Market::Sr, Market::Ss, Market::St, Market::Sv, Market::Sx, Market::Sy, Market::Sz, Market::Ta, Market::Tc, Market::Td, Market::Tf, Market::Tg, Market::Th, Market::Tj, Market::Tk, Market::Tl, Market::Tm, Market::Tn, Market::To, Market::Tr, Market::Tt, Market::Tv, Market::Tw, Market::Tz, Market::Ua, Market::Ug, Market::Um, Market::Un, Market::Us, Market::Uy, Market::Uz, Market::Va, Market::Vc, Market::Ve, Market::Vg, Market::Vi, Market::Vn, Market::Vu, Market::Wf, Market::Ws, Market::Ye, Market::Yt, Market::Za, Market::Zm, Market::Zw]
    }
}

impl FromStr for Market {
    type Err = String;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_ascii_lowercase().as_str() {
            "ac" => Ok(Market::Ac),
            "ad" => Ok(Market::Ad),
            "ae" => Ok(Market::Ae),
            "af" => Ok(Market::Af),
            "ag" => Ok(Market::Ag),
            "ai" => Ok(Market::Ai),
            "al" => Ok(Market::Al),
            "am" => Ok(Market::Am),
            "ao" => Ok(Market::Ao),
            "aq" => Ok(Market::Aq),
            "ar" => Ok(Market::Ar),
            "as" => Ok(Market::As),
            "at" => Ok(Market::At),
            "au" => Ok(Market::Au),
            "aw" => Ok(Market::Aw),
            "ax" => Ok(Market::Ax),
            "az" => Ok(Market::Az),
            "ba" => Ok(Market::Ba),
            "bb" => Ok(Market::Bb),
            "bd" => Ok(Market::Bd),
            "be" => Ok(Market::Be),
            "bf" => Ok(Market::Bf),
            "bg" => Ok(Market::Bg),
            "bh" => Ok(Market::Bh),
            "bi" => Ok(Market::Bi),
            "bj" => Ok(Market::Bj),
            "bl" => Ok(Market::Bl),
            "bm" => Ok(Market::Bm),
            "bn" => Ok(Market::Bn),
            "bo" => Ok(Market::Bo),
            "bq" => Ok(Market::Bq),
            "br" => Ok(Market::Br),
            "bs" => Ok(Market::Bs),
            "bt" => Ok(Market::Bt),
            "bv" => Ok(Market::Bv),
            "bw" => Ok(Market::Bw),
            "by" => Ok(Market::By),
            "bz" => Ok(Market::Bz),
            "ca" => Ok(Market::Ca),
            "cc" => Ok(Market::Cc),
            "cd" => Ok(Market::Cd),
            "cf" => Ok(Market::Cf),
            "cg" => Ok(Market::Cg),
            "ch" => Ok(Market::Ch),
            "ci" => Ok(Market::Ci),
            "ck" => Ok(Market::Ck),
            "cl" => Ok(Market::Cl),
            "cm" => Ok(Market::Cm),
            "cn" => Ok(Market::Cn),
            "co" => Ok(Market::Co),
            "cp" => Ok(Market::Cp),
            "cq" => Ok(Market::Cq),
            "cr" => Ok(Market::Cr),
            "cu" => Ok(Market::Cu),
            "cv" => Ok(Market::Cv),
            "cw" => Ok(Market::Cw),
            "cx" => Ok(Market::Cx),
            "cy" => Ok(Market::Cy),
            "cz" => Ok(Market::Cz),
            "de" => Ok(Market::De),
            "dg" => Ok(Market::Dg),
            "dj" => Ok(Market::Dj),
            "dk" => Ok(Market::Dk),
            "dm" => Ok(Market::Dm),
            "do" => Ok(Market::Do),
            "dz" => Ok(Market::Dz),
            "ea" => Ok(Market::Ea),
            "ec" => Ok(Market::Ec),
            "ee" => Ok(Market::Ee),
            "eg" => Ok(Market::Eg),
            "eh" => Ok(Market::Eh),
            "er" => Ok(Market::Er),
            "es" => Ok(Market::Es),
            "et" => Ok(Market::Et),
            "eu" => Ok(Market::Eu),
            "ez" => Ok(Market::Ez),
            "fi" => Ok(Market::Fi),
            "fj" => Ok(Market::Fj),
            "fk" => Ok(Market::Fk),
            "fm" => Ok(Market::Fm),
            "fo" => Ok(Market::Fo),
            "fr" => Ok(Market::Fr),
            "ga" => Ok(Market::Ga),
            "gb" => Ok(Market::Gb),
            "gd" => Ok(Market::Gd),
            "ge" => Ok(Market::Ge),
            "gf" => Ok(Market::Gf),
            "gg" => Ok(Market::Gg),
            "gh" => Ok(Market::Gh),
            "gi" => Ok(Market::Gi),
            "gl" => Ok(Market::Gl),
            "gm" => Ok(Market::Gm),
            "gn" => Ok(Market::Gn),
            "gp" => Ok(Market::Gp),
            "gq" => Ok(Market::Gq),
            "gr" => Ok(Market::Gr),
            "gs" => Ok(Market::Gs),
            "gt" => Ok(Market::Gt),
            "gu" => Ok(Market::Gu),
            "gw" => Ok(Market::Gw),
            "gy" => Ok(Market::Gy),
            "hk" => Ok(Market::Hk),
            "hm" => Ok(Market::Hm),
            "hn" => Ok(Market::Hn),
            "hr" => Ok(Market::Hr),
            "ht" => Ok(Market::Ht),
            "hu" => Ok(Market::Hu),
            "ic" => Ok(Market::Ic),
            "id" => Ok(Market::Id),
            "ie" => Ok(Market::Ie),
            "il" => Ok(Market::Il),
            "im" => Ok(Market::Im),
            "in" => Ok(Market::In),
            "io" => Ok(Market::Io),
            "iq" => Ok(Market::Iq),
            "ir" => Ok(Market::Ir),
            "is" => Ok(Market::Is),
            "it" => Ok(Market::It),
            "je" => Ok(Market::Je),
            "jm" => Ok(Market::Jm),
            "jo" => Ok(Market::Jo),
            "jp" => Ok(Market::Jp),
            "ke" => Ok(Market::Ke),
            "kg" => Ok(Market::Kg),
            "kh" => Ok(Market::Kh),
            "ki" => Ok(Market::Ki),
            "km" => Ok(Market::Km),
            "kn" => Ok(Market::Kn),
            "kp" => Ok(Market::Kp),
            "kr" => Ok(Market::Kr),
            "kw" => Ok(Market::Kw),
            "ky" => Ok(Market::Ky),
            "kz" => Ok(Market::Kz),
            "la" => Ok(Market::La),
            "lb" => Ok(Market::Lb),
            "lc" => Ok(Market::Lc),
            "li" => Ok(Market::Li),
            "lk" => Ok(Market::Lk),
            "lr" => Ok(Market::Lr),
            "ls" => Ok(Market::Ls),
            "lt" => Ok(Market::Lt),
            "lu" => Ok(Market::Lu),
            "lv" => Ok(Market::Lv),
            "ly" => Ok(Market::Ly),
            "ma" => Ok(Market::Ma),
            "mc" => Ok(Market::Mc),
            "md" => Ok(Market::Md),
            "me" => Ok(Market::Me),
            "mf" => Ok(Market::Mf),
            "mg" => Ok(Market::Mg),
            "mh" => Ok(Market::Mh),
            "mk" => Ok(Market::Mk),
            "ml" => Ok(Market::Ml),
            "mm" => Ok(Market::Mm),
            "mn" => Ok(Market::Mn),
            "mo" => Ok(Market::Mo),
            "mp" => Ok(Market::Mp),
            "mq" => Ok(Market::Mq),
            "mr" => Ok(Market::Mr),
            "ms" => Ok(Market::Ms),
            "mt" => Ok(Market::Mt),
            "mu" => Ok(Market::Mu),
            "mv" => Ok(Market::Mv),
            "mw" => Ok(Market::Mw),
            "mx" => Ok(Market::Mx),
            "my" => Ok(Market::My),
            "mz" => Ok(Market::Mz),
            "na" => Ok(Market::Na),
            "nc" => Ok(Market::Nc),
            "ne" => Ok(Market::Ne),
            "nf" => Ok(Market::Nf),
            "ng" => Ok(Market::Ng),
            "ni" => Ok(Market::Ni),
            "nl" => Ok(Market::Nl),
            "no" => Ok(Market::No),
            "np" => Ok(Market::Np),
            "nr" => Ok(Market::Nr),
            "nu" => Ok(Market::Nu),
            "nz" => Ok(Market::Nz),
            "om" => Ok(Market::Om),
            "pa" => Ok(Market::Pa),
            "pe" => Ok(Market::Pe),
            "pf" => Ok(Market::Pf),
            "pg" => Ok(Market::Pg),
            "ph" => Ok(Market::Ph),
            "pk" => Ok(Market::Pk),
            "pl" => Ok(Market::Pl),
            "pm" => Ok(Market::Pm),
            "pn" => Ok(Market::Pn),
            "pr" => Ok(Market::Pr),
            "ps" => Ok(Market::Ps),
            "pt" => Ok(Market::Pt),
            "pw" => Ok(Market::Pw),
            "py" => Ok(Market::Py),
            "qa" => Ok(Market::Qa),
            "re" => Ok(Market::Re),
            "ro" => Ok(Market::Ro),
            "rs" => Ok(Market::Rs),
            "ru" => Ok(Market::Ru),
            "rw" => Ok(Market::Rw),
            "sa" => Ok(Market::Sa),
            "sb" => Ok(Market::Sb),
            "sc" => Ok(Market::Sc),
            "sd" => Ok(Market::Sd),
            "se" => Ok(Market::Se),
            "sg" => Ok(Market::Sg),
            "sh" => Ok(Market::Sh),
            "si" => Ok(Market::Si),
            "sj" => Ok(Market::Sj),
            "sk" => Ok(Market::Sk),
            "sl" => Ok(Market::Sl),
            "sm" => Ok(Market::Sm),
            "sn" => Ok(Market::Sn),
            "so" => Ok(Market::So),
            "sr" => Ok(Market::Sr),
            "ss" => Ok(Market::Ss),
            "st" => Ok(Market::St),
            "sv" => Ok(Market::Sv),
            "sx" => Ok(Market::Sx),
            "sy" => Ok(Market::Sy),
            "sz" => Ok(Market::Sz),
            "ta" => Ok(Market::Ta),
            "tc" => Ok(Market::Tc),
            "td" => Ok(Market::Td),
            "tf" => Ok(Market::Tf),
            "tg" => Ok(Market::Tg),
            "th" => Ok(Market::Th),
            "tj" => Ok(Market::Tj),
            "tk" => Ok(Market::Tk),
            "tl" => Ok(Market::Tl),
            "tm" => Ok(Market::Tm),
            "tn" => Ok(Market::Tn),
            "to" => Ok(Market::To),
            "tr" => Ok(Market::Tr),
            "tt" => Ok(Market::Tt),
            "tv" => Ok(Market::Tv),
            "tw" => Ok(Market::Tw),
            "tz" => Ok(Market::Tz),
            "ua" => Ok(Market::Ua),
            "ug" => Ok(Market::Ug),
            "um" => Ok(Market::Um),
            "un" => Ok(Market::Un),
            "us" => Ok(Market::Us),
            "uy" => Ok(Market::Uy),
            "uz" => Ok(Market::Uz),
            "va" => Ok(Market::Va),
            "vc" => Ok(Market::Vc),
            "ve" => Ok(Market::Ve),
            "vg" => Ok(Market::Vg),
            "vi" => Ok(Market::Vi),
            "vn" => Ok(Market::Vn),
            "vu" => Ok(Market::Vu),
            "wf" => Ok(Market::Wf),
            "ws" => Ok(Market::Ws),
            "ye" => Ok(Market::Ye),
            "yt" => Ok(Market::Yt),
            "za" => Ok(Market::Za),
            "zm" => Ok(Market::Zm),
            "zw" => Ok(Market::Zw),
            _ => Err(format!("unknown market: {s}")),
        }
    }
}

impl serde::Serialize for Market {
    fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
        ser.serialize_str(self.as_str())
    }
}

impl<'de> serde::Deserialize<'de> for Market {
    fn deserialize<D: serde::Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
        let s = <std::borrow::Cow<'_, str>>::deserialize(de)?;
        <Market as FromStr>::from_str(&s).map_err(serde::de::Error::custom)
    }
}

/// A Microsoft Store UI language, identified by an ISO 639-1 alpha-2 subtag.
///
/// Auto-generated by `tools/gen-locales.mjs` — do not edit by hand.
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Lang {
    Aa,
    Ab,
    Ae,
    Af,
    Ak,
    Am,
    An,
    Ar,
    As,
    Av,
    Ay,
    Az,
    Ba,
    Be,
    Bg,
    Bh,
    Bi,
    Bm,
    Bn,
    Bo,
    Br,
    Bs,
    Ca,
    Ce,
    Ch,
    Co,
    Cr,
    Cs,
    Cu,
    Cv,
    Cy,
    Da,
    De,
    Dv,
    Dz,
    Ee,
    El,
    En,
    Eo,
    Es,
    Et,
    Eu,
    Fa,
    Ff,
    Fi,
    Fj,
    Fo,
    Fr,
    Fy,
    Ga,
    Gd,
    Gl,
    Gn,
    Gu,
    Gv,
    Ha,
    He,
    Hi,
    Ho,
    Hr,
    Ht,
    Hu,
    Hy,
    Hz,
    Ia,
    Id,
    Ie,
    Ig,
    Ii,
    Ik,
    Io,
    Is,
    It,
    Iu,
    Ja,
    Jv,
    Ka,
    Kg,
    Ki,
    Kj,
    Kk,
    Kl,
    Km,
    Kn,
    Ko,
    Kr,
    Ks,
    Ku,
    Kv,
    Kw,
    Ky,
    La,
    Lb,
    Lg,
    Li,
    Ln,
    Lo,
    Lt,
    Lu,
    Lv,
    Mg,
    Mh,
    Mi,
    Mk,
    Ml,
    Mn,
    Mr,
    Ms,
    Mt,
    My,
    Na,
    Nb,
    Nd,
    Ne,
    Ng,
    Nl,
    Nn,
    No,
    Nr,
    Nv,
    Ny,
    Oc,
    Oj,
    Om,
    Or,
    Os,
    Pa,
    Pi,
    Pl,
    Ps,
    Pt,
    Qu,
    Rm,
    Rn,
    Ro,
    Ru,
    Rw,
    Sa,
    Sc,
    Sd,
    Se,
    Sg,
    Sh,
    Si,
    Sk,
    Sl,
    Sm,
    Sn,
    So,
    Sq,
    Sr,
    Ss,
    St,
    Su,
    Sv,
    Sw,
    Ta,
    Te,
    Tg,
    Th,
    Ti,
    Tk,
    Tl,
    Tn,
    To,
    Tr,
    Ts,
    Tt,
    Tw,
    Ty,
    Ug,
    Uk,
    Ur,
    Uz,
    Ve,
    Vi,
    Vo,
    Wa,
    Wo,
    Xh,
    Yi,
    Yo,
    Za,
    Zh,
    Zu,
}

impl Lang {
    /// Returns the canonical code string.
    pub fn as_str(&self) -> &'static str {
        match self {
            Lang::Aa => "aa",
            Lang::Ab => "ab",
            Lang::Ae => "ae",
            Lang::Af => "af",
            Lang::Ak => "ak",
            Lang::Am => "am",
            Lang::An => "an",
            Lang::Ar => "ar",
            Lang::As => "as",
            Lang::Av => "av",
            Lang::Ay => "ay",
            Lang::Az => "az",
            Lang::Ba => "ba",
            Lang::Be => "be",
            Lang::Bg => "bg",
            Lang::Bh => "bh",
            Lang::Bi => "bi",
            Lang::Bm => "bm",
            Lang::Bn => "bn",
            Lang::Bo => "bo",
            Lang::Br => "br",
            Lang::Bs => "bs",
            Lang::Ca => "ca",
            Lang::Ce => "ce",
            Lang::Ch => "ch",
            Lang::Co => "co",
            Lang::Cr => "cr",
            Lang::Cs => "cs",
            Lang::Cu => "cu",
            Lang::Cv => "cv",
            Lang::Cy => "cy",
            Lang::Da => "da",
            Lang::De => "de",
            Lang::Dv => "dv",
            Lang::Dz => "dz",
            Lang::Ee => "ee",
            Lang::El => "el",
            Lang::En => "en",
            Lang::Eo => "eo",
            Lang::Es => "es",
            Lang::Et => "et",
            Lang::Eu => "eu",
            Lang::Fa => "fa",
            Lang::Ff => "ff",
            Lang::Fi => "fi",
            Lang::Fj => "fj",
            Lang::Fo => "fo",
            Lang::Fr => "fr",
            Lang::Fy => "fy",
            Lang::Ga => "ga",
            Lang::Gd => "gd",
            Lang::Gl => "gl",
            Lang::Gn => "gn",
            Lang::Gu => "gu",
            Lang::Gv => "gv",
            Lang::Ha => "ha",
            Lang::He => "he",
            Lang::Hi => "hi",
            Lang::Ho => "ho",
            Lang::Hr => "hr",
            Lang::Ht => "ht",
            Lang::Hu => "hu",
            Lang::Hy => "hy",
            Lang::Hz => "hz",
            Lang::Ia => "ia",
            Lang::Id => "id",
            Lang::Ie => "ie",
            Lang::Ig => "ig",
            Lang::Ii => "ii",
            Lang::Ik => "ik",
            Lang::Io => "io",
            Lang::Is => "is",
            Lang::It => "it",
            Lang::Iu => "iu",
            Lang::Ja => "ja",
            Lang::Jv => "jv",
            Lang::Ka => "ka",
            Lang::Kg => "kg",
            Lang::Ki => "ki",
            Lang::Kj => "kj",
            Lang::Kk => "kk",
            Lang::Kl => "kl",
            Lang::Km => "km",
            Lang::Kn => "kn",
            Lang::Ko => "ko",
            Lang::Kr => "kr",
            Lang::Ks => "ks",
            Lang::Ku => "ku",
            Lang::Kv => "kv",
            Lang::Kw => "kw",
            Lang::Ky => "ky",
            Lang::La => "la",
            Lang::Lb => "lb",
            Lang::Lg => "lg",
            Lang::Li => "li",
            Lang::Ln => "ln",
            Lang::Lo => "lo",
            Lang::Lt => "lt",
            Lang::Lu => "lu",
            Lang::Lv => "lv",
            Lang::Mg => "mg",
            Lang::Mh => "mh",
            Lang::Mi => "mi",
            Lang::Mk => "mk",
            Lang::Ml => "ml",
            Lang::Mn => "mn",
            Lang::Mr => "mr",
            Lang::Ms => "ms",
            Lang::Mt => "mt",
            Lang::My => "my",
            Lang::Na => "na",
            Lang::Nb => "nb",
            Lang::Nd => "nd",
            Lang::Ne => "ne",
            Lang::Ng => "ng",
            Lang::Nl => "nl",
            Lang::Nn => "nn",
            Lang::No => "no",
            Lang::Nr => "nr",
            Lang::Nv => "nv",
            Lang::Ny => "ny",
            Lang::Oc => "oc",
            Lang::Oj => "oj",
            Lang::Om => "om",
            Lang::Or => "or",
            Lang::Os => "os",
            Lang::Pa => "pa",
            Lang::Pi => "pi",
            Lang::Pl => "pl",
            Lang::Ps => "ps",
            Lang::Pt => "pt",
            Lang::Qu => "qu",
            Lang::Rm => "rm",
            Lang::Rn => "rn",
            Lang::Ro => "ro",
            Lang::Ru => "ru",
            Lang::Rw => "rw",
            Lang::Sa => "sa",
            Lang::Sc => "sc",
            Lang::Sd => "sd",
            Lang::Se => "se",
            Lang::Sg => "sg",
            Lang::Sh => "sh",
            Lang::Si => "si",
            Lang::Sk => "sk",
            Lang::Sl => "sl",
            Lang::Sm => "sm",
            Lang::Sn => "sn",
            Lang::So => "so",
            Lang::Sq => "sq",
            Lang::Sr => "sr",
            Lang::Ss => "ss",
            Lang::St => "st",
            Lang::Su => "su",
            Lang::Sv => "sv",
            Lang::Sw => "sw",
            Lang::Ta => "ta",
            Lang::Te => "te",
            Lang::Tg => "tg",
            Lang::Th => "th",
            Lang::Ti => "ti",
            Lang::Tk => "tk",
            Lang::Tl => "tl",
            Lang::Tn => "tn",
            Lang::To => "to",
            Lang::Tr => "tr",
            Lang::Ts => "ts",
            Lang::Tt => "tt",
            Lang::Tw => "tw",
            Lang::Ty => "ty",
            Lang::Ug => "ug",
            Lang::Uk => "uk",
            Lang::Ur => "ur",
            Lang::Uz => "uz",
            Lang::Ve => "ve",
            Lang::Vi => "vi",
            Lang::Vo => "vo",
            Lang::Wa => "wa",
            Lang::Wo => "wo",
            Lang::Xh => "xh",
            Lang::Yi => "yi",
            Lang::Yo => "yo",
            Lang::Za => "za",
            Lang::Zh => "zh",
            Lang::Zu => "zu",
        }
    }

    /// Returns the English name from the registry.
    pub fn english_name(&self) -> &'static str {
        match self {
            Lang::Aa => "Afar",
            Lang::Ab => "Abkhazian",
            Lang::Ae => "Avestan",
            Lang::Af => "Afrikaans",
            Lang::Ak => "Akan",
            Lang::Am => "Amharic",
            Lang::An => "Aragonese",
            Lang::Ar => "Arabic",
            Lang::As => "Assamese",
            Lang::Av => "Avaric",
            Lang::Ay => "Aymara",
            Lang::Az => "Azerbaijani",
            Lang::Ba => "Bashkir",
            Lang::Be => "Belarusian",
            Lang::Bg => "Bulgarian",
            Lang::Bh => "Bihari languages",
            Lang::Bi => "Bislama",
            Lang::Bm => "Bambara",
            Lang::Bn => "Bengali",
            Lang::Bo => "Tibetan",
            Lang::Br => "Breton",
            Lang::Bs => "Bosnian",
            Lang::Ca => "Catalan",
            Lang::Ce => "Chechen",
            Lang::Ch => "Chamorro",
            Lang::Co => "Corsican",
            Lang::Cr => "Cree",
            Lang::Cs => "Czech",
            Lang::Cu => "Church Slavic",
            Lang::Cv => "Chuvash",
            Lang::Cy => "Welsh",
            Lang::Da => "Danish",
            Lang::De => "German",
            Lang::Dv => "Dhivehi",
            Lang::Dz => "Dzongkha",
            Lang::Ee => "Ewe",
            Lang::El => "Modern Greek (1453-)",
            Lang::En => "English",
            Lang::Eo => "Esperanto",
            Lang::Es => "Spanish",
            Lang::Et => "Estonian",
            Lang::Eu => "Basque",
            Lang::Fa => "Persian",
            Lang::Ff => "Fulah",
            Lang::Fi => "Finnish",
            Lang::Fj => "Fijian",
            Lang::Fo => "Faroese",
            Lang::Fr => "French",
            Lang::Fy => "Western Frisian",
            Lang::Ga => "Irish",
            Lang::Gd => "Scottish Gaelic",
            Lang::Gl => "Galician",
            Lang::Gn => "Guarani",
            Lang::Gu => "Gujarati",
            Lang::Gv => "Manx",
            Lang::Ha => "Hausa",
            Lang::He => "Hebrew",
            Lang::Hi => "Hindi",
            Lang::Ho => "Hiri Motu",
            Lang::Hr => "Croatian",
            Lang::Ht => "Haitian",
            Lang::Hu => "Hungarian",
            Lang::Hy => "Armenian",
            Lang::Hz => "Herero",
            Lang::Ia => "Interlingua (International Auxiliary Language Association)",
            Lang::Id => "Indonesian",
            Lang::Ie => "Interlingue",
            Lang::Ig => "Igbo",
            Lang::Ii => "Sichuan Yi",
            Lang::Ik => "Inupiaq",
            Lang::Io => "Ido",
            Lang::Is => "Icelandic",
            Lang::It => "Italian",
            Lang::Iu => "Inuktitut",
            Lang::Ja => "Japanese",
            Lang::Jv => "Javanese",
            Lang::Ka => "Georgian",
            Lang::Kg => "Kongo",
            Lang::Ki => "Kikuyu",
            Lang::Kj => "Kuanyama",
            Lang::Kk => "Kazakh",
            Lang::Kl => "Kalaallisut",
            Lang::Km => "Khmer",
            Lang::Kn => "Kannada",
            Lang::Ko => "Korean",
            Lang::Kr => "Kanuri",
            Lang::Ks => "Kashmiri",
            Lang::Ku => "Kurdish",
            Lang::Kv => "Komi",
            Lang::Kw => "Cornish",
            Lang::Ky => "Kirghiz",
            Lang::La => "Latin",
            Lang::Lb => "Luxembourgish",
            Lang::Lg => "Ganda",
            Lang::Li => "Limburgan",
            Lang::Ln => "Lingala",
            Lang::Lo => "Lao",
            Lang::Lt => "Lithuanian",
            Lang::Lu => "Luba-Katanga",
            Lang::Lv => "Latvian",
            Lang::Mg => "Malagasy",
            Lang::Mh => "Marshallese",
            Lang::Mi => "Maori",
            Lang::Mk => "Macedonian",
            Lang::Ml => "Malayalam",
            Lang::Mn => "Mongolian",
            Lang::Mr => "Marathi",
            Lang::Ms => "Malay (macrolanguage)",
            Lang::Mt => "Maltese",
            Lang::My => "Burmese",
            Lang::Na => "Nauru",
            Lang::Nb => "Norwegian Bokmål",
            Lang::Nd => "North Ndebele",
            Lang::Ne => "Nepali (macrolanguage)",
            Lang::Ng => "Ndonga",
            Lang::Nl => "Dutch",
            Lang::Nn => "Norwegian Nynorsk",
            Lang::No => "Norwegian",
            Lang::Nr => "South Ndebele",
            Lang::Nv => "Navajo",
            Lang::Ny => "Nyanja",
            Lang::Oc => "Occitan (post 1500)",
            Lang::Oj => "Ojibwa",
            Lang::Om => "Oromo",
            Lang::Or => "Oriya (macrolanguage)",
            Lang::Os => "Ossetian",
            Lang::Pa => "Panjabi",
            Lang::Pi => "Pali",
            Lang::Pl => "Polish",
            Lang::Ps => "Pushto",
            Lang::Pt => "Portuguese",
            Lang::Qu => "Quechua",
            Lang::Rm => "Romansh",
            Lang::Rn => "Rundi",
            Lang::Ro => "Romanian",
            Lang::Ru => "Russian",
            Lang::Rw => "Kinyarwanda",
            Lang::Sa => "Sanskrit",
            Lang::Sc => "Sardinian",
            Lang::Sd => "Sindhi",
            Lang::Se => "Northern Sami",
            Lang::Sg => "Sango",
            Lang::Sh => "Serbo-Croatian",
            Lang::Si => "Sinhala",
            Lang::Sk => "Slovak",
            Lang::Sl => "Slovenian",
            Lang::Sm => "Samoan",
            Lang::Sn => "Shona",
            Lang::So => "Somali",
            Lang::Sq => "Albanian",
            Lang::Sr => "Serbian",
            Lang::Ss => "Swati",
            Lang::St => "Southern Sotho",
            Lang::Su => "Sundanese",
            Lang::Sv => "Swedish",
            Lang::Sw => "Swahili (macrolanguage)",
            Lang::Ta => "Tamil",
            Lang::Te => "Telugu",
            Lang::Tg => "Tajik",
            Lang::Th => "Thai",
            Lang::Ti => "Tigrinya",
            Lang::Tk => "Turkmen",
            Lang::Tl => "Tagalog",
            Lang::Tn => "Tswana",
            Lang::To => "Tonga (Tonga Islands)",
            Lang::Tr => "Turkish",
            Lang::Ts => "Tsonga",
            Lang::Tt => "Tatar",
            Lang::Tw => "Twi",
            Lang::Ty => "Tahitian",
            Lang::Ug => "Uighur",
            Lang::Uk => "Ukrainian",
            Lang::Ur => "Urdu",
            Lang::Uz => "Uzbek",
            Lang::Ve => "Venda",
            Lang::Vi => "Vietnamese",
            Lang::Vo => "Volapük",
            Lang::Wa => "Walloon",
            Lang::Wo => "Wolof",
            Lang::Xh => "Xhosa",
            Lang::Yi => "Yiddish",
            Lang::Yo => "Yoruba",
            Lang::Za => "Zhuang",
            Lang::Zh => "Chinese",
            Lang::Zu => "Zulu",
        }
    }

    /// Iterates over every variant in code order.
    pub fn all() -> &'static [Lang] {
        &[Lang::Aa, Lang::Ab, Lang::Ae, Lang::Af, Lang::Ak, Lang::Am, Lang::An, Lang::Ar, Lang::As, Lang::Av, Lang::Ay, Lang::Az, Lang::Ba, Lang::Be, Lang::Bg, Lang::Bh, Lang::Bi, Lang::Bm, Lang::Bn, Lang::Bo, Lang::Br, Lang::Bs, Lang::Ca, Lang::Ce, Lang::Ch, Lang::Co, Lang::Cr, Lang::Cs, Lang::Cu, Lang::Cv, Lang::Cy, Lang::Da, Lang::De, Lang::Dv, Lang::Dz, Lang::Ee, Lang::El, Lang::En, Lang::Eo, Lang::Es, Lang::Et, Lang::Eu, Lang::Fa, Lang::Ff, Lang::Fi, Lang::Fj, Lang::Fo, Lang::Fr, Lang::Fy, Lang::Ga, Lang::Gd, Lang::Gl, Lang::Gn, Lang::Gu, Lang::Gv, Lang::Ha, Lang::He, Lang::Hi, Lang::Ho, Lang::Hr, Lang::Ht, Lang::Hu, Lang::Hy, Lang::Hz, Lang::Ia, Lang::Id, Lang::Ie, Lang::Ig, Lang::Ii, Lang::Ik, Lang::Io, Lang::Is, Lang::It, Lang::Iu, Lang::Ja, Lang::Jv, Lang::Ka, Lang::Kg, Lang::Ki, Lang::Kj, Lang::Kk, Lang::Kl, Lang::Km, Lang::Kn, Lang::Ko, Lang::Kr, Lang::Ks, Lang::Ku, Lang::Kv, Lang::Kw, Lang::Ky, Lang::La, Lang::Lb, Lang::Lg, Lang::Li, Lang::Ln, Lang::Lo, Lang::Lt, Lang::Lu, Lang::Lv, Lang::Mg, Lang::Mh, Lang::Mi, Lang::Mk, Lang::Ml, Lang::Mn, Lang::Mr, Lang::Ms, Lang::Mt, Lang::My, Lang::Na, Lang::Nb, Lang::Nd, Lang::Ne, Lang::Ng, Lang::Nl, Lang::Nn, Lang::No, Lang::Nr, Lang::Nv, Lang::Ny, Lang::Oc, Lang::Oj, Lang::Om, Lang::Or, Lang::Os, Lang::Pa, Lang::Pi, Lang::Pl, Lang::Ps, Lang::Pt, Lang::Qu, Lang::Rm, Lang::Rn, Lang::Ro, Lang::Ru, Lang::Rw, Lang::Sa, Lang::Sc, Lang::Sd, Lang::Se, Lang::Sg, Lang::Sh, Lang::Si, Lang::Sk, Lang::Sl, Lang::Sm, Lang::Sn, Lang::So, Lang::Sq, Lang::Sr, Lang::Ss, Lang::St, Lang::Su, Lang::Sv, Lang::Sw, Lang::Ta, Lang::Te, Lang::Tg, Lang::Th, Lang::Ti, Lang::Tk, Lang::Tl, Lang::Tn, Lang::To, Lang::Tr, Lang::Ts, Lang::Tt, Lang::Tw, Lang::Ty, Lang::Ug, Lang::Uk, Lang::Ur, Lang::Uz, Lang::Ve, Lang::Vi, Lang::Vo, Lang::Wa, Lang::Wo, Lang::Xh, Lang::Yi, Lang::Yo, Lang::Za, Lang::Zh, Lang::Zu]
    }
}

impl FromStr for Lang {
    type Err = String;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_ascii_lowercase().as_str() {
            "aa" => Ok(Lang::Aa),
            "ab" => Ok(Lang::Ab),
            "ae" => Ok(Lang::Ae),
            "af" => Ok(Lang::Af),
            "ak" => Ok(Lang::Ak),
            "am" => Ok(Lang::Am),
            "an" => Ok(Lang::An),
            "ar" => Ok(Lang::Ar),
            "as" => Ok(Lang::As),
            "av" => Ok(Lang::Av),
            "ay" => Ok(Lang::Ay),
            "az" => Ok(Lang::Az),
            "ba" => Ok(Lang::Ba),
            "be" => Ok(Lang::Be),
            "bg" => Ok(Lang::Bg),
            "bh" => Ok(Lang::Bh),
            "bi" => Ok(Lang::Bi),
            "bm" => Ok(Lang::Bm),
            "bn" => Ok(Lang::Bn),
            "bo" => Ok(Lang::Bo),
            "br" => Ok(Lang::Br),
            "bs" => Ok(Lang::Bs),
            "ca" => Ok(Lang::Ca),
            "ce" => Ok(Lang::Ce),
            "ch" => Ok(Lang::Ch),
            "co" => Ok(Lang::Co),
            "cr" => Ok(Lang::Cr),
            "cs" => Ok(Lang::Cs),
            "cu" => Ok(Lang::Cu),
            "cv" => Ok(Lang::Cv),
            "cy" => Ok(Lang::Cy),
            "da" => Ok(Lang::Da),
            "de" => Ok(Lang::De),
            "dv" => Ok(Lang::Dv),
            "dz" => Ok(Lang::Dz),
            "ee" => Ok(Lang::Ee),
            "el" => Ok(Lang::El),
            "en" => Ok(Lang::En),
            "eo" => Ok(Lang::Eo),
            "es" => Ok(Lang::Es),
            "et" => Ok(Lang::Et),
            "eu" => Ok(Lang::Eu),
            "fa" => Ok(Lang::Fa),
            "ff" => Ok(Lang::Ff),
            "fi" => Ok(Lang::Fi),
            "fj" => Ok(Lang::Fj),
            "fo" => Ok(Lang::Fo),
            "fr" => Ok(Lang::Fr),
            "fy" => Ok(Lang::Fy),
            "ga" => Ok(Lang::Ga),
            "gd" => Ok(Lang::Gd),
            "gl" => Ok(Lang::Gl),
            "gn" => Ok(Lang::Gn),
            "gu" => Ok(Lang::Gu),
            "gv" => Ok(Lang::Gv),
            "ha" => Ok(Lang::Ha),
            "he" => Ok(Lang::He),
            "hi" => Ok(Lang::Hi),
            "ho" => Ok(Lang::Ho),
            "hr" => Ok(Lang::Hr),
            "ht" => Ok(Lang::Ht),
            "hu" => Ok(Lang::Hu),
            "hy" => Ok(Lang::Hy),
            "hz" => Ok(Lang::Hz),
            "ia" => Ok(Lang::Ia),
            "id" => Ok(Lang::Id),
            "ie" => Ok(Lang::Ie),
            "ig" => Ok(Lang::Ig),
            "ii" => Ok(Lang::Ii),
            "ik" => Ok(Lang::Ik),
            "io" => Ok(Lang::Io),
            "is" => Ok(Lang::Is),
            "it" => Ok(Lang::It),
            "iu" => Ok(Lang::Iu),
            "ja" => Ok(Lang::Ja),
            "jv" => Ok(Lang::Jv),
            "ka" => Ok(Lang::Ka),
            "kg" => Ok(Lang::Kg),
            "ki" => Ok(Lang::Ki),
            "kj" => Ok(Lang::Kj),
            "kk" => Ok(Lang::Kk),
            "kl" => Ok(Lang::Kl),
            "km" => Ok(Lang::Km),
            "kn" => Ok(Lang::Kn),
            "ko" => Ok(Lang::Ko),
            "kr" => Ok(Lang::Kr),
            "ks" => Ok(Lang::Ks),
            "ku" => Ok(Lang::Ku),
            "kv" => Ok(Lang::Kv),
            "kw" => Ok(Lang::Kw),
            "ky" => Ok(Lang::Ky),
            "la" => Ok(Lang::La),
            "lb" => Ok(Lang::Lb),
            "lg" => Ok(Lang::Lg),
            "li" => Ok(Lang::Li),
            "ln" => Ok(Lang::Ln),
            "lo" => Ok(Lang::Lo),
            "lt" => Ok(Lang::Lt),
            "lu" => Ok(Lang::Lu),
            "lv" => Ok(Lang::Lv),
            "mg" => Ok(Lang::Mg),
            "mh" => Ok(Lang::Mh),
            "mi" => Ok(Lang::Mi),
            "mk" => Ok(Lang::Mk),
            "ml" => Ok(Lang::Ml),
            "mn" => Ok(Lang::Mn),
            "mr" => Ok(Lang::Mr),
            "ms" => Ok(Lang::Ms),
            "mt" => Ok(Lang::Mt),
            "my" => Ok(Lang::My),
            "na" => Ok(Lang::Na),
            "nb" => Ok(Lang::Nb),
            "nd" => Ok(Lang::Nd),
            "ne" => Ok(Lang::Ne),
            "ng" => Ok(Lang::Ng),
            "nl" => Ok(Lang::Nl),
            "nn" => Ok(Lang::Nn),
            "no" => Ok(Lang::No),
            "nr" => Ok(Lang::Nr),
            "nv" => Ok(Lang::Nv),
            "ny" => Ok(Lang::Ny),
            "oc" => Ok(Lang::Oc),
            "oj" => Ok(Lang::Oj),
            "om" => Ok(Lang::Om),
            "or" => Ok(Lang::Or),
            "os" => Ok(Lang::Os),
            "pa" => Ok(Lang::Pa),
            "pi" => Ok(Lang::Pi),
            "pl" => Ok(Lang::Pl),
            "ps" => Ok(Lang::Ps),
            "pt" => Ok(Lang::Pt),
            "qu" => Ok(Lang::Qu),
            "rm" => Ok(Lang::Rm),
            "rn" => Ok(Lang::Rn),
            "ro" => Ok(Lang::Ro),
            "ru" => Ok(Lang::Ru),
            "rw" => Ok(Lang::Rw),
            "sa" => Ok(Lang::Sa),
            "sc" => Ok(Lang::Sc),
            "sd" => Ok(Lang::Sd),
            "se" => Ok(Lang::Se),
            "sg" => Ok(Lang::Sg),
            "sh" => Ok(Lang::Sh),
            "si" => Ok(Lang::Si),
            "sk" => Ok(Lang::Sk),
            "sl" => Ok(Lang::Sl),
            "sm" => Ok(Lang::Sm),
            "sn" => Ok(Lang::Sn),
            "so" => Ok(Lang::So),
            "sq" => Ok(Lang::Sq),
            "sr" => Ok(Lang::Sr),
            "ss" => Ok(Lang::Ss),
            "st" => Ok(Lang::St),
            "su" => Ok(Lang::Su),
            "sv" => Ok(Lang::Sv),
            "sw" => Ok(Lang::Sw),
            "ta" => Ok(Lang::Ta),
            "te" => Ok(Lang::Te),
            "tg" => Ok(Lang::Tg),
            "th" => Ok(Lang::Th),
            "ti" => Ok(Lang::Ti),
            "tk" => Ok(Lang::Tk),
            "tl" => Ok(Lang::Tl),
            "tn" => Ok(Lang::Tn),
            "to" => Ok(Lang::To),
            "tr" => Ok(Lang::Tr),
            "ts" => Ok(Lang::Ts),
            "tt" => Ok(Lang::Tt),
            "tw" => Ok(Lang::Tw),
            "ty" => Ok(Lang::Ty),
            "ug" => Ok(Lang::Ug),
            "uk" => Ok(Lang::Uk),
            "ur" => Ok(Lang::Ur),
            "uz" => Ok(Lang::Uz),
            "ve" => Ok(Lang::Ve),
            "vi" => Ok(Lang::Vi),
            "vo" => Ok(Lang::Vo),
            "wa" => Ok(Lang::Wa),
            "wo" => Ok(Lang::Wo),
            "xh" => Ok(Lang::Xh),
            "yi" => Ok(Lang::Yi),
            "yo" => Ok(Lang::Yo),
            "za" => Ok(Lang::Za),
            "zh" => Ok(Lang::Zh),
            "zu" => Ok(Lang::Zu),
            _ => Err(format!("unknown lang: {s}")),
        }
    }
}

impl serde::Serialize for Lang {
    fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
        ser.serialize_str(self.as_str())
    }
}

impl<'de> serde::Deserialize<'de> for Lang {
    fn deserialize<D: serde::Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
        let s = <std::borrow::Cow<'_, str>>::deserialize(de)?;
        <Lang as FromStr>::from_str(&s).map_err(serde::de::Error::custom)
    }
}

/// A BCP-47 language tag accepted by the Microsoft Store (e.g. `en-US`, `zh-Hant`, `sr-Cyrl-RS`).
///
/// Auto-generated by `tools/gen-locales.mjs` — do not edit by hand.
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum LanguageTag {
    Af,
    AfZa,
    Am,
    AmEt,
    Ar,
    ArAe,
    ArBh,
    ArDz,
    ArEg,
    ArIq,
    ArJo,
    ArKw,
    ArLb,
    ArLy,
    ArMa,
    ArOm,
    ArQa,
    ArSa,
    ArSy,
    ArTn,
    ArYe,
    As,
    AsIn,
    AzArab,
    AzArabAz,
    AzCyrl,
    AzCyrlAz,
    AzLatn,
    AzLatnAz,
    Be,
    BeBy,
    Bg,
    BgBg,
    Bn,
    BnBd,
    BnIn,
    Bs,
    BsCyrl,
    BsCyrlBa,
    BsLatn,
    BsLatnBa,
    Ca,
    CaEs,
    CaEsValencia,
    ChrCher,
    ChrCherUs,
    ChrLatn,
    Cs,
    CsCz,
    Cy,
    CyGb,
    Da,
    DaDk,
    De,
    DeAt,
    DeCh,
    DeDe,
    DeLi,
    DeLu,
    El,
    ElGr,
    En,
    En011,
    En014,
    En018,
    En021,
    En029,
    En053,
    EnAu,
    EnBz,
    EnCa,
    EnGb,
    EnHk,
    EnId,
    EnIe,
    EnIn,
    EnJm,
    EnKz,
    EnMt,
    EnMy,
    EnNz,
    EnPh,
    EnPk,
    EnSg,
    EnTt,
    EnUs,
    EnVn,
    EnZa,
    EnZw,
    Es,
    Es019,
    Es419,
    EsAr,
    EsBo,
    EsCl,
    EsCo,
    EsCr,
    EsDo,
    EsEc,
    EsEs,
    EsGt,
    EsHn,
    EsMx,
    EsNi,
    EsPa,
    EsPe,
    EsPr,
    EsPy,
    EsSv,
    EsUs,
    EsUy,
    EsVe,
    Et,
    EtEe,
    Eu,
    EuEs,
    Fa,
    FaIr,
    Fi,
    FiFi,
    Fil,
    FilLatn,
    FilPh,
    Fr,
    Fr011,
    Fr015,
    Fr021,
    Fr029,
    Fr155,
    FrBe,
    FrCa,
    FrCd,
    FrCh,
    FrCi,
    FrCm,
    FrFr,
    FrHt,
    FrLu,
    FrMa,
    FrMc,
    FrMl,
    FrRe,
    FrcLatn,
    FrpLatn,
    Ga,
    GaIe,
    GdGb,
    GdLatn,
    Gl,
    GlEs,
    Gu,
    GuIn,
    Ha,
    HaLatn,
    HaLatnNg,
    He,
    HeIl,
    Hi,
    HiIn,
    Hr,
    HrBa,
    HrHr,
    Hu,
    HuHu,
    Hy,
    HyAm,
    Id,
    IdId,
    IgLatn,
    IgNg,
    Is,
    IsIs,
    It,
    ItCh,
    ItIt,
    IuCans,
    IuLatn,
    IuLatnCa,
    Ja,
    JaJp,
    Ka,
    KaGe,
    Kk,
    KkKz,
    Km,
    KmKh,
    Kn,
    KnIn,
    Ko,
    KoKr,
    Kok,
    KokIn,
    KuArab,
    KuArabIq,
    KyCyrl,
    KyKg,
    Lb,
    LbLu,
    Lo,
    LoLa,
    Lt,
    LtLt,
    Lv,
    LvLv,
    Mi,
    MiLatn,
    MiNz,
    Mk,
    MkMk,
    Ml,
    MlIn,
    MnCyrl,
    MnMn,
    MnMong,
    MnPhag,
    Mr,
    MrIn,
    Ms,
    MsBn,
    MsMy,
    Mt,
    MtMt,
    Nb,
    NbNo,
    Ne,
    NeNp,
    Nl,
    NlBe,
    NlNl,
    Nn,
    NnNo,
    No,
    NoNo,
    Nso,
    NsoZa,
    Or,
    OrIn,
    Pa,
    PaArab,
    PaArabPk,
    PaDeva,
    PaIn,
    Pl,
    PlPl,
    Prs,
    PrsAf,
    PrsArab,
    Pt,
    PtBr,
    PtPt,
    QucLatn,
    QutGt,
    QutLatn,
    Quz,
    QuzBo,
    QuzEc,
    QuzPe,
    Ro,
    RoRo,
    Ru,
    RuRu,
    Rw,
    RwRw,
    SdArab,
    SdArabPk,
    SdDeva,
    Si,
    SiLk,
    Sk,
    SkSk,
    Sl,
    SlSi,
    Sq,
    SqAl,
    Sr,
    SrCyrl,
    SrCyrlBa,
    SrCyrlCs,
    SrCyrlMe,
    SrCyrlRs,
    SrLatn,
    SrLatnBa,
    SrLatnCs,
    SrLatnMe,
    SrLatnRs,
    Sv,
    SvFi,
    SvSe,
    Sw,
    SwKe,
    Ta,
    TaIn,
    Te,
    TeIn,
    TgArab,
    TgCyrl,
    TgCyrlTj,
    TgLatn,
    Th,
    ThTh,
    Ti,
    TiEt,
    TkCyrl,
    TkCyrlTr,
    TkLatn,
    TkLatnTr,
    TkTm,
    Tn,
    TnBw,
    TnZa,
    Tr,
    TrTr,
    TtArab,
    TtCyrl,
    TtLatn,
    TtRu,
    UgArab,
    UgCn,
    UgCyrl,
    UgLatn,
    Uk,
    UkUa,
    Ur,
    UrPk,
    Uz,
    UzCyrl,
    UzLatn,
    UzLatnUz,
    Vi,
    ViVn,
    Wo,
    WoSn,
    Xh,
    XhZa,
    YoLatn,
    YoNg,
    ZhCn,
    ZhHans,
    ZhHansCn,
    ZhHansSg,
    ZhHant,
    ZhHantHk,
    ZhHantMo,
    ZhHantTw,
    ZhHk,
    ZhMo,
    ZhSg,
    ZhTw,
    Zu,
    ZuZa,
}

impl LanguageTag {
    /// Returns the canonical code string.
    pub fn as_str(&self) -> &'static str {
        match self {
            LanguageTag::Af => "af",
            LanguageTag::AfZa => "af-ZA",
            LanguageTag::Am => "am",
            LanguageTag::AmEt => "am-ET",
            LanguageTag::Ar => "ar",
            LanguageTag::ArAe => "ar-AE",
            LanguageTag::ArBh => "ar-BH",
            LanguageTag::ArDz => "ar-DZ",
            LanguageTag::ArEg => "ar-EG",
            LanguageTag::ArIq => "ar-IQ",
            LanguageTag::ArJo => "ar-JO",
            LanguageTag::ArKw => "ar-KW",
            LanguageTag::ArLb => "ar-LB",
            LanguageTag::ArLy => "ar-LY",
            LanguageTag::ArMa => "ar-MA",
            LanguageTag::ArOm => "ar-OM",
            LanguageTag::ArQa => "ar-QA",
            LanguageTag::ArSa => "ar-SA",
            LanguageTag::ArSy => "ar-SY",
            LanguageTag::ArTn => "ar-TN",
            LanguageTag::ArYe => "ar-YE",
            LanguageTag::As => "as",
            LanguageTag::AsIn => "as-IN",
            LanguageTag::AzArab => "az-Arab",
            LanguageTag::AzArabAz => "az-Arab-AZ",
            LanguageTag::AzCyrl => "az-Cyrl",
            LanguageTag::AzCyrlAz => "az-Cyrl-AZ",
            LanguageTag::AzLatn => "az-Latn",
            LanguageTag::AzLatnAz => "az-Latn-AZ",
            LanguageTag::Be => "be",
            LanguageTag::BeBy => "be-BY",
            LanguageTag::Bg => "bg",
            LanguageTag::BgBg => "bg-BG",
            LanguageTag::Bn => "bn",
            LanguageTag::BnBd => "bn-BD",
            LanguageTag::BnIn => "bn-IN",
            LanguageTag::Bs => "bs",
            LanguageTag::BsCyrl => "bs-Cyrl",
            LanguageTag::BsCyrlBa => "bs-Cyrl-BA",
            LanguageTag::BsLatn => "bs-Latn",
            LanguageTag::BsLatnBa => "bs-Latn-BA",
            LanguageTag::Ca => "ca",
            LanguageTag::CaEs => "ca-ES",
            LanguageTag::CaEsValencia => "ca-ES-valencia",
            LanguageTag::ChrCher => "chr-Cher",
            LanguageTag::ChrCherUs => "chr-Cher-US",
            LanguageTag::ChrLatn => "chr-Latn",
            LanguageTag::Cs => "cs",
            LanguageTag::CsCz => "cs-CZ",
            LanguageTag::Cy => "cy",
            LanguageTag::CyGb => "cy-GB",
            LanguageTag::Da => "da",
            LanguageTag::DaDk => "da-DK",
            LanguageTag::De => "de",
            LanguageTag::DeAt => "de-AT",
            LanguageTag::DeCh => "de-CH",
            LanguageTag::DeDe => "de-DE",
            LanguageTag::DeLi => "de-LI",
            LanguageTag::DeLu => "de-LU",
            LanguageTag::El => "el",
            LanguageTag::ElGr => "el-GR",
            LanguageTag::En => "en",
            LanguageTag::En011 => "en-011",
            LanguageTag::En014 => "en-014",
            LanguageTag::En018 => "en-018",
            LanguageTag::En021 => "en-021",
            LanguageTag::En029 => "en-029",
            LanguageTag::En053 => "en-053",
            LanguageTag::EnAu => "en-AU",
            LanguageTag::EnBz => "en-BZ",
            LanguageTag::EnCa => "en-CA",
            LanguageTag::EnGb => "en-GB",
            LanguageTag::EnHk => "en-HK",
            LanguageTag::EnId => "en-ID",
            LanguageTag::EnIe => "en-IE",
            LanguageTag::EnIn => "en-IN",
            LanguageTag::EnJm => "en-JM",
            LanguageTag::EnKz => "en-KZ",
            LanguageTag::EnMt => "en-MT",
            LanguageTag::EnMy => "en-MY",
            LanguageTag::EnNz => "en-NZ",
            LanguageTag::EnPh => "en-PH",
            LanguageTag::EnPk => "en-PK",
            LanguageTag::EnSg => "en-SG",
            LanguageTag::EnTt => "en-TT",
            LanguageTag::EnUs => "en-US",
            LanguageTag::EnVn => "en-VN",
            LanguageTag::EnZa => "en-ZA",
            LanguageTag::EnZw => "en-ZW",
            LanguageTag::Es => "es",
            LanguageTag::Es019 => "es-019",
            LanguageTag::Es419 => "es-419",
            LanguageTag::EsAr => "es-AR",
            LanguageTag::EsBo => "es-BO",
            LanguageTag::EsCl => "es-CL",
            LanguageTag::EsCo => "es-CO",
            LanguageTag::EsCr => "es-CR",
            LanguageTag::EsDo => "es-DO",
            LanguageTag::EsEc => "es-EC",
            LanguageTag::EsEs => "es-ES",
            LanguageTag::EsGt => "es-GT",
            LanguageTag::EsHn => "es-HN",
            LanguageTag::EsMx => "es-MX",
            LanguageTag::EsNi => "es-NI",
            LanguageTag::EsPa => "es-PA",
            LanguageTag::EsPe => "es-PE",
            LanguageTag::EsPr => "es-PR",
            LanguageTag::EsPy => "es-PY",
            LanguageTag::EsSv => "es-SV",
            LanguageTag::EsUs => "es-US",
            LanguageTag::EsUy => "es-UY",
            LanguageTag::EsVe => "es-VE",
            LanguageTag::Et => "et",
            LanguageTag::EtEe => "et-EE",
            LanguageTag::Eu => "eu",
            LanguageTag::EuEs => "eu-ES",
            LanguageTag::Fa => "fa",
            LanguageTag::FaIr => "fa-IR",
            LanguageTag::Fi => "fi",
            LanguageTag::FiFi => "fi-FI",
            LanguageTag::Fil => "fil",
            LanguageTag::FilLatn => "fil-Latn",
            LanguageTag::FilPh => "fil-PH",
            LanguageTag::Fr => "fr",
            LanguageTag::Fr011 => "fr-011",
            LanguageTag::Fr015 => "fr-015",
            LanguageTag::Fr021 => "fr-021",
            LanguageTag::Fr029 => "fr-029",
            LanguageTag::Fr155 => "fr-155",
            LanguageTag::FrBe => "fr-BE",
            LanguageTag::FrCa => "fr-CA",
            LanguageTag::FrCd => "fr-CD",
            LanguageTag::FrCh => "fr-CH",
            LanguageTag::FrCi => "fr-CI",
            LanguageTag::FrCm => "fr-CM",
            LanguageTag::FrFr => "fr-FR",
            LanguageTag::FrHt => "fr-HT",
            LanguageTag::FrLu => "fr-LU",
            LanguageTag::FrMa => "fr-MA",
            LanguageTag::FrMc => "fr-MC",
            LanguageTag::FrMl => "fr-ML",
            LanguageTag::FrRe => "fr-RE",
            LanguageTag::FrcLatn => "frc-Latn",
            LanguageTag::FrpLatn => "frp-Latn",
            LanguageTag::Ga => "ga",
            LanguageTag::GaIe => "ga-IE",
            LanguageTag::GdGb => "gd-GB",
            LanguageTag::GdLatn => "gd-Latn",
            LanguageTag::Gl => "gl",
            LanguageTag::GlEs => "gl-ES",
            LanguageTag::Gu => "gu",
            LanguageTag::GuIn => "gu-IN",
            LanguageTag::Ha => "ha",
            LanguageTag::HaLatn => "ha-Latn",
            LanguageTag::HaLatnNg => "ha-Latn-NG",
            LanguageTag::He => "he",
            LanguageTag::HeIl => "he-IL",
            LanguageTag::Hi => "hi",
            LanguageTag::HiIn => "hi-IN",
            LanguageTag::Hr => "hr",
            LanguageTag::HrBa => "hr-BA",
            LanguageTag::HrHr => "hr-HR",
            LanguageTag::Hu => "hu",
            LanguageTag::HuHu => "hu-HU",
            LanguageTag::Hy => "hy",
            LanguageTag::HyAm => "hy-AM",
            LanguageTag::Id => "id",
            LanguageTag::IdId => "id-ID",
            LanguageTag::IgLatn => "ig-Latn",
            LanguageTag::IgNg => "ig-NG",
            LanguageTag::Is => "is",
            LanguageTag::IsIs => "is-IS",
            LanguageTag::It => "it",
            LanguageTag::ItCh => "it-CH",
            LanguageTag::ItIt => "it-IT",
            LanguageTag::IuCans => "iu-Cans",
            LanguageTag::IuLatn => "iu-Latn",
            LanguageTag::IuLatnCa => "iu-Latn-CA",
            LanguageTag::Ja => "ja",
            LanguageTag::JaJp => "ja-JP",
            LanguageTag::Ka => "ka",
            LanguageTag::KaGe => "ka-GE",
            LanguageTag::Kk => "kk",
            LanguageTag::KkKz => "kk-KZ",
            LanguageTag::Km => "km",
            LanguageTag::KmKh => "km-KH",
            LanguageTag::Kn => "kn",
            LanguageTag::KnIn => "kn-IN",
            LanguageTag::Ko => "ko",
            LanguageTag::KoKr => "ko-KR",
            LanguageTag::Kok => "kok",
            LanguageTag::KokIn => "kok-IN",
            LanguageTag::KuArab => "ku-Arab",
            LanguageTag::KuArabIq => "ku-Arab-IQ",
            LanguageTag::KyCyrl => "ky-Cyrl",
            LanguageTag::KyKg => "ky-KG",
            LanguageTag::Lb => "lb",
            LanguageTag::LbLu => "lb-LU",
            LanguageTag::Lo => "lo",
            LanguageTag::LoLa => "lo-LA",
            LanguageTag::Lt => "lt",
            LanguageTag::LtLt => "lt-LT",
            LanguageTag::Lv => "lv",
            LanguageTag::LvLv => "lv-LV",
            LanguageTag::Mi => "mi",
            LanguageTag::MiLatn => "mi-Latn",
            LanguageTag::MiNz => "mi-NZ",
            LanguageTag::Mk => "mk",
            LanguageTag::MkMk => "mk-MK",
            LanguageTag::Ml => "ml",
            LanguageTag::MlIn => "ml-IN",
            LanguageTag::MnCyrl => "mn-Cyrl",
            LanguageTag::MnMn => "mn-MN",
            LanguageTag::MnMong => "mn-Mong",
            LanguageTag::MnPhag => "mn-Phag",
            LanguageTag::Mr => "mr",
            LanguageTag::MrIn => "mr-IN",
            LanguageTag::Ms => "ms",
            LanguageTag::MsBn => "ms-BN",
            LanguageTag::MsMy => "ms-MY",
            LanguageTag::Mt => "mt",
            LanguageTag::MtMt => "mt-MT",
            LanguageTag::Nb => "nb",
            LanguageTag::NbNo => "nb-NO",
            LanguageTag::Ne => "ne",
            LanguageTag::NeNp => "ne-NP",
            LanguageTag::Nl => "nl",
            LanguageTag::NlBe => "nl-BE",
            LanguageTag::NlNl => "nl-NL",
            LanguageTag::Nn => "nn",
            LanguageTag::NnNo => "nn-NO",
            LanguageTag::No => "no",
            LanguageTag::NoNo => "no-NO",
            LanguageTag::Nso => "nso",
            LanguageTag::NsoZa => "nso-ZA",
            LanguageTag::Or => "or",
            LanguageTag::OrIn => "or-IN",
            LanguageTag::Pa => "pa",
            LanguageTag::PaArab => "pa-Arab",
            LanguageTag::PaArabPk => "pa-Arab-PK",
            LanguageTag::PaDeva => "pa-Deva",
            LanguageTag::PaIn => "pa-IN",
            LanguageTag::Pl => "pl",
            LanguageTag::PlPl => "pl-PL",
            LanguageTag::Prs => "prs",
            LanguageTag::PrsAf => "prs-AF",
            LanguageTag::PrsArab => "prs-Arab",
            LanguageTag::Pt => "pt",
            LanguageTag::PtBr => "pt-BR",
            LanguageTag::PtPt => "pt-PT",
            LanguageTag::QucLatn => "quc-Latn",
            LanguageTag::QutGt => "qut-GT",
            LanguageTag::QutLatn => "qut-Latn",
            LanguageTag::Quz => "quz",
            LanguageTag::QuzBo => "quz-BO",
            LanguageTag::QuzEc => "quz-EC",
            LanguageTag::QuzPe => "quz-PE",
            LanguageTag::Ro => "ro",
            LanguageTag::RoRo => "ro-RO",
            LanguageTag::Ru => "ru",
            LanguageTag::RuRu => "ru-RU",
            LanguageTag::Rw => "rw",
            LanguageTag::RwRw => "rw-RW",
            LanguageTag::SdArab => "sd-Arab",
            LanguageTag::SdArabPk => "sd-Arab-PK",
            LanguageTag::SdDeva => "sd-Deva",
            LanguageTag::Si => "si",
            LanguageTag::SiLk => "si-LK",
            LanguageTag::Sk => "sk",
            LanguageTag::SkSk => "sk-SK",
            LanguageTag::Sl => "sl",
            LanguageTag::SlSi => "sl-SI",
            LanguageTag::Sq => "sq",
            LanguageTag::SqAl => "sq-AL",
            LanguageTag::Sr => "sr",
            LanguageTag::SrCyrl => "sr-Cyrl",
            LanguageTag::SrCyrlBa => "sr-Cyrl-BA",
            LanguageTag::SrCyrlCs => "sr-Cyrl-CS",
            LanguageTag::SrCyrlMe => "sr-Cyrl-ME",
            LanguageTag::SrCyrlRs => "sr-Cyrl-RS",
            LanguageTag::SrLatn => "sr-Latn",
            LanguageTag::SrLatnBa => "sr-Latn-BA",
            LanguageTag::SrLatnCs => "sr-Latn-CS",
            LanguageTag::SrLatnMe => "sr-Latn-ME",
            LanguageTag::SrLatnRs => "sr-Latn-RS",
            LanguageTag::Sv => "sv",
            LanguageTag::SvFi => "sv-FI",
            LanguageTag::SvSe => "sv-SE",
            LanguageTag::Sw => "sw",
            LanguageTag::SwKe => "sw-KE",
            LanguageTag::Ta => "ta",
            LanguageTag::TaIn => "ta-IN",
            LanguageTag::Te => "te",
            LanguageTag::TeIn => "te-IN",
            LanguageTag::TgArab => "tg-Arab",
            LanguageTag::TgCyrl => "tg-Cyrl",
            LanguageTag::TgCyrlTj => "tg-Cyrl-TJ",
            LanguageTag::TgLatn => "tg-Latn",
            LanguageTag::Th => "th",
            LanguageTag::ThTh => "th-TH",
            LanguageTag::Ti => "ti",
            LanguageTag::TiEt => "ti-ET",
            LanguageTag::TkCyrl => "tk-Cyrl",
            LanguageTag::TkCyrlTr => "tk-Cyrl-TR",
            LanguageTag::TkLatn => "tk-Latn",
            LanguageTag::TkLatnTr => "tk-Latn-TR",
            LanguageTag::TkTm => "tk-TM",
            LanguageTag::Tn => "tn",
            LanguageTag::TnBw => "tn-BW",
            LanguageTag::TnZa => "tn-ZA",
            LanguageTag::Tr => "tr",
            LanguageTag::TrTr => "tr-TR",
            LanguageTag::TtArab => "tt-Arab",
            LanguageTag::TtCyrl => "tt-Cyrl",
            LanguageTag::TtLatn => "tt-Latn",
            LanguageTag::TtRu => "tt-RU",
            LanguageTag::UgArab => "ug-Arab",
            LanguageTag::UgCn => "ug-CN",
            LanguageTag::UgCyrl => "ug-Cyrl",
            LanguageTag::UgLatn => "ug-Latn",
            LanguageTag::Uk => "uk",
            LanguageTag::UkUa => "uk-UA",
            LanguageTag::Ur => "ur",
            LanguageTag::UrPk => "ur-PK",
            LanguageTag::Uz => "uz",
            LanguageTag::UzCyrl => "uz-Cyrl",
            LanguageTag::UzLatn => "uz-Latn",
            LanguageTag::UzLatnUz => "uz-Latn-UZ",
            LanguageTag::Vi => "vi",
            LanguageTag::ViVn => "vi-VN",
            LanguageTag::Wo => "wo",
            LanguageTag::WoSn => "wo-SN",
            LanguageTag::Xh => "xh",
            LanguageTag::XhZa => "xh-ZA",
            LanguageTag::YoLatn => "yo-Latn",
            LanguageTag::YoNg => "yo-NG",
            LanguageTag::ZhCn => "zh-CN",
            LanguageTag::ZhHans => "zh-Hans",
            LanguageTag::ZhHansCn => "zh-Hans-CN",
            LanguageTag::ZhHansSg => "zh-Hans-SG",
            LanguageTag::ZhHant => "zh-Hant",
            LanguageTag::ZhHantHk => "zh-Hant-HK",
            LanguageTag::ZhHantMo => "zh-Hant-MO",
            LanguageTag::ZhHantTw => "zh-Hant-TW",
            LanguageTag::ZhHk => "zh-HK",
            LanguageTag::ZhMo => "zh-MO",
            LanguageTag::ZhSg => "zh-SG",
            LanguageTag::ZhTw => "zh-TW",
            LanguageTag::Zu => "zu",
            LanguageTag::ZuZa => "zu-ZA",
        }
    }

    /// Returns the English name from the registry.
    pub fn english_name(&self) -> &'static str {
        match self {
            LanguageTag::Af => "Afrikaans",
            LanguageTag::AfZa => "Afrikaans",
            LanguageTag::Am => "Amharic",
            LanguageTag::AmEt => "Amharic",
            LanguageTag::Ar => "Arabic",
            LanguageTag::ArAe => "Arabic",
            LanguageTag::ArBh => "Arabic",
            LanguageTag::ArDz => "Arabic",
            LanguageTag::ArEg => "Arabic",
            LanguageTag::ArIq => "Arabic",
            LanguageTag::ArJo => "Arabic",
            LanguageTag::ArKw => "Arabic",
            LanguageTag::ArLb => "Arabic",
            LanguageTag::ArLy => "Arabic",
            LanguageTag::ArMa => "Arabic",
            LanguageTag::ArOm => "Arabic",
            LanguageTag::ArQa => "Arabic",
            LanguageTag::ArSa => "Arabic",
            LanguageTag::ArSy => "Arabic",
            LanguageTag::ArTn => "Arabic",
            LanguageTag::ArYe => "Arabic",
            LanguageTag::As => "Assamese",
            LanguageTag::AsIn => "Assamese",
            LanguageTag::AzArab => "Azerbaijani",
            LanguageTag::AzArabAz => "Azerbaijani",
            LanguageTag::AzCyrl => "Azerbaijani",
            LanguageTag::AzCyrlAz => "Azerbaijani",
            LanguageTag::AzLatn => "Azerbaijani",
            LanguageTag::AzLatnAz => "Azerbaijani",
            LanguageTag::Be => "Belarusian",
            LanguageTag::BeBy => "Belarusian",
            LanguageTag::Bg => "Bulgarian",
            LanguageTag::BgBg => "Bulgarian",
            LanguageTag::Bn => "Bangla",
            LanguageTag::BnBd => "Bangla",
            LanguageTag::BnIn => "Bangla",
            LanguageTag::Bs => "Bosnian",
            LanguageTag::BsCyrl => "Bosnian",
            LanguageTag::BsCyrlBa => "Bosnian",
            LanguageTag::BsLatn => "Bosnian",
            LanguageTag::BsLatnBa => "Bosnian",
            LanguageTag::Ca => "Catalan",
            LanguageTag::CaEs => "Catalan",
            LanguageTag::CaEsValencia => "Catalan",
            LanguageTag::ChrCher => "Cherokee",
            LanguageTag::ChrCherUs => "Cherokee",
            LanguageTag::ChrLatn => "Cherokee",
            LanguageTag::Cs => "Czech",
            LanguageTag::CsCz => "Czech",
            LanguageTag::Cy => "Welsh",
            LanguageTag::CyGb => "Welsh",
            LanguageTag::Da => "Danish",
            LanguageTag::DaDk => "Danish",
            LanguageTag::De => "German",
            LanguageTag::DeAt => "German",
            LanguageTag::DeCh => "German",
            LanguageTag::DeDe => "German",
            LanguageTag::DeLi => "German",
            LanguageTag::DeLu => "German",
            LanguageTag::El => "Greek",
            LanguageTag::ElGr => "Greek",
            LanguageTag::En => "English",
            LanguageTag::En011 => "English",
            LanguageTag::En014 => "English",
            LanguageTag::En018 => "English",
            LanguageTag::En021 => "English",
            LanguageTag::En029 => "English",
            LanguageTag::En053 => "English",
            LanguageTag::EnAu => "English",
            LanguageTag::EnBz => "English",
            LanguageTag::EnCa => "English",
            LanguageTag::EnGb => "English",
            LanguageTag::EnHk => "English",
            LanguageTag::EnId => "English",
            LanguageTag::EnIe => "English",
            LanguageTag::EnIn => "English",
            LanguageTag::EnJm => "English",
            LanguageTag::EnKz => "English",
            LanguageTag::EnMt => "English",
            LanguageTag::EnMy => "English",
            LanguageTag::EnNz => "English",
            LanguageTag::EnPh => "English",
            LanguageTag::EnPk => "English",
            LanguageTag::EnSg => "English",
            LanguageTag::EnTt => "English",
            LanguageTag::EnUs => "English",
            LanguageTag::EnVn => "English",
            LanguageTag::EnZa => "English",
            LanguageTag::EnZw => "English",
            LanguageTag::Es => "Spanish",
            LanguageTag::Es019 => "Spanish",
            LanguageTag::Es419 => "Spanish",
            LanguageTag::EsAr => "Spanish",
            LanguageTag::EsBo => "Spanish",
            LanguageTag::EsCl => "Spanish",
            LanguageTag::EsCo => "Spanish",
            LanguageTag::EsCr => "Spanish",
            LanguageTag::EsDo => "Spanish",
            LanguageTag::EsEc => "Spanish",
            LanguageTag::EsEs => "Spanish",
            LanguageTag::EsGt => "Spanish",
            LanguageTag::EsHn => "Spanish",
            LanguageTag::EsMx => "Spanish",
            LanguageTag::EsNi => "Spanish",
            LanguageTag::EsPa => "Spanish",
            LanguageTag::EsPe => "Spanish",
            LanguageTag::EsPr => "Spanish",
            LanguageTag::EsPy => "Spanish",
            LanguageTag::EsSv => "Spanish",
            LanguageTag::EsUs => "Spanish",
            LanguageTag::EsUy => "Spanish",
            LanguageTag::EsVe => "Spanish",
            LanguageTag::Et => "Estonian",
            LanguageTag::EtEe => "Estonian",
            LanguageTag::Eu => "Basque",
            LanguageTag::EuEs => "Basque",
            LanguageTag::Fa => "Persian",
            LanguageTag::FaIr => "Persian",
            LanguageTag::Fi => "Finnish",
            LanguageTag::FiFi => "Finnish",
            LanguageTag::Fil => "Filipino",
            LanguageTag::FilLatn => "Filipino",
            LanguageTag::FilPh => "Filipino",
            LanguageTag::Fr => "French",
            LanguageTag::Fr011 => "French",
            LanguageTag::Fr015 => "French",
            LanguageTag::Fr021 => "French",
            LanguageTag::Fr029 => "French",
            LanguageTag::Fr155 => "French",
            LanguageTag::FrBe => "French",
            LanguageTag::FrCa => "French",
            LanguageTag::FrCd => "French",
            LanguageTag::FrCh => "French",
            LanguageTag::FrCi => "French",
            LanguageTag::FrCm => "French",
            LanguageTag::FrFr => "French",
            LanguageTag::FrHt => "French",
            LanguageTag::FrLu => "French",
            LanguageTag::FrMa => "French",
            LanguageTag::FrMc => "French",
            LanguageTag::FrMl => "French",
            LanguageTag::FrRe => "French",
            LanguageTag::FrcLatn => "French (Cajun)",
            LanguageTag::FrpLatn => "Franco-Provençal",
            LanguageTag::Ga => "Irish",
            LanguageTag::GaIe => "Irish",
            LanguageTag::GdGb => "Scottish Gaelic",
            LanguageTag::GdLatn => "Scottish Gaelic",
            LanguageTag::Gl => "Galician",
            LanguageTag::GlEs => "Galician",
            LanguageTag::Gu => "Gujarati",
            LanguageTag::GuIn => "Gujarati",
            LanguageTag::Ha => "Hausa",
            LanguageTag::HaLatn => "Hausa",
            LanguageTag::HaLatnNg => "Hausa",
            LanguageTag::He => "Hebrew",
            LanguageTag::HeIl => "Hebrew",
            LanguageTag::Hi => "Hindi",
            LanguageTag::HiIn => "Hindi",
            LanguageTag::Hr => "Croatian",
            LanguageTag::HrBa => "Croatian",
            LanguageTag::HrHr => "Croatian",
            LanguageTag::Hu => "Hungarian",
            LanguageTag::HuHu => "Hungarian",
            LanguageTag::Hy => "Armenian",
            LanguageTag::HyAm => "Armenian",
            LanguageTag::Id => "Indonesian",
            LanguageTag::IdId => "Indonesian",
            LanguageTag::IgLatn => "Igbo",
            LanguageTag::IgNg => "Igbo",
            LanguageTag::Is => "Icelandic",
            LanguageTag::IsIs => "Icelandic",
            LanguageTag::It => "Italian",
            LanguageTag::ItCh => "Italian",
            LanguageTag::ItIt => "Italian",
            LanguageTag::IuCans => "Inuktitut",
            LanguageTag::IuLatn => "Inuktitut",
            LanguageTag::IuLatnCa => "Inuktitut",
            LanguageTag::Ja => "Japanese",
            LanguageTag::JaJp => "Japanese",
            LanguageTag::Ka => "Georgian",
            LanguageTag::KaGe => "Georgian",
            LanguageTag::Kk => "Kazakh",
            LanguageTag::KkKz => "Kazakh",
            LanguageTag::Km => "Khmer",
            LanguageTag::KmKh => "Khmer",
            LanguageTag::Kn => "Kannada",
            LanguageTag::KnIn => "Kannada",
            LanguageTag::Ko => "Korean",
            LanguageTag::KoKr => "Korean",
            LanguageTag::Kok => "Konkani",
            LanguageTag::KokIn => "Konkani",
            LanguageTag::KuArab => "Kurdish",
            LanguageTag::KuArabIq => "Kurdish",
            LanguageTag::KyCyrl => "Kyrgyz",
            LanguageTag::KyKg => "Kyrgyz",
            LanguageTag::Lb => "Luxembourgish",
            LanguageTag::LbLu => "Luxembourgish",
            LanguageTag::Lo => "Lao",
            LanguageTag::LoLa => "Lao",
            LanguageTag::Lt => "Lithuanian",
            LanguageTag::LtLt => "Lithuanian",
            LanguageTag::Lv => "Latvian",
            LanguageTag::LvLv => "Latvian",
            LanguageTag::Mi => "Maori",
            LanguageTag::MiLatn => "Maori",
            LanguageTag::MiNz => "Maori",
            LanguageTag::Mk => "Macedonian",
            LanguageTag::MkMk => "Macedonian",
            LanguageTag::Ml => "Malayalam",
            LanguageTag::MlIn => "Malayalam",
            LanguageTag::MnCyrl => "Mongolian",
            LanguageTag::MnMn => "Mongolian",
            LanguageTag::MnMong => "Mongolian",
            LanguageTag::MnPhag => "Mongolian",
            LanguageTag::Mr => "Marathi",
            LanguageTag::MrIn => "Marathi",
            LanguageTag::Ms => "Malay",
            LanguageTag::MsBn => "Malay",
            LanguageTag::MsMy => "Malay",
            LanguageTag::Mt => "Maltese",
            LanguageTag::MtMt => "Maltese",
            LanguageTag::Nb => "Norwegian Bokmål",
            LanguageTag::NbNo => "Norwegian Bokmål",
            LanguageTag::Ne => "Nepali",
            LanguageTag::NeNp => "Nepali",
            LanguageTag::Nl => "Dutch",
            LanguageTag::NlBe => "Dutch",
            LanguageTag::NlNl => "Dutch",
            LanguageTag::Nn => "Norwegian Nynorsk",
            LanguageTag::NnNo => "Norwegian Nynorsk",
            LanguageTag::No => "Norwegian",
            LanguageTag::NoNo => "Norwegian",
            LanguageTag::Nso => "Sesotho sa Leboa",
            LanguageTag::NsoZa => "Sesotho sa Leboa",
            LanguageTag::Or => "Odia",
            LanguageTag::OrIn => "Odia",
            LanguageTag::Pa => "Punjabi",
            LanguageTag::PaArab => "Punjabi",
            LanguageTag::PaArabPk => "Punjabi",
            LanguageTag::PaDeva => "Punjabi",
            LanguageTag::PaIn => "Punjabi",
            LanguageTag::Pl => "Polish",
            LanguageTag::PlPl => "Polish",
            LanguageTag::Prs => "Dari",
            LanguageTag::PrsAf => "Dari",
            LanguageTag::PrsArab => "Dari",
            LanguageTag::Pt => "Portuguese (Portugal)",
            LanguageTag::PtBr => "Portuguese (Brazil)",
            LanguageTag::PtPt => "Portuguese (Portugal)",
            LanguageTag::QucLatn => "K'iche'",
            LanguageTag::QutGt => "K'iche'",
            LanguageTag::QutLatn => "K'iche'",
            LanguageTag::Quz => "Quechua",
            LanguageTag::QuzBo => "Quechua",
            LanguageTag::QuzEc => "Quechua",
            LanguageTag::QuzPe => "Quechua",
            LanguageTag::Ro => "Romanian",
            LanguageTag::RoRo => "Romanian",
            LanguageTag::Ru => "Russian",
            LanguageTag::RuRu => "Russian",
            LanguageTag::Rw => "Kinyarwanda",
            LanguageTag::RwRw => "Kinyarwanda",
            LanguageTag::SdArab => "Sindhi",
            LanguageTag::SdArabPk => "Sindhi",
            LanguageTag::SdDeva => "Sindhi",
            LanguageTag::Si => "Sinhala",
            LanguageTag::SiLk => "Sinhala",
            LanguageTag::Sk => "Slovak",
            LanguageTag::SkSk => "Slovak",
            LanguageTag::Sl => "Slovenian",
            LanguageTag::SlSi => "Slovenian",
            LanguageTag::Sq => "Albanian",
            LanguageTag::SqAl => "Albanian",
            LanguageTag::Sr => "Serbian",
            LanguageTag::SrCyrl => "Serbian (Cyrillic)",
            LanguageTag::SrCyrlBa => "Serbian (Cyrillic)",
            LanguageTag::SrCyrlCs => "Serbian (Cyrillic)",
            LanguageTag::SrCyrlMe => "Serbian (Cyrillic)",
            LanguageTag::SrCyrlRs => "Serbian (Cyrillic)",
            LanguageTag::SrLatn => "Serbian (Latin)",
            LanguageTag::SrLatnBa => "Serbian (Latin)",
            LanguageTag::SrLatnCs => "Serbian (Latin)",
            LanguageTag::SrLatnMe => "Serbian (Latin)",
            LanguageTag::SrLatnRs => "Serbian (Latin)",
            LanguageTag::Sv => "Swedish",
            LanguageTag::SvFi => "Swedish",
            LanguageTag::SvSe => "Swedish",
            LanguageTag::Sw => "KiSwahili",
            LanguageTag::SwKe => "KiSwahili",
            LanguageTag::Ta => "Tamil",
            LanguageTag::TaIn => "Tamil",
            LanguageTag::Te => "Telugu",
            LanguageTag::TeIn => "Telugu",
            LanguageTag::TgArab => "Tajik",
            LanguageTag::TgCyrl => "Tajik",
            LanguageTag::TgCyrlTj => "Tajik",
            LanguageTag::TgLatn => "Tajik",
            LanguageTag::Th => "Thai",
            LanguageTag::ThTh => "Thai",
            LanguageTag::Ti => "Tigrinya",
            LanguageTag::TiEt => "Tigrinya",
            LanguageTag::TkCyrl => "Turkmen",
            LanguageTag::TkCyrlTr => "Turkmen",
            LanguageTag::TkLatn => "Turkmen",
            LanguageTag::TkLatnTr => "Turkmen",
            LanguageTag::TkTm => "Turkmen",
            LanguageTag::Tn => "Setswana",
            LanguageTag::TnBw => "Setswana",
            LanguageTag::TnZa => "Setswana",
            LanguageTag::Tr => "Turkish",
            LanguageTag::TrTr => "Turkish",
            LanguageTag::TtArab => "Tatar",
            LanguageTag::TtCyrl => "Tatar",
            LanguageTag::TtLatn => "Tatar",
            LanguageTag::TtRu => "Tatar",
            LanguageTag::UgArab => "Uyghur",
            LanguageTag::UgCn => "Uyghur",
            LanguageTag::UgCyrl => "Uyghur",
            LanguageTag::UgLatn => "Uyghur",
            LanguageTag::Uk => "Ukrainian",
            LanguageTag::UkUa => "Ukrainian",
            LanguageTag::Ur => "Urdu",
            LanguageTag::UrPk => "Urdu",
            LanguageTag::Uz => "Uzbek",
            LanguageTag::UzCyrl => "Uzbek",
            LanguageTag::UzLatn => "Uzbek",
            LanguageTag::UzLatnUz => "Uzbek",
            LanguageTag::Vi => "Vietnamese",
            LanguageTag::ViVn => "Vietnamese",
            LanguageTag::Wo => "Wolof",
            LanguageTag::WoSn => "Wolof",
            LanguageTag::Xh => "isiXhosa",
            LanguageTag::XhZa => "isiXhosa",
            LanguageTag::YoLatn => "Yoruba",
            LanguageTag::YoNg => "Yoruba",
            LanguageTag::ZhCn => "Chinese (Simplified)",
            LanguageTag::ZhHans => "Chinese (Simplified)",
            LanguageTag::ZhHansCn => "Chinese (Simplified)",
            LanguageTag::ZhHansSg => "Chinese (Simplified)",
            LanguageTag::ZhHant => "Chinese (Traditional)",
            LanguageTag::ZhHantHk => "Chinese (Traditional)",
            LanguageTag::ZhHantMo => "Chinese (Traditional)",
            LanguageTag::ZhHantTw => "Chinese (Traditional)",
            LanguageTag::ZhHk => "Chinese (Traditional)",
            LanguageTag::ZhMo => "Chinese (Traditional)",
            LanguageTag::ZhSg => "Chinese (Simplified)",
            LanguageTag::ZhTw => "Chinese (Traditional)",
            LanguageTag::Zu => "isiZulu",
            LanguageTag::ZuZa => "isiZulu",
        }
    }

    /// Iterates over every variant in code order.
    pub fn all() -> &'static [LanguageTag] {
        &[LanguageTag::Af, LanguageTag::AfZa, LanguageTag::Am, LanguageTag::AmEt, LanguageTag::Ar, LanguageTag::ArAe, LanguageTag::ArBh, LanguageTag::ArDz, LanguageTag::ArEg, LanguageTag::ArIq, LanguageTag::ArJo, LanguageTag::ArKw, LanguageTag::ArLb, LanguageTag::ArLy, LanguageTag::ArMa, LanguageTag::ArOm, LanguageTag::ArQa, LanguageTag::ArSa, LanguageTag::ArSy, LanguageTag::ArTn, LanguageTag::ArYe, LanguageTag::As, LanguageTag::AsIn, LanguageTag::AzArab, LanguageTag::AzArabAz, LanguageTag::AzCyrl, LanguageTag::AzCyrlAz, LanguageTag::AzLatn, LanguageTag::AzLatnAz, LanguageTag::Be, LanguageTag::BeBy, LanguageTag::Bg, LanguageTag::BgBg, LanguageTag::Bn, LanguageTag::BnBd, LanguageTag::BnIn, LanguageTag::Bs, LanguageTag::BsCyrl, LanguageTag::BsCyrlBa, LanguageTag::BsLatn, LanguageTag::BsLatnBa, LanguageTag::Ca, LanguageTag::CaEs, LanguageTag::CaEsValencia, LanguageTag::ChrCher, LanguageTag::ChrCherUs, LanguageTag::ChrLatn, LanguageTag::Cs, LanguageTag::CsCz, LanguageTag::Cy, LanguageTag::CyGb, LanguageTag::Da, LanguageTag::DaDk, LanguageTag::De, LanguageTag::DeAt, LanguageTag::DeCh, LanguageTag::DeDe, LanguageTag::DeLi, LanguageTag::DeLu, LanguageTag::El, LanguageTag::ElGr, LanguageTag::En, LanguageTag::En011, LanguageTag::En014, LanguageTag::En018, LanguageTag::En021, LanguageTag::En029, LanguageTag::En053, LanguageTag::EnAu, LanguageTag::EnBz, LanguageTag::EnCa, LanguageTag::EnGb, LanguageTag::EnHk, LanguageTag::EnId, LanguageTag::EnIe, LanguageTag::EnIn, LanguageTag::EnJm, LanguageTag::EnKz, LanguageTag::EnMt, LanguageTag::EnMy, LanguageTag::EnNz, LanguageTag::EnPh, LanguageTag::EnPk, LanguageTag::EnSg, LanguageTag::EnTt, LanguageTag::EnUs, LanguageTag::EnVn, LanguageTag::EnZa, LanguageTag::EnZw, LanguageTag::Es, LanguageTag::Es019, LanguageTag::Es419, LanguageTag::EsAr, LanguageTag::EsBo, LanguageTag::EsCl, LanguageTag::EsCo, LanguageTag::EsCr, LanguageTag::EsDo, LanguageTag::EsEc, LanguageTag::EsEs, LanguageTag::EsGt, LanguageTag::EsHn, LanguageTag::EsMx, LanguageTag::EsNi, LanguageTag::EsPa, LanguageTag::EsPe, LanguageTag::EsPr, LanguageTag::EsPy, LanguageTag::EsSv, LanguageTag::EsUs, LanguageTag::EsUy, LanguageTag::EsVe, LanguageTag::Et, LanguageTag::EtEe, LanguageTag::Eu, LanguageTag::EuEs, LanguageTag::Fa, LanguageTag::FaIr, LanguageTag::Fi, LanguageTag::FiFi, LanguageTag::Fil, LanguageTag::FilLatn, LanguageTag::FilPh, LanguageTag::Fr, LanguageTag::Fr011, LanguageTag::Fr015, LanguageTag::Fr021, LanguageTag::Fr029, LanguageTag::Fr155, LanguageTag::FrBe, LanguageTag::FrCa, LanguageTag::FrCd, LanguageTag::FrCh, LanguageTag::FrCi, LanguageTag::FrCm, LanguageTag::FrFr, LanguageTag::FrHt, LanguageTag::FrLu, LanguageTag::FrMa, LanguageTag::FrMc, LanguageTag::FrMl, LanguageTag::FrRe, LanguageTag::FrcLatn, LanguageTag::FrpLatn, LanguageTag::Ga, LanguageTag::GaIe, LanguageTag::GdGb, LanguageTag::GdLatn, LanguageTag::Gl, LanguageTag::GlEs, LanguageTag::Gu, LanguageTag::GuIn, LanguageTag::Ha, LanguageTag::HaLatn, LanguageTag::HaLatnNg, LanguageTag::He, LanguageTag::HeIl, LanguageTag::Hi, LanguageTag::HiIn, LanguageTag::Hr, LanguageTag::HrBa, LanguageTag::HrHr, LanguageTag::Hu, LanguageTag::HuHu, LanguageTag::Hy, LanguageTag::HyAm, LanguageTag::Id, LanguageTag::IdId, LanguageTag::IgLatn, LanguageTag::IgNg, LanguageTag::Is, LanguageTag::IsIs, LanguageTag::It, LanguageTag::ItCh, LanguageTag::ItIt, LanguageTag::IuCans, LanguageTag::IuLatn, LanguageTag::IuLatnCa, LanguageTag::Ja, LanguageTag::JaJp, LanguageTag::Ka, LanguageTag::KaGe, LanguageTag::Kk, LanguageTag::KkKz, LanguageTag::Km, LanguageTag::KmKh, LanguageTag::Kn, LanguageTag::KnIn, LanguageTag::Ko, LanguageTag::KoKr, LanguageTag::Kok, LanguageTag::KokIn, LanguageTag::KuArab, LanguageTag::KuArabIq, LanguageTag::KyCyrl, LanguageTag::KyKg, LanguageTag::Lb, LanguageTag::LbLu, LanguageTag::Lo, LanguageTag::LoLa, LanguageTag::Lt, LanguageTag::LtLt, LanguageTag::Lv, LanguageTag::LvLv, LanguageTag::Mi, LanguageTag::MiLatn, LanguageTag::MiNz, LanguageTag::Mk, LanguageTag::MkMk, LanguageTag::Ml, LanguageTag::MlIn, LanguageTag::MnCyrl, LanguageTag::MnMn, LanguageTag::MnMong, LanguageTag::MnPhag, LanguageTag::Mr, LanguageTag::MrIn, LanguageTag::Ms, LanguageTag::MsBn, LanguageTag::MsMy, LanguageTag::Mt, LanguageTag::MtMt, LanguageTag::Nb, LanguageTag::NbNo, LanguageTag::Ne, LanguageTag::NeNp, LanguageTag::Nl, LanguageTag::NlBe, LanguageTag::NlNl, LanguageTag::Nn, LanguageTag::NnNo, LanguageTag::No, LanguageTag::NoNo, LanguageTag::Nso, LanguageTag::NsoZa, LanguageTag::Or, LanguageTag::OrIn, LanguageTag::Pa, LanguageTag::PaArab, LanguageTag::PaArabPk, LanguageTag::PaDeva, LanguageTag::PaIn, LanguageTag::Pl, LanguageTag::PlPl, LanguageTag::Prs, LanguageTag::PrsAf, LanguageTag::PrsArab, LanguageTag::Pt, LanguageTag::PtBr, LanguageTag::PtPt, LanguageTag::QucLatn, LanguageTag::QutGt, LanguageTag::QutLatn, LanguageTag::Quz, LanguageTag::QuzBo, LanguageTag::QuzEc, LanguageTag::QuzPe, LanguageTag::Ro, LanguageTag::RoRo, LanguageTag::Ru, LanguageTag::RuRu, LanguageTag::Rw, LanguageTag::RwRw, LanguageTag::SdArab, LanguageTag::SdArabPk, LanguageTag::SdDeva, LanguageTag::Si, LanguageTag::SiLk, LanguageTag::Sk, LanguageTag::SkSk, LanguageTag::Sl, LanguageTag::SlSi, LanguageTag::Sq, LanguageTag::SqAl, LanguageTag::Sr, LanguageTag::SrCyrl, LanguageTag::SrCyrlBa, LanguageTag::SrCyrlCs, LanguageTag::SrCyrlMe, LanguageTag::SrCyrlRs, LanguageTag::SrLatn, LanguageTag::SrLatnBa, LanguageTag::SrLatnCs, LanguageTag::SrLatnMe, LanguageTag::SrLatnRs, LanguageTag::Sv, LanguageTag::SvFi, LanguageTag::SvSe, LanguageTag::Sw, LanguageTag::SwKe, LanguageTag::Ta, LanguageTag::TaIn, LanguageTag::Te, LanguageTag::TeIn, LanguageTag::TgArab, LanguageTag::TgCyrl, LanguageTag::TgCyrlTj, LanguageTag::TgLatn, LanguageTag::Th, LanguageTag::ThTh, LanguageTag::Ti, LanguageTag::TiEt, LanguageTag::TkCyrl, LanguageTag::TkCyrlTr, LanguageTag::TkLatn, LanguageTag::TkLatnTr, LanguageTag::TkTm, LanguageTag::Tn, LanguageTag::TnBw, LanguageTag::TnZa, LanguageTag::Tr, LanguageTag::TrTr, LanguageTag::TtArab, LanguageTag::TtCyrl, LanguageTag::TtLatn, LanguageTag::TtRu, LanguageTag::UgArab, LanguageTag::UgCn, LanguageTag::UgCyrl, LanguageTag::UgLatn, LanguageTag::Uk, LanguageTag::UkUa, LanguageTag::Ur, LanguageTag::UrPk, LanguageTag::Uz, LanguageTag::UzCyrl, LanguageTag::UzLatn, LanguageTag::UzLatnUz, LanguageTag::Vi, LanguageTag::ViVn, LanguageTag::Wo, LanguageTag::WoSn, LanguageTag::Xh, LanguageTag::XhZa, LanguageTag::YoLatn, LanguageTag::YoNg, LanguageTag::ZhCn, LanguageTag::ZhHans, LanguageTag::ZhHansCn, LanguageTag::ZhHansSg, LanguageTag::ZhHant, LanguageTag::ZhHantHk, LanguageTag::ZhHantMo, LanguageTag::ZhHantTw, LanguageTag::ZhHk, LanguageTag::ZhMo, LanguageTag::ZhSg, LanguageTag::ZhTw, LanguageTag::Zu, LanguageTag::ZuZa]
    }
}

impl FromStr for LanguageTag {
    type Err = String;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_ascii_lowercase().as_str() {
            "af" => Ok(LanguageTag::Af),
            "af-za" => Ok(LanguageTag::AfZa),
            "am" => Ok(LanguageTag::Am),
            "am-et" => Ok(LanguageTag::AmEt),
            "ar" => Ok(LanguageTag::Ar),
            "ar-ae" => Ok(LanguageTag::ArAe),
            "ar-bh" => Ok(LanguageTag::ArBh),
            "ar-dz" => Ok(LanguageTag::ArDz),
            "ar-eg" => Ok(LanguageTag::ArEg),
            "ar-iq" => Ok(LanguageTag::ArIq),
            "ar-jo" => Ok(LanguageTag::ArJo),
            "ar-kw" => Ok(LanguageTag::ArKw),
            "ar-lb" => Ok(LanguageTag::ArLb),
            "ar-ly" => Ok(LanguageTag::ArLy),
            "ar-ma" => Ok(LanguageTag::ArMa),
            "ar-om" => Ok(LanguageTag::ArOm),
            "ar-qa" => Ok(LanguageTag::ArQa),
            "ar-sa" => Ok(LanguageTag::ArSa),
            "ar-sy" => Ok(LanguageTag::ArSy),
            "ar-tn" => Ok(LanguageTag::ArTn),
            "ar-ye" => Ok(LanguageTag::ArYe),
            "as" => Ok(LanguageTag::As),
            "as-in" => Ok(LanguageTag::AsIn),
            "az-arab" => Ok(LanguageTag::AzArab),
            "az-arab-az" => Ok(LanguageTag::AzArabAz),
            "az-cyrl" => Ok(LanguageTag::AzCyrl),
            "az-cyrl-az" => Ok(LanguageTag::AzCyrlAz),
            "az-latn" => Ok(LanguageTag::AzLatn),
            "az-latn-az" => Ok(LanguageTag::AzLatnAz),
            "be" => Ok(LanguageTag::Be),
            "be-by" => Ok(LanguageTag::BeBy),
            "bg" => Ok(LanguageTag::Bg),
            "bg-bg" => Ok(LanguageTag::BgBg),
            "bn" => Ok(LanguageTag::Bn),
            "bn-bd" => Ok(LanguageTag::BnBd),
            "bn-in" => Ok(LanguageTag::BnIn),
            "bs" => Ok(LanguageTag::Bs),
            "bs-cyrl" => Ok(LanguageTag::BsCyrl),
            "bs-cyrl-ba" => Ok(LanguageTag::BsCyrlBa),
            "bs-latn" => Ok(LanguageTag::BsLatn),
            "bs-latn-ba" => Ok(LanguageTag::BsLatnBa),
            "ca" => Ok(LanguageTag::Ca),
            "ca-es" => Ok(LanguageTag::CaEs),
            "ca-es-valencia" => Ok(LanguageTag::CaEsValencia),
            "chr-cher" => Ok(LanguageTag::ChrCher),
            "chr-cher-us" => Ok(LanguageTag::ChrCherUs),
            "chr-latn" => Ok(LanguageTag::ChrLatn),
            "cs" => Ok(LanguageTag::Cs),
            "cs-cz" => Ok(LanguageTag::CsCz),
            "cy" => Ok(LanguageTag::Cy),
            "cy-gb" => Ok(LanguageTag::CyGb),
            "da" => Ok(LanguageTag::Da),
            "da-dk" => Ok(LanguageTag::DaDk),
            "de" => Ok(LanguageTag::De),
            "de-at" => Ok(LanguageTag::DeAt),
            "de-ch" => Ok(LanguageTag::DeCh),
            "de-de" => Ok(LanguageTag::DeDe),
            "de-li" => Ok(LanguageTag::DeLi),
            "de-lu" => Ok(LanguageTag::DeLu),
            "el" => Ok(LanguageTag::El),
            "el-gr" => Ok(LanguageTag::ElGr),
            "en" => Ok(LanguageTag::En),
            "en-011" => Ok(LanguageTag::En011),
            "en-014" => Ok(LanguageTag::En014),
            "en-018" => Ok(LanguageTag::En018),
            "en-021" => Ok(LanguageTag::En021),
            "en-029" => Ok(LanguageTag::En029),
            "en-053" => Ok(LanguageTag::En053),
            "en-au" => Ok(LanguageTag::EnAu),
            "en-bz" => Ok(LanguageTag::EnBz),
            "en-ca" => Ok(LanguageTag::EnCa),
            "en-gb" => Ok(LanguageTag::EnGb),
            "en-hk" => Ok(LanguageTag::EnHk),
            "en-id" => Ok(LanguageTag::EnId),
            "en-ie" => Ok(LanguageTag::EnIe),
            "en-in" => Ok(LanguageTag::EnIn),
            "en-jm" => Ok(LanguageTag::EnJm),
            "en-kz" => Ok(LanguageTag::EnKz),
            "en-mt" => Ok(LanguageTag::EnMt),
            "en-my" => Ok(LanguageTag::EnMy),
            "en-nz" => Ok(LanguageTag::EnNz),
            "en-ph" => Ok(LanguageTag::EnPh),
            "en-pk" => Ok(LanguageTag::EnPk),
            "en-sg" => Ok(LanguageTag::EnSg),
            "en-tt" => Ok(LanguageTag::EnTt),
            "en-us" => Ok(LanguageTag::EnUs),
            "en-vn" => Ok(LanguageTag::EnVn),
            "en-za" => Ok(LanguageTag::EnZa),
            "en-zw" => Ok(LanguageTag::EnZw),
            "es" => Ok(LanguageTag::Es),
            "es-019" => Ok(LanguageTag::Es019),
            "es-419" => Ok(LanguageTag::Es419),
            "es-ar" => Ok(LanguageTag::EsAr),
            "es-bo" => Ok(LanguageTag::EsBo),
            "es-cl" => Ok(LanguageTag::EsCl),
            "es-co" => Ok(LanguageTag::EsCo),
            "es-cr" => Ok(LanguageTag::EsCr),
            "es-do" => Ok(LanguageTag::EsDo),
            "es-ec" => Ok(LanguageTag::EsEc),
            "es-es" => Ok(LanguageTag::EsEs),
            "es-gt" => Ok(LanguageTag::EsGt),
            "es-hn" => Ok(LanguageTag::EsHn),
            "es-mx" => Ok(LanguageTag::EsMx),
            "es-ni" => Ok(LanguageTag::EsNi),
            "es-pa" => Ok(LanguageTag::EsPa),
            "es-pe" => Ok(LanguageTag::EsPe),
            "es-pr" => Ok(LanguageTag::EsPr),
            "es-py" => Ok(LanguageTag::EsPy),
            "es-sv" => Ok(LanguageTag::EsSv),
            "es-us" => Ok(LanguageTag::EsUs),
            "es-uy" => Ok(LanguageTag::EsUy),
            "es-ve" => Ok(LanguageTag::EsVe),
            "et" => Ok(LanguageTag::Et),
            "et-ee" => Ok(LanguageTag::EtEe),
            "eu" => Ok(LanguageTag::Eu),
            "eu-es" => Ok(LanguageTag::EuEs),
            "fa" => Ok(LanguageTag::Fa),
            "fa-ir" => Ok(LanguageTag::FaIr),
            "fi" => Ok(LanguageTag::Fi),
            "fi-fi" => Ok(LanguageTag::FiFi),
            "fil" => Ok(LanguageTag::Fil),
            "fil-latn" => Ok(LanguageTag::FilLatn),
            "fil-ph" => Ok(LanguageTag::FilPh),
            "fr" => Ok(LanguageTag::Fr),
            "fr-011" => Ok(LanguageTag::Fr011),
            "fr-015" => Ok(LanguageTag::Fr015),
            "fr-021" => Ok(LanguageTag::Fr021),
            "fr-029" => Ok(LanguageTag::Fr029),
            "fr-155" => Ok(LanguageTag::Fr155),
            "fr-be" => Ok(LanguageTag::FrBe),
            "fr-ca" => Ok(LanguageTag::FrCa),
            "fr-cd" => Ok(LanguageTag::FrCd),
            "fr-ch" => Ok(LanguageTag::FrCh),
            "fr-ci" => Ok(LanguageTag::FrCi),
            "fr-cm" => Ok(LanguageTag::FrCm),
            "fr-fr" => Ok(LanguageTag::FrFr),
            "fr-ht" => Ok(LanguageTag::FrHt),
            "fr-lu" => Ok(LanguageTag::FrLu),
            "fr-ma" => Ok(LanguageTag::FrMa),
            "fr-mc" => Ok(LanguageTag::FrMc),
            "fr-ml" => Ok(LanguageTag::FrMl),
            "fr-re" => Ok(LanguageTag::FrRe),
            "frc-latn" => Ok(LanguageTag::FrcLatn),
            "frp-latn" => Ok(LanguageTag::FrpLatn),
            "ga" => Ok(LanguageTag::Ga),
            "ga-ie" => Ok(LanguageTag::GaIe),
            "gd-gb" => Ok(LanguageTag::GdGb),
            "gd-latn" => Ok(LanguageTag::GdLatn),
            "gl" => Ok(LanguageTag::Gl),
            "gl-es" => Ok(LanguageTag::GlEs),
            "gu" => Ok(LanguageTag::Gu),
            "gu-in" => Ok(LanguageTag::GuIn),
            "ha" => Ok(LanguageTag::Ha),
            "ha-latn" => Ok(LanguageTag::HaLatn),
            "ha-latn-ng" => Ok(LanguageTag::HaLatnNg),
            "he" => Ok(LanguageTag::He),
            "he-il" => Ok(LanguageTag::HeIl),
            "hi" => Ok(LanguageTag::Hi),
            "hi-in" => Ok(LanguageTag::HiIn),
            "hr" => Ok(LanguageTag::Hr),
            "hr-ba" => Ok(LanguageTag::HrBa),
            "hr-hr" => Ok(LanguageTag::HrHr),
            "hu" => Ok(LanguageTag::Hu),
            "hu-hu" => Ok(LanguageTag::HuHu),
            "hy" => Ok(LanguageTag::Hy),
            "hy-am" => Ok(LanguageTag::HyAm),
            "id" => Ok(LanguageTag::Id),
            "id-id" => Ok(LanguageTag::IdId),
            "ig-latn" => Ok(LanguageTag::IgLatn),
            "ig-ng" => Ok(LanguageTag::IgNg),
            "is" => Ok(LanguageTag::Is),
            "is-is" => Ok(LanguageTag::IsIs),
            "it" => Ok(LanguageTag::It),
            "it-ch" => Ok(LanguageTag::ItCh),
            "it-it" => Ok(LanguageTag::ItIt),
            "iu-cans" => Ok(LanguageTag::IuCans),
            "iu-latn" => Ok(LanguageTag::IuLatn),
            "iu-latn-ca" => Ok(LanguageTag::IuLatnCa),
            "ja" => Ok(LanguageTag::Ja),
            "ja-jp" => Ok(LanguageTag::JaJp),
            "ka" => Ok(LanguageTag::Ka),
            "ka-ge" => Ok(LanguageTag::KaGe),
            "kk" => Ok(LanguageTag::Kk),
            "kk-kz" => Ok(LanguageTag::KkKz),
            "km" => Ok(LanguageTag::Km),
            "km-kh" => Ok(LanguageTag::KmKh),
            "kn" => Ok(LanguageTag::Kn),
            "kn-in" => Ok(LanguageTag::KnIn),
            "ko" => Ok(LanguageTag::Ko),
            "ko-kr" => Ok(LanguageTag::KoKr),
            "kok" => Ok(LanguageTag::Kok),
            "kok-in" => Ok(LanguageTag::KokIn),
            "ku-arab" => Ok(LanguageTag::KuArab),
            "ku-arab-iq" => Ok(LanguageTag::KuArabIq),
            "ky-cyrl" => Ok(LanguageTag::KyCyrl),
            "ky-kg" => Ok(LanguageTag::KyKg),
            "lb" => Ok(LanguageTag::Lb),
            "lb-lu" => Ok(LanguageTag::LbLu),
            "lo" => Ok(LanguageTag::Lo),
            "lo-la" => Ok(LanguageTag::LoLa),
            "lt" => Ok(LanguageTag::Lt),
            "lt-lt" => Ok(LanguageTag::LtLt),
            "lv" => Ok(LanguageTag::Lv),
            "lv-lv" => Ok(LanguageTag::LvLv),
            "mi" => Ok(LanguageTag::Mi),
            "mi-latn" => Ok(LanguageTag::MiLatn),
            "mi-nz" => Ok(LanguageTag::MiNz),
            "mk" => Ok(LanguageTag::Mk),
            "mk-mk" => Ok(LanguageTag::MkMk),
            "ml" => Ok(LanguageTag::Ml),
            "ml-in" => Ok(LanguageTag::MlIn),
            "mn-cyrl" => Ok(LanguageTag::MnCyrl),
            "mn-mn" => Ok(LanguageTag::MnMn),
            "mn-mong" => Ok(LanguageTag::MnMong),
            "mn-phag" => Ok(LanguageTag::MnPhag),
            "mr" => Ok(LanguageTag::Mr),
            "mr-in" => Ok(LanguageTag::MrIn),
            "ms" => Ok(LanguageTag::Ms),
            "ms-bn" => Ok(LanguageTag::MsBn),
            "ms-my" => Ok(LanguageTag::MsMy),
            "mt" => Ok(LanguageTag::Mt),
            "mt-mt" => Ok(LanguageTag::MtMt),
            "nb" => Ok(LanguageTag::Nb),
            "nb-no" => Ok(LanguageTag::NbNo),
            "ne" => Ok(LanguageTag::Ne),
            "ne-np" => Ok(LanguageTag::NeNp),
            "nl" => Ok(LanguageTag::Nl),
            "nl-be" => Ok(LanguageTag::NlBe),
            "nl-nl" => Ok(LanguageTag::NlNl),
            "nn" => Ok(LanguageTag::Nn),
            "nn-no" => Ok(LanguageTag::NnNo),
            "no" => Ok(LanguageTag::No),
            "no-no" => Ok(LanguageTag::NoNo),
            "nso" => Ok(LanguageTag::Nso),
            "nso-za" => Ok(LanguageTag::NsoZa),
            "or" => Ok(LanguageTag::Or),
            "or-in" => Ok(LanguageTag::OrIn),
            "pa" => Ok(LanguageTag::Pa),
            "pa-arab" => Ok(LanguageTag::PaArab),
            "pa-arab-pk" => Ok(LanguageTag::PaArabPk),
            "pa-deva" => Ok(LanguageTag::PaDeva),
            "pa-in" => Ok(LanguageTag::PaIn),
            "pl" => Ok(LanguageTag::Pl),
            "pl-pl" => Ok(LanguageTag::PlPl),
            "prs" => Ok(LanguageTag::Prs),
            "prs-af" => Ok(LanguageTag::PrsAf),
            "prs-arab" => Ok(LanguageTag::PrsArab),
            "pt" => Ok(LanguageTag::Pt),
            "pt-br" => Ok(LanguageTag::PtBr),
            "pt-pt" => Ok(LanguageTag::PtPt),
            "quc-latn" => Ok(LanguageTag::QucLatn),
            "qut-gt" => Ok(LanguageTag::QutGt),
            "qut-latn" => Ok(LanguageTag::QutLatn),
            "quz" => Ok(LanguageTag::Quz),
            "quz-bo" => Ok(LanguageTag::QuzBo),
            "quz-ec" => Ok(LanguageTag::QuzEc),
            "quz-pe" => Ok(LanguageTag::QuzPe),
            "ro" => Ok(LanguageTag::Ro),
            "ro-ro" => Ok(LanguageTag::RoRo),
            "ru" => Ok(LanguageTag::Ru),
            "ru-ru" => Ok(LanguageTag::RuRu),
            "rw" => Ok(LanguageTag::Rw),
            "rw-rw" => Ok(LanguageTag::RwRw),
            "sd-arab" => Ok(LanguageTag::SdArab),
            "sd-arab-pk" => Ok(LanguageTag::SdArabPk),
            "sd-deva" => Ok(LanguageTag::SdDeva),
            "si" => Ok(LanguageTag::Si),
            "si-lk" => Ok(LanguageTag::SiLk),
            "sk" => Ok(LanguageTag::Sk),
            "sk-sk" => Ok(LanguageTag::SkSk),
            "sl" => Ok(LanguageTag::Sl),
            "sl-si" => Ok(LanguageTag::SlSi),
            "sq" => Ok(LanguageTag::Sq),
            "sq-al" => Ok(LanguageTag::SqAl),
            "sr" => Ok(LanguageTag::Sr),
            "sr-cyrl" => Ok(LanguageTag::SrCyrl),
            "sr-cyrl-ba" => Ok(LanguageTag::SrCyrlBa),
            "sr-cyrl-cs" => Ok(LanguageTag::SrCyrlCs),
            "sr-cyrl-me" => Ok(LanguageTag::SrCyrlMe),
            "sr-cyrl-rs" => Ok(LanguageTag::SrCyrlRs),
            "sr-latn" => Ok(LanguageTag::SrLatn),
            "sr-latn-ba" => Ok(LanguageTag::SrLatnBa),
            "sr-latn-cs" => Ok(LanguageTag::SrLatnCs),
            "sr-latn-me" => Ok(LanguageTag::SrLatnMe),
            "sr-latn-rs" => Ok(LanguageTag::SrLatnRs),
            "sv" => Ok(LanguageTag::Sv),
            "sv-fi" => Ok(LanguageTag::SvFi),
            "sv-se" => Ok(LanguageTag::SvSe),
            "sw" => Ok(LanguageTag::Sw),
            "sw-ke" => Ok(LanguageTag::SwKe),
            "ta" => Ok(LanguageTag::Ta),
            "ta-in" => Ok(LanguageTag::TaIn),
            "te" => Ok(LanguageTag::Te),
            "te-in" => Ok(LanguageTag::TeIn),
            "tg-arab" => Ok(LanguageTag::TgArab),
            "tg-cyrl" => Ok(LanguageTag::TgCyrl),
            "tg-cyrl-tj" => Ok(LanguageTag::TgCyrlTj),
            "tg-latn" => Ok(LanguageTag::TgLatn),
            "th" => Ok(LanguageTag::Th),
            "th-th" => Ok(LanguageTag::ThTh),
            "ti" => Ok(LanguageTag::Ti),
            "ti-et" => Ok(LanguageTag::TiEt),
            "tk-cyrl" => Ok(LanguageTag::TkCyrl),
            "tk-cyrl-tr" => Ok(LanguageTag::TkCyrlTr),
            "tk-latn" => Ok(LanguageTag::TkLatn),
            "tk-latn-tr" => Ok(LanguageTag::TkLatnTr),
            "tk-tm" => Ok(LanguageTag::TkTm),
            "tn" => Ok(LanguageTag::Tn),
            "tn-bw" => Ok(LanguageTag::TnBw),
            "tn-za" => Ok(LanguageTag::TnZa),
            "tr" => Ok(LanguageTag::Tr),
            "tr-tr" => Ok(LanguageTag::TrTr),
            "tt-arab" => Ok(LanguageTag::TtArab),
            "tt-cyrl" => Ok(LanguageTag::TtCyrl),
            "tt-latn" => Ok(LanguageTag::TtLatn),
            "tt-ru" => Ok(LanguageTag::TtRu),
            "ug-arab" => Ok(LanguageTag::UgArab),
            "ug-cn" => Ok(LanguageTag::UgCn),
            "ug-cyrl" => Ok(LanguageTag::UgCyrl),
            "ug-latn" => Ok(LanguageTag::UgLatn),
            "uk" => Ok(LanguageTag::Uk),
            "uk-ua" => Ok(LanguageTag::UkUa),
            "ur" => Ok(LanguageTag::Ur),
            "ur-pk" => Ok(LanguageTag::UrPk),
            "uz" => Ok(LanguageTag::Uz),
            "uz-cyrl" => Ok(LanguageTag::UzCyrl),
            "uz-latn" => Ok(LanguageTag::UzLatn),
            "uz-latn-uz" => Ok(LanguageTag::UzLatnUz),
            "vi" => Ok(LanguageTag::Vi),
            "vi-vn" => Ok(LanguageTag::ViVn),
            "wo" => Ok(LanguageTag::Wo),
            "wo-sn" => Ok(LanguageTag::WoSn),
            "xh" => Ok(LanguageTag::Xh),
            "xh-za" => Ok(LanguageTag::XhZa),
            "yo-latn" => Ok(LanguageTag::YoLatn),
            "yo-ng" => Ok(LanguageTag::YoNg),
            "zh-cn" => Ok(LanguageTag::ZhCn),
            "zh-hans" => Ok(LanguageTag::ZhHans),
            "zh-hans-cn" => Ok(LanguageTag::ZhHansCn),
            "zh-hans-sg" => Ok(LanguageTag::ZhHansSg),
            "zh-hant" => Ok(LanguageTag::ZhHant),
            "zh-hant-hk" => Ok(LanguageTag::ZhHantHk),
            "zh-hant-mo" => Ok(LanguageTag::ZhHantMo),
            "zh-hant-tw" => Ok(LanguageTag::ZhHantTw),
            "zh-hk" => Ok(LanguageTag::ZhHk),
            "zh-mo" => Ok(LanguageTag::ZhMo),
            "zh-sg" => Ok(LanguageTag::ZhSg),
            "zh-tw" => Ok(LanguageTag::ZhTw),
            "zu" => Ok(LanguageTag::Zu),
            "zu-za" => Ok(LanguageTag::ZuZa),
            _ => Err(format!("unknown languagetag: {s}")),
        }
    }
}

impl serde::Serialize for LanguageTag {
    fn serialize<S: serde::Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> {
        ser.serialize_str(self.as_str())
    }
}

impl<'de> serde::Deserialize<'de> for LanguageTag {
    fn deserialize<D: serde::Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
        let s = <std::borrow::Cow<'_, str>>::deserialize(de)?;
        <LanguageTag as FromStr>::from_str(&s).map_err(serde::de::Error::custom)
    }
}

impl LanguageTag {
    /// Primary language subtag, if it maps to an ISO 639-1 [`Lang`].
    /// Returns `None` for tags whose primary subtag is ISO 639-2 / 639-3
    /// (e.g. `chr-Cher`, `fil-PH`).
    pub fn lang(&self) -> Option<Lang> {
        match self {
            LanguageTag::Af => Some(Lang::Af),
            LanguageTag::AfZa => Some(Lang::Af),
            LanguageTag::Am => Some(Lang::Am),
            LanguageTag::AmEt => Some(Lang::Am),
            LanguageTag::Ar => Some(Lang::Ar),
            LanguageTag::ArAe => Some(Lang::Ar),
            LanguageTag::ArBh => Some(Lang::Ar),
            LanguageTag::ArDz => Some(Lang::Ar),
            LanguageTag::ArEg => Some(Lang::Ar),
            LanguageTag::ArIq => Some(Lang::Ar),
            LanguageTag::ArJo => Some(Lang::Ar),
            LanguageTag::ArKw => Some(Lang::Ar),
            LanguageTag::ArLb => Some(Lang::Ar),
            LanguageTag::ArLy => Some(Lang::Ar),
            LanguageTag::ArMa => Some(Lang::Ar),
            LanguageTag::ArOm => Some(Lang::Ar),
            LanguageTag::ArQa => Some(Lang::Ar),
            LanguageTag::ArSa => Some(Lang::Ar),
            LanguageTag::ArSy => Some(Lang::Ar),
            LanguageTag::ArTn => Some(Lang::Ar),
            LanguageTag::ArYe => Some(Lang::Ar),
            LanguageTag::As => Some(Lang::As),
            LanguageTag::AsIn => Some(Lang::As),
            LanguageTag::AzArab => Some(Lang::Az),
            LanguageTag::AzArabAz => Some(Lang::Az),
            LanguageTag::AzCyrl => Some(Lang::Az),
            LanguageTag::AzCyrlAz => Some(Lang::Az),
            LanguageTag::AzLatn => Some(Lang::Az),
            LanguageTag::AzLatnAz => Some(Lang::Az),
            LanguageTag::Be => Some(Lang::Be),
            LanguageTag::BeBy => Some(Lang::Be),
            LanguageTag::Bg => Some(Lang::Bg),
            LanguageTag::BgBg => Some(Lang::Bg),
            LanguageTag::Bn => Some(Lang::Bn),
            LanguageTag::BnBd => Some(Lang::Bn),
            LanguageTag::BnIn => Some(Lang::Bn),
            LanguageTag::Bs => Some(Lang::Bs),
            LanguageTag::BsCyrl => Some(Lang::Bs),
            LanguageTag::BsCyrlBa => Some(Lang::Bs),
            LanguageTag::BsLatn => Some(Lang::Bs),
            LanguageTag::BsLatnBa => Some(Lang::Bs),
            LanguageTag::Ca => Some(Lang::Ca),
            LanguageTag::CaEs => Some(Lang::Ca),
            LanguageTag::CaEsValencia => Some(Lang::Ca),
            LanguageTag::ChrCher => None,
            LanguageTag::ChrCherUs => None,
            LanguageTag::ChrLatn => None,
            LanguageTag::Cs => Some(Lang::Cs),
            LanguageTag::CsCz => Some(Lang::Cs),
            LanguageTag::Cy => Some(Lang::Cy),
            LanguageTag::CyGb => Some(Lang::Cy),
            LanguageTag::Da => Some(Lang::Da),
            LanguageTag::DaDk => Some(Lang::Da),
            LanguageTag::De => Some(Lang::De),
            LanguageTag::DeAt => Some(Lang::De),
            LanguageTag::DeCh => Some(Lang::De),
            LanguageTag::DeDe => Some(Lang::De),
            LanguageTag::DeLi => Some(Lang::De),
            LanguageTag::DeLu => Some(Lang::De),
            LanguageTag::El => Some(Lang::El),
            LanguageTag::ElGr => Some(Lang::El),
            LanguageTag::En => Some(Lang::En),
            LanguageTag::En011 => Some(Lang::En),
            LanguageTag::En014 => Some(Lang::En),
            LanguageTag::En018 => Some(Lang::En),
            LanguageTag::En021 => Some(Lang::En),
            LanguageTag::En029 => Some(Lang::En),
            LanguageTag::En053 => Some(Lang::En),
            LanguageTag::EnAu => Some(Lang::En),
            LanguageTag::EnBz => Some(Lang::En),
            LanguageTag::EnCa => Some(Lang::En),
            LanguageTag::EnGb => Some(Lang::En),
            LanguageTag::EnHk => Some(Lang::En),
            LanguageTag::EnId => Some(Lang::En),
            LanguageTag::EnIe => Some(Lang::En),
            LanguageTag::EnIn => Some(Lang::En),
            LanguageTag::EnJm => Some(Lang::En),
            LanguageTag::EnKz => Some(Lang::En),
            LanguageTag::EnMt => Some(Lang::En),
            LanguageTag::EnMy => Some(Lang::En),
            LanguageTag::EnNz => Some(Lang::En),
            LanguageTag::EnPh => Some(Lang::En),
            LanguageTag::EnPk => Some(Lang::En),
            LanguageTag::EnSg => Some(Lang::En),
            LanguageTag::EnTt => Some(Lang::En),
            LanguageTag::EnUs => Some(Lang::En),
            LanguageTag::EnVn => Some(Lang::En),
            LanguageTag::EnZa => Some(Lang::En),
            LanguageTag::EnZw => Some(Lang::En),
            LanguageTag::Es => Some(Lang::Es),
            LanguageTag::Es019 => Some(Lang::Es),
            LanguageTag::Es419 => Some(Lang::Es),
            LanguageTag::EsAr => Some(Lang::Es),
            LanguageTag::EsBo => Some(Lang::Es),
            LanguageTag::EsCl => Some(Lang::Es),
            LanguageTag::EsCo => Some(Lang::Es),
            LanguageTag::EsCr => Some(Lang::Es),
            LanguageTag::EsDo => Some(Lang::Es),
            LanguageTag::EsEc => Some(Lang::Es),
            LanguageTag::EsEs => Some(Lang::Es),
            LanguageTag::EsGt => Some(Lang::Es),
            LanguageTag::EsHn => Some(Lang::Es),
            LanguageTag::EsMx => Some(Lang::Es),
            LanguageTag::EsNi => Some(Lang::Es),
            LanguageTag::EsPa => Some(Lang::Es),
            LanguageTag::EsPe => Some(Lang::Es),
            LanguageTag::EsPr => Some(Lang::Es),
            LanguageTag::EsPy => Some(Lang::Es),
            LanguageTag::EsSv => Some(Lang::Es),
            LanguageTag::EsUs => Some(Lang::Es),
            LanguageTag::EsUy => Some(Lang::Es),
            LanguageTag::EsVe => Some(Lang::Es),
            LanguageTag::Et => Some(Lang::Et),
            LanguageTag::EtEe => Some(Lang::Et),
            LanguageTag::Eu => Some(Lang::Eu),
            LanguageTag::EuEs => Some(Lang::Eu),
            LanguageTag::Fa => Some(Lang::Fa),
            LanguageTag::FaIr => Some(Lang::Fa),
            LanguageTag::Fi => Some(Lang::Fi),
            LanguageTag::FiFi => Some(Lang::Fi),
            LanguageTag::Fil => None,
            LanguageTag::FilLatn => None,
            LanguageTag::FilPh => None,
            LanguageTag::Fr => Some(Lang::Fr),
            LanguageTag::Fr011 => Some(Lang::Fr),
            LanguageTag::Fr015 => Some(Lang::Fr),
            LanguageTag::Fr021 => Some(Lang::Fr),
            LanguageTag::Fr029 => Some(Lang::Fr),
            LanguageTag::Fr155 => Some(Lang::Fr),
            LanguageTag::FrBe => Some(Lang::Fr),
            LanguageTag::FrCa => Some(Lang::Fr),
            LanguageTag::FrCd => Some(Lang::Fr),
            LanguageTag::FrCh => Some(Lang::Fr),
            LanguageTag::FrCi => Some(Lang::Fr),
            LanguageTag::FrCm => Some(Lang::Fr),
            LanguageTag::FrFr => Some(Lang::Fr),
            LanguageTag::FrHt => Some(Lang::Fr),
            LanguageTag::FrLu => Some(Lang::Fr),
            LanguageTag::FrMa => Some(Lang::Fr),
            LanguageTag::FrMc => Some(Lang::Fr),
            LanguageTag::FrMl => Some(Lang::Fr),
            LanguageTag::FrRe => Some(Lang::Fr),
            LanguageTag::FrcLatn => None,
            LanguageTag::FrpLatn => None,
            LanguageTag::Ga => Some(Lang::Ga),
            LanguageTag::GaIe => Some(Lang::Ga),
            LanguageTag::GdGb => Some(Lang::Gd),
            LanguageTag::GdLatn => Some(Lang::Gd),
            LanguageTag::Gl => Some(Lang::Gl),
            LanguageTag::GlEs => Some(Lang::Gl),
            LanguageTag::Gu => Some(Lang::Gu),
            LanguageTag::GuIn => Some(Lang::Gu),
            LanguageTag::Ha => Some(Lang::Ha),
            LanguageTag::HaLatn => Some(Lang::Ha),
            LanguageTag::HaLatnNg => Some(Lang::Ha),
            LanguageTag::He => Some(Lang::He),
            LanguageTag::HeIl => Some(Lang::He),
            LanguageTag::Hi => Some(Lang::Hi),
            LanguageTag::HiIn => Some(Lang::Hi),
            LanguageTag::Hr => Some(Lang::Hr),
            LanguageTag::HrBa => Some(Lang::Hr),
            LanguageTag::HrHr => Some(Lang::Hr),
            LanguageTag::Hu => Some(Lang::Hu),
            LanguageTag::HuHu => Some(Lang::Hu),
            LanguageTag::Hy => Some(Lang::Hy),
            LanguageTag::HyAm => Some(Lang::Hy),
            LanguageTag::Id => Some(Lang::Id),
            LanguageTag::IdId => Some(Lang::Id),
            LanguageTag::IgLatn => Some(Lang::Ig),
            LanguageTag::IgNg => Some(Lang::Ig),
            LanguageTag::Is => Some(Lang::Is),
            LanguageTag::IsIs => Some(Lang::Is),
            LanguageTag::It => Some(Lang::It),
            LanguageTag::ItCh => Some(Lang::It),
            LanguageTag::ItIt => Some(Lang::It),
            LanguageTag::IuCans => Some(Lang::Iu),
            LanguageTag::IuLatn => Some(Lang::Iu),
            LanguageTag::IuLatnCa => Some(Lang::Iu),
            LanguageTag::Ja => Some(Lang::Ja),
            LanguageTag::JaJp => Some(Lang::Ja),
            LanguageTag::Ka => Some(Lang::Ka),
            LanguageTag::KaGe => Some(Lang::Ka),
            LanguageTag::Kk => Some(Lang::Kk),
            LanguageTag::KkKz => Some(Lang::Kk),
            LanguageTag::Km => Some(Lang::Km),
            LanguageTag::KmKh => Some(Lang::Km),
            LanguageTag::Kn => Some(Lang::Kn),
            LanguageTag::KnIn => Some(Lang::Kn),
            LanguageTag::Ko => Some(Lang::Ko),
            LanguageTag::KoKr => Some(Lang::Ko),
            LanguageTag::Kok => None,
            LanguageTag::KokIn => None,
            LanguageTag::KuArab => Some(Lang::Ku),
            LanguageTag::KuArabIq => Some(Lang::Ku),
            LanguageTag::KyCyrl => Some(Lang::Ky),
            LanguageTag::KyKg => Some(Lang::Ky),
            LanguageTag::Lb => Some(Lang::Lb),
            LanguageTag::LbLu => Some(Lang::Lb),
            LanguageTag::Lo => Some(Lang::Lo),
            LanguageTag::LoLa => Some(Lang::Lo),
            LanguageTag::Lt => Some(Lang::Lt),
            LanguageTag::LtLt => Some(Lang::Lt),
            LanguageTag::Lv => Some(Lang::Lv),
            LanguageTag::LvLv => Some(Lang::Lv),
            LanguageTag::Mi => Some(Lang::Mi),
            LanguageTag::MiLatn => Some(Lang::Mi),
            LanguageTag::MiNz => Some(Lang::Mi),
            LanguageTag::Mk => Some(Lang::Mk),
            LanguageTag::MkMk => Some(Lang::Mk),
            LanguageTag::Ml => Some(Lang::Ml),
            LanguageTag::MlIn => Some(Lang::Ml),
            LanguageTag::MnCyrl => Some(Lang::Mn),
            LanguageTag::MnMn => Some(Lang::Mn),
            LanguageTag::MnMong => Some(Lang::Mn),
            LanguageTag::MnPhag => Some(Lang::Mn),
            LanguageTag::Mr => Some(Lang::Mr),
            LanguageTag::MrIn => Some(Lang::Mr),
            LanguageTag::Ms => Some(Lang::Ms),
            LanguageTag::MsBn => Some(Lang::Ms),
            LanguageTag::MsMy => Some(Lang::Ms),
            LanguageTag::Mt => Some(Lang::Mt),
            LanguageTag::MtMt => Some(Lang::Mt),
            LanguageTag::Nb => Some(Lang::Nb),
            LanguageTag::NbNo => Some(Lang::Nb),
            LanguageTag::Ne => Some(Lang::Ne),
            LanguageTag::NeNp => Some(Lang::Ne),
            LanguageTag::Nl => Some(Lang::Nl),
            LanguageTag::NlBe => Some(Lang::Nl),
            LanguageTag::NlNl => Some(Lang::Nl),
            LanguageTag::Nn => Some(Lang::Nn),
            LanguageTag::NnNo => Some(Lang::Nn),
            LanguageTag::No => Some(Lang::No),
            LanguageTag::NoNo => Some(Lang::No),
            LanguageTag::Nso => None,
            LanguageTag::NsoZa => None,
            LanguageTag::Or => Some(Lang::Or),
            LanguageTag::OrIn => Some(Lang::Or),
            LanguageTag::Pa => Some(Lang::Pa),
            LanguageTag::PaArab => Some(Lang::Pa),
            LanguageTag::PaArabPk => Some(Lang::Pa),
            LanguageTag::PaDeva => Some(Lang::Pa),
            LanguageTag::PaIn => Some(Lang::Pa),
            LanguageTag::Pl => Some(Lang::Pl),
            LanguageTag::PlPl => Some(Lang::Pl),
            LanguageTag::Prs => None,
            LanguageTag::PrsAf => None,
            LanguageTag::PrsArab => None,
            LanguageTag::Pt => Some(Lang::Pt),
            LanguageTag::PtBr => Some(Lang::Pt),
            LanguageTag::PtPt => Some(Lang::Pt),
            LanguageTag::QucLatn => None,
            LanguageTag::QutGt => None,
            LanguageTag::QutLatn => None,
            LanguageTag::Quz => None,
            LanguageTag::QuzBo => None,
            LanguageTag::QuzEc => None,
            LanguageTag::QuzPe => None,
            LanguageTag::Ro => Some(Lang::Ro),
            LanguageTag::RoRo => Some(Lang::Ro),
            LanguageTag::Ru => Some(Lang::Ru),
            LanguageTag::RuRu => Some(Lang::Ru),
            LanguageTag::Rw => Some(Lang::Rw),
            LanguageTag::RwRw => Some(Lang::Rw),
            LanguageTag::SdArab => Some(Lang::Sd),
            LanguageTag::SdArabPk => Some(Lang::Sd),
            LanguageTag::SdDeva => Some(Lang::Sd),
            LanguageTag::Si => Some(Lang::Si),
            LanguageTag::SiLk => Some(Lang::Si),
            LanguageTag::Sk => Some(Lang::Sk),
            LanguageTag::SkSk => Some(Lang::Sk),
            LanguageTag::Sl => Some(Lang::Sl),
            LanguageTag::SlSi => Some(Lang::Sl),
            LanguageTag::Sq => Some(Lang::Sq),
            LanguageTag::SqAl => Some(Lang::Sq),
            LanguageTag::Sr => Some(Lang::Sr),
            LanguageTag::SrCyrl => Some(Lang::Sr),
            LanguageTag::SrCyrlBa => Some(Lang::Sr),
            LanguageTag::SrCyrlCs => Some(Lang::Sr),
            LanguageTag::SrCyrlMe => Some(Lang::Sr),
            LanguageTag::SrCyrlRs => Some(Lang::Sr),
            LanguageTag::SrLatn => Some(Lang::Sr),
            LanguageTag::SrLatnBa => Some(Lang::Sr),
            LanguageTag::SrLatnCs => Some(Lang::Sr),
            LanguageTag::SrLatnMe => Some(Lang::Sr),
            LanguageTag::SrLatnRs => Some(Lang::Sr),
            LanguageTag::Sv => Some(Lang::Sv),
            LanguageTag::SvFi => Some(Lang::Sv),
            LanguageTag::SvSe => Some(Lang::Sv),
            LanguageTag::Sw => Some(Lang::Sw),
            LanguageTag::SwKe => Some(Lang::Sw),
            LanguageTag::Ta => Some(Lang::Ta),
            LanguageTag::TaIn => Some(Lang::Ta),
            LanguageTag::Te => Some(Lang::Te),
            LanguageTag::TeIn => Some(Lang::Te),
            LanguageTag::TgArab => Some(Lang::Tg),
            LanguageTag::TgCyrl => Some(Lang::Tg),
            LanguageTag::TgCyrlTj => Some(Lang::Tg),
            LanguageTag::TgLatn => Some(Lang::Tg),
            LanguageTag::Th => Some(Lang::Th),
            LanguageTag::ThTh => Some(Lang::Th),
            LanguageTag::Ti => Some(Lang::Ti),
            LanguageTag::TiEt => Some(Lang::Ti),
            LanguageTag::TkCyrl => Some(Lang::Tk),
            LanguageTag::TkCyrlTr => Some(Lang::Tk),
            LanguageTag::TkLatn => Some(Lang::Tk),
            LanguageTag::TkLatnTr => Some(Lang::Tk),
            LanguageTag::TkTm => Some(Lang::Tk),
            LanguageTag::Tn => Some(Lang::Tn),
            LanguageTag::TnBw => Some(Lang::Tn),
            LanguageTag::TnZa => Some(Lang::Tn),
            LanguageTag::Tr => Some(Lang::Tr),
            LanguageTag::TrTr => Some(Lang::Tr),
            LanguageTag::TtArab => Some(Lang::Tt),
            LanguageTag::TtCyrl => Some(Lang::Tt),
            LanguageTag::TtLatn => Some(Lang::Tt),
            LanguageTag::TtRu => Some(Lang::Tt),
            LanguageTag::UgArab => Some(Lang::Ug),
            LanguageTag::UgCn => Some(Lang::Ug),
            LanguageTag::UgCyrl => Some(Lang::Ug),
            LanguageTag::UgLatn => Some(Lang::Ug),
            LanguageTag::Uk => Some(Lang::Uk),
            LanguageTag::UkUa => Some(Lang::Uk),
            LanguageTag::Ur => Some(Lang::Ur),
            LanguageTag::UrPk => Some(Lang::Ur),
            LanguageTag::Uz => Some(Lang::Uz),
            LanguageTag::UzCyrl => Some(Lang::Uz),
            LanguageTag::UzLatn => Some(Lang::Uz),
            LanguageTag::UzLatnUz => Some(Lang::Uz),
            LanguageTag::Vi => Some(Lang::Vi),
            LanguageTag::ViVn => Some(Lang::Vi),
            LanguageTag::Wo => Some(Lang::Wo),
            LanguageTag::WoSn => Some(Lang::Wo),
            LanguageTag::Xh => Some(Lang::Xh),
            LanguageTag::XhZa => Some(Lang::Xh),
            LanguageTag::YoLatn => Some(Lang::Yo),
            LanguageTag::YoNg => Some(Lang::Yo),
            LanguageTag::ZhCn => Some(Lang::Zh),
            LanguageTag::ZhHans => Some(Lang::Zh),
            LanguageTag::ZhHansCn => Some(Lang::Zh),
            LanguageTag::ZhHansSg => Some(Lang::Zh),
            LanguageTag::ZhHant => Some(Lang::Zh),
            LanguageTag::ZhHantHk => Some(Lang::Zh),
            LanguageTag::ZhHantMo => Some(Lang::Zh),
            LanguageTag::ZhHantTw => Some(Lang::Zh),
            LanguageTag::ZhHk => Some(Lang::Zh),
            LanguageTag::ZhMo => Some(Lang::Zh),
            LanguageTag::ZhSg => Some(Lang::Zh),
            LanguageTag::ZhTw => Some(Lang::Zh),
            LanguageTag::Zu => Some(Lang::Zu),
            LanguageTag::ZuZa => Some(Lang::Zu),
        }
    }

    /// Region subtag, if present and resolvable to an ISO 3166-1 alpha-2 [`Market`].
    /// Returns `None` for tags with no region (`en`, `zh-Hant`) or with a
    /// UN M.49 numeric region (`en-053`, `es-419`).
    pub fn region(&self) -> Option<Market> {
        match self {
            LanguageTag::Af => None,
            LanguageTag::AfZa => Some(Market::Za),
            LanguageTag::Am => None,
            LanguageTag::AmEt => Some(Market::Et),
            LanguageTag::Ar => None,
            LanguageTag::ArAe => Some(Market::Ae),
            LanguageTag::ArBh => Some(Market::Bh),
            LanguageTag::ArDz => Some(Market::Dz),
            LanguageTag::ArEg => Some(Market::Eg),
            LanguageTag::ArIq => Some(Market::Iq),
            LanguageTag::ArJo => Some(Market::Jo),
            LanguageTag::ArKw => Some(Market::Kw),
            LanguageTag::ArLb => Some(Market::Lb),
            LanguageTag::ArLy => Some(Market::Ly),
            LanguageTag::ArMa => Some(Market::Ma),
            LanguageTag::ArOm => Some(Market::Om),
            LanguageTag::ArQa => Some(Market::Qa),
            LanguageTag::ArSa => Some(Market::Sa),
            LanguageTag::ArSy => Some(Market::Sy),
            LanguageTag::ArTn => Some(Market::Tn),
            LanguageTag::ArYe => Some(Market::Ye),
            LanguageTag::As => None,
            LanguageTag::AsIn => Some(Market::In),
            LanguageTag::AzArab => None,
            LanguageTag::AzArabAz => Some(Market::Az),
            LanguageTag::AzCyrl => None,
            LanguageTag::AzCyrlAz => Some(Market::Az),
            LanguageTag::AzLatn => None,
            LanguageTag::AzLatnAz => Some(Market::Az),
            LanguageTag::Be => None,
            LanguageTag::BeBy => Some(Market::By),
            LanguageTag::Bg => None,
            LanguageTag::BgBg => Some(Market::Bg),
            LanguageTag::Bn => None,
            LanguageTag::BnBd => Some(Market::Bd),
            LanguageTag::BnIn => Some(Market::In),
            LanguageTag::Bs => None,
            LanguageTag::BsCyrl => None,
            LanguageTag::BsCyrlBa => Some(Market::Ba),
            LanguageTag::BsLatn => None,
            LanguageTag::BsLatnBa => Some(Market::Ba),
            LanguageTag::Ca => None,
            LanguageTag::CaEs => Some(Market::Es),
            LanguageTag::CaEsValencia => Some(Market::Es),
            LanguageTag::ChrCher => None,
            LanguageTag::ChrCherUs => Some(Market::Us),
            LanguageTag::ChrLatn => None,
            LanguageTag::Cs => None,
            LanguageTag::CsCz => Some(Market::Cz),
            LanguageTag::Cy => None,
            LanguageTag::CyGb => Some(Market::Gb),
            LanguageTag::Da => None,
            LanguageTag::DaDk => Some(Market::Dk),
            LanguageTag::De => None,
            LanguageTag::DeAt => Some(Market::At),
            LanguageTag::DeCh => Some(Market::Ch),
            LanguageTag::DeDe => Some(Market::De),
            LanguageTag::DeLi => Some(Market::Li),
            LanguageTag::DeLu => Some(Market::Lu),
            LanguageTag::El => None,
            LanguageTag::ElGr => Some(Market::Gr),
            LanguageTag::En => None,
            LanguageTag::En011 => None,
            LanguageTag::En014 => None,
            LanguageTag::En018 => None,
            LanguageTag::En021 => None,
            LanguageTag::En029 => None,
            LanguageTag::En053 => None,
            LanguageTag::EnAu => Some(Market::Au),
            LanguageTag::EnBz => Some(Market::Bz),
            LanguageTag::EnCa => Some(Market::Ca),
            LanguageTag::EnGb => Some(Market::Gb),
            LanguageTag::EnHk => Some(Market::Hk),
            LanguageTag::EnId => Some(Market::Id),
            LanguageTag::EnIe => Some(Market::Ie),
            LanguageTag::EnIn => Some(Market::In),
            LanguageTag::EnJm => Some(Market::Jm),
            LanguageTag::EnKz => Some(Market::Kz),
            LanguageTag::EnMt => Some(Market::Mt),
            LanguageTag::EnMy => Some(Market::My),
            LanguageTag::EnNz => Some(Market::Nz),
            LanguageTag::EnPh => Some(Market::Ph),
            LanguageTag::EnPk => Some(Market::Pk),
            LanguageTag::EnSg => Some(Market::Sg),
            LanguageTag::EnTt => Some(Market::Tt),
            LanguageTag::EnUs => Some(Market::Us),
            LanguageTag::EnVn => Some(Market::Vn),
            LanguageTag::EnZa => Some(Market::Za),
            LanguageTag::EnZw => Some(Market::Zw),
            LanguageTag::Es => None,
            LanguageTag::Es019 => None,
            LanguageTag::Es419 => None,
            LanguageTag::EsAr => Some(Market::Ar),
            LanguageTag::EsBo => Some(Market::Bo),
            LanguageTag::EsCl => Some(Market::Cl),
            LanguageTag::EsCo => Some(Market::Co),
            LanguageTag::EsCr => Some(Market::Cr),
            LanguageTag::EsDo => Some(Market::Do),
            LanguageTag::EsEc => Some(Market::Ec),
            LanguageTag::EsEs => Some(Market::Es),
            LanguageTag::EsGt => Some(Market::Gt),
            LanguageTag::EsHn => Some(Market::Hn),
            LanguageTag::EsMx => Some(Market::Mx),
            LanguageTag::EsNi => Some(Market::Ni),
            LanguageTag::EsPa => Some(Market::Pa),
            LanguageTag::EsPe => Some(Market::Pe),
            LanguageTag::EsPr => Some(Market::Pr),
            LanguageTag::EsPy => Some(Market::Py),
            LanguageTag::EsSv => Some(Market::Sv),
            LanguageTag::EsUs => Some(Market::Us),
            LanguageTag::EsUy => Some(Market::Uy),
            LanguageTag::EsVe => Some(Market::Ve),
            LanguageTag::Et => None,
            LanguageTag::EtEe => Some(Market::Ee),
            LanguageTag::Eu => None,
            LanguageTag::EuEs => Some(Market::Es),
            LanguageTag::Fa => None,
            LanguageTag::FaIr => Some(Market::Ir),
            LanguageTag::Fi => None,
            LanguageTag::FiFi => Some(Market::Fi),
            LanguageTag::Fil => None,
            LanguageTag::FilLatn => None,
            LanguageTag::FilPh => Some(Market::Ph),
            LanguageTag::Fr => None,
            LanguageTag::Fr011 => None,
            LanguageTag::Fr015 => None,
            LanguageTag::Fr021 => None,
            LanguageTag::Fr029 => None,
            LanguageTag::Fr155 => None,
            LanguageTag::FrBe => Some(Market::Be),
            LanguageTag::FrCa => Some(Market::Ca),
            LanguageTag::FrCd => Some(Market::Cd),
            LanguageTag::FrCh => Some(Market::Ch),
            LanguageTag::FrCi => Some(Market::Ci),
            LanguageTag::FrCm => Some(Market::Cm),
            LanguageTag::FrFr => Some(Market::Fr),
            LanguageTag::FrHt => Some(Market::Ht),
            LanguageTag::FrLu => Some(Market::Lu),
            LanguageTag::FrMa => Some(Market::Ma),
            LanguageTag::FrMc => Some(Market::Mc),
            LanguageTag::FrMl => Some(Market::Ml),
            LanguageTag::FrRe => Some(Market::Re),
            LanguageTag::FrcLatn => None,
            LanguageTag::FrpLatn => None,
            LanguageTag::Ga => None,
            LanguageTag::GaIe => Some(Market::Ie),
            LanguageTag::GdGb => Some(Market::Gb),
            LanguageTag::GdLatn => None,
            LanguageTag::Gl => None,
            LanguageTag::GlEs => Some(Market::Es),
            LanguageTag::Gu => None,
            LanguageTag::GuIn => Some(Market::In),
            LanguageTag::Ha => None,
            LanguageTag::HaLatn => None,
            LanguageTag::HaLatnNg => Some(Market::Ng),
            LanguageTag::He => None,
            LanguageTag::HeIl => Some(Market::Il),
            LanguageTag::Hi => None,
            LanguageTag::HiIn => Some(Market::In),
            LanguageTag::Hr => None,
            LanguageTag::HrBa => Some(Market::Ba),
            LanguageTag::HrHr => Some(Market::Hr),
            LanguageTag::Hu => None,
            LanguageTag::HuHu => Some(Market::Hu),
            LanguageTag::Hy => None,
            LanguageTag::HyAm => Some(Market::Am),
            LanguageTag::Id => None,
            LanguageTag::IdId => Some(Market::Id),
            LanguageTag::IgLatn => None,
            LanguageTag::IgNg => Some(Market::Ng),
            LanguageTag::Is => None,
            LanguageTag::IsIs => Some(Market::Is),
            LanguageTag::It => None,
            LanguageTag::ItCh => Some(Market::Ch),
            LanguageTag::ItIt => Some(Market::It),
            LanguageTag::IuCans => None,
            LanguageTag::IuLatn => None,
            LanguageTag::IuLatnCa => Some(Market::Ca),
            LanguageTag::Ja => None,
            LanguageTag::JaJp => Some(Market::Jp),
            LanguageTag::Ka => None,
            LanguageTag::KaGe => Some(Market::Ge),
            LanguageTag::Kk => None,
            LanguageTag::KkKz => Some(Market::Kz),
            LanguageTag::Km => None,
            LanguageTag::KmKh => Some(Market::Kh),
            LanguageTag::Kn => None,
            LanguageTag::KnIn => Some(Market::In),
            LanguageTag::Ko => None,
            LanguageTag::KoKr => Some(Market::Kr),
            LanguageTag::Kok => None,
            LanguageTag::KokIn => Some(Market::In),
            LanguageTag::KuArab => None,
            LanguageTag::KuArabIq => Some(Market::Iq),
            LanguageTag::KyCyrl => None,
            LanguageTag::KyKg => Some(Market::Kg),
            LanguageTag::Lb => None,
            LanguageTag::LbLu => Some(Market::Lu),
            LanguageTag::Lo => None,
            LanguageTag::LoLa => Some(Market::La),
            LanguageTag::Lt => None,
            LanguageTag::LtLt => Some(Market::Lt),
            LanguageTag::Lv => None,
            LanguageTag::LvLv => Some(Market::Lv),
            LanguageTag::Mi => None,
            LanguageTag::MiLatn => None,
            LanguageTag::MiNz => Some(Market::Nz),
            LanguageTag::Mk => None,
            LanguageTag::MkMk => Some(Market::Mk),
            LanguageTag::Ml => None,
            LanguageTag::MlIn => Some(Market::In),
            LanguageTag::MnCyrl => None,
            LanguageTag::MnMn => Some(Market::Mn),
            LanguageTag::MnMong => None,
            LanguageTag::MnPhag => None,
            LanguageTag::Mr => None,
            LanguageTag::MrIn => Some(Market::In),
            LanguageTag::Ms => None,
            LanguageTag::MsBn => Some(Market::Bn),
            LanguageTag::MsMy => Some(Market::My),
            LanguageTag::Mt => None,
            LanguageTag::MtMt => Some(Market::Mt),
            LanguageTag::Nb => None,
            LanguageTag::NbNo => Some(Market::No),
            LanguageTag::Ne => None,
            LanguageTag::NeNp => Some(Market::Np),
            LanguageTag::Nl => None,
            LanguageTag::NlBe => Some(Market::Be),
            LanguageTag::NlNl => Some(Market::Nl),
            LanguageTag::Nn => None,
            LanguageTag::NnNo => Some(Market::No),
            LanguageTag::No => None,
            LanguageTag::NoNo => Some(Market::No),
            LanguageTag::Nso => None,
            LanguageTag::NsoZa => Some(Market::Za),
            LanguageTag::Or => None,
            LanguageTag::OrIn => Some(Market::In),
            LanguageTag::Pa => None,
            LanguageTag::PaArab => None,
            LanguageTag::PaArabPk => Some(Market::Pk),
            LanguageTag::PaDeva => None,
            LanguageTag::PaIn => Some(Market::In),
            LanguageTag::Pl => None,
            LanguageTag::PlPl => Some(Market::Pl),
            LanguageTag::Prs => None,
            LanguageTag::PrsAf => Some(Market::Af),
            LanguageTag::PrsArab => None,
            LanguageTag::Pt => None,
            LanguageTag::PtBr => Some(Market::Br),
            LanguageTag::PtPt => Some(Market::Pt),
            LanguageTag::QucLatn => None,
            LanguageTag::QutGt => Some(Market::Gt),
            LanguageTag::QutLatn => None,
            LanguageTag::Quz => None,
            LanguageTag::QuzBo => Some(Market::Bo),
            LanguageTag::QuzEc => Some(Market::Ec),
            LanguageTag::QuzPe => Some(Market::Pe),
            LanguageTag::Ro => None,
            LanguageTag::RoRo => Some(Market::Ro),
            LanguageTag::Ru => None,
            LanguageTag::RuRu => Some(Market::Ru),
            LanguageTag::Rw => None,
            LanguageTag::RwRw => Some(Market::Rw),
            LanguageTag::SdArab => None,
            LanguageTag::SdArabPk => Some(Market::Pk),
            LanguageTag::SdDeva => None,
            LanguageTag::Si => None,
            LanguageTag::SiLk => Some(Market::Lk),
            LanguageTag::Sk => None,
            LanguageTag::SkSk => Some(Market::Sk),
            LanguageTag::Sl => None,
            LanguageTag::SlSi => Some(Market::Si),
            LanguageTag::Sq => None,
            LanguageTag::SqAl => Some(Market::Al),
            LanguageTag::Sr => None,
            LanguageTag::SrCyrl => None,
            LanguageTag::SrCyrlBa => Some(Market::Ba),
            LanguageTag::SrCyrlCs => None,
            LanguageTag::SrCyrlMe => Some(Market::Me),
            LanguageTag::SrCyrlRs => Some(Market::Rs),
            LanguageTag::SrLatn => None,
            LanguageTag::SrLatnBa => Some(Market::Ba),
            LanguageTag::SrLatnCs => None,
            LanguageTag::SrLatnMe => Some(Market::Me),
            LanguageTag::SrLatnRs => Some(Market::Rs),
            LanguageTag::Sv => None,
            LanguageTag::SvFi => Some(Market::Fi),
            LanguageTag::SvSe => Some(Market::Se),
            LanguageTag::Sw => None,
            LanguageTag::SwKe => Some(Market::Ke),
            LanguageTag::Ta => None,
            LanguageTag::TaIn => Some(Market::In),
            LanguageTag::Te => None,
            LanguageTag::TeIn => Some(Market::In),
            LanguageTag::TgArab => None,
            LanguageTag::TgCyrl => None,
            LanguageTag::TgCyrlTj => Some(Market::Tj),
            LanguageTag::TgLatn => None,
            LanguageTag::Th => None,
            LanguageTag::ThTh => Some(Market::Th),
            LanguageTag::Ti => None,
            LanguageTag::TiEt => Some(Market::Et),
            LanguageTag::TkCyrl => None,
            LanguageTag::TkCyrlTr => Some(Market::Tr),
            LanguageTag::TkLatn => None,
            LanguageTag::TkLatnTr => Some(Market::Tr),
            LanguageTag::TkTm => Some(Market::Tm),
            LanguageTag::Tn => None,
            LanguageTag::TnBw => Some(Market::Bw),
            LanguageTag::TnZa => Some(Market::Za),
            LanguageTag::Tr => None,
            LanguageTag::TrTr => Some(Market::Tr),
            LanguageTag::TtArab => None,
            LanguageTag::TtCyrl => None,
            LanguageTag::TtLatn => None,
            LanguageTag::TtRu => Some(Market::Ru),
            LanguageTag::UgArab => None,
            LanguageTag::UgCn => Some(Market::Cn),
            LanguageTag::UgCyrl => None,
            LanguageTag::UgLatn => None,
            LanguageTag::Uk => None,
            LanguageTag::UkUa => Some(Market::Ua),
            LanguageTag::Ur => None,
            LanguageTag::UrPk => Some(Market::Pk),
            LanguageTag::Uz => None,
            LanguageTag::UzCyrl => None,
            LanguageTag::UzLatn => None,
            LanguageTag::UzLatnUz => Some(Market::Uz),
            LanguageTag::Vi => None,
            LanguageTag::ViVn => Some(Market::Vn),
            LanguageTag::Wo => None,
            LanguageTag::WoSn => Some(Market::Sn),
            LanguageTag::Xh => None,
            LanguageTag::XhZa => Some(Market::Za),
            LanguageTag::YoLatn => None,
            LanguageTag::YoNg => Some(Market::Ng),
            LanguageTag::ZhCn => Some(Market::Cn),
            LanguageTag::ZhHans => None,
            LanguageTag::ZhHansCn => Some(Market::Cn),
            LanguageTag::ZhHansSg => Some(Market::Sg),
            LanguageTag::ZhHant => None,
            LanguageTag::ZhHantHk => Some(Market::Hk),
            LanguageTag::ZhHantMo => Some(Market::Mo),
            LanguageTag::ZhHantTw => Some(Market::Tw),
            LanguageTag::ZhHk => Some(Market::Hk),
            LanguageTag::ZhMo => Some(Market::Mo),
            LanguageTag::ZhSg => Some(Market::Sg),
            LanguageTag::ZhTw => Some(Market::Tw),
            LanguageTag::Zu => None,
            LanguageTag::ZuZa => Some(Market::Za),
        }
    }
}
