// Auto-generated by `tools/gen-locales.mjs`.
// Source data lives in `data/iso-3166-1.json` (ISO 3166-1 alpha-2) and
// `data/iso-639-1.csv` (ISO 639-1). Re-run the generator after updating either.
//
// Countries: 249    Languages: 183

use std::str::FromStr;

/// A Microsoft Store market, identified by an ISO 3166-1 alpha-2 country code.
///
/// 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 {
    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,
    Cr,
    Cu,
    Cv,
    Cw,
    Cx,
    Cy,
    Cz,
    De,
    Dj,
    Dk,
    Dm,
    Do,
    Dz,
    Ec,
    Ee,
    Eg,
    Eh,
    Er,
    Es,
    Et,
    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,
    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,
    Tc,
    Td,
    Tf,
    Tg,
    Th,
    Tj,
    Tk,
    Tl,
    Tm,
    Tn,
    To,
    Tr,
    Tt,
    Tv,
    Tw,
    Tz,
    Ua,
    Ug,
    Um,
    Us,
    Uy,
    Uz,
    Va,
    Vc,
    Ve,
    Vg,
    Vi,
    Vn,
    Vu,
    Wf,
    Ws,
    Ye,
    Yt,
    Za,
    Zm,
    Zw,
}

impl Market {
    /// Returns the canonical ISO code string.
    pub fn as_str(&self) -> &'static str {
        match self {
            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::Cr => "CR",
            Market::Cu => "CU",
            Market::Cv => "CV",
            Market::Cw => "CW",
            Market::Cx => "CX",
            Market::Cy => "CY",
            Market::Cz => "CZ",
            Market::De => "DE",
            Market::Dj => "DJ",
            Market::Dk => "DK",
            Market::Dm => "DM",
            Market::Do => "DO",
            Market::Dz => "DZ",
            Market::Ec => "EC",
            Market::Ee => "EE",
            Market::Eg => "EG",
            Market::Eh => "EH",
            Market::Er => "ER",
            Market::Es => "ES",
            Market::Et => "ET",
            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::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::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::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 ISO source data.
    pub fn english_name(&self) -> &'static str {
        match self {
            Market::Ad => "Andorra",
            Market::Ae => "United Arab Emirates (the)",
            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 (Plurinational State of)",
            Market::Bq => "Bonaire, Sint Eustatius and Saba",
            Market::Br => "Brazil",
            Market::Bs => "Bahamas (the)",
            Market::Bt => "Bhutan",
            Market::Bv => "Bouvet Island",
            Market::Bw => "Botswana",
            Market::By => "Belarus",
            Market::Bz => "Belize",
            Market::Ca => "Canada",
            Market::Cc => "Cocos (Keeling) Islands (the)",
            Market::Cd => "Congo (the Democratic Republic of the)",
            Market::Cf => "Central African Republic (the)",
            Market::Cg => "Congo (the)",
            Market::Ch => "Switzerland",
            Market::Ci => "Côte d'Ivoire",
            Market::Ck => "Cook Islands (the)",
            Market::Cl => "Chile",
            Market::Cm => "Cameroon",
            Market::Cn => "China",
            Market::Co => "Colombia",
            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::Dj => "Djibouti",
            Market::Dk => "Denmark",
            Market::Dm => "Dominica",
            Market::Do => "Dominican Republic (the)",
            Market::Dz => "Algeria",
            Market::Ec => "Ecuador",
            Market::Ee => "Estonia",
            Market::Eg => "Egypt",
            Market::Eh => "Western Sahara*",
            Market::Er => "Eritrea",
            Market::Es => "Spain",
            Market::Et => "Ethiopia",
            Market::Fi => "Finland",
            Market::Fj => "Fiji",
            Market::Fk => "Falkland Islands (the) [Malvinas]",
            Market::Fm => "Micronesia (Federated States of)",
            Market::Fo => "Faroe Islands (the)",
            Market::Fr => "France",
            Market::Ga => "Gabon",
            Market::Gb => "United Kingdom of Great Britain and Northern Ireland (the)",
            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 (the)",
            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::Id => "Indonesia",
            Market::Ie => "Ireland",
            Market::Il => "Israel",
            Market::Im => "Isle of Man",
            Market::In => "India",
            Market::Io => "British Indian Ocean Territory (the)",
            Market::Iq => "Iraq",
            Market::Ir => "Iran (Islamic Republic of)",
            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 (the)",
            Market::Kn => "Saint Kitts and Nevis",
            Market::Kp => "Korea (the Democratic People's Republic of)",
            Market::Kr => "Korea (the Republic of)",
            Market::Kw => "Kuwait",
            Market::Ky => "Cayman Islands (the)",
            Market::Kz => "Kazakhstan",
            Market::La => "Lao People's Democratic Republic (the)",
            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 (the Republic of)",
            Market::Me => "Montenegro",
            Market::Mf => "Saint Martin (French part)",
            Market::Mg => "Madagascar",
            Market::Mh => "Marshall Islands (the)",
            Market::Mk => "North Macedonia",
            Market::Ml => "Mali",
            Market::Mm => "Myanmar",
            Market::Mn => "Mongolia",
            Market::Mo => "Macao",
            Market::Mp => "Northern Mariana Islands (the)",
            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 (the)",
            Market::Nf => "Norfolk Island",
            Market::Ng => "Nigeria",
            Market::Ni => "Nicaragua",
            Market::Nl => "Netherlands (the)",
            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 (the)",
            Market::Pk => "Pakistan",
            Market::Pl => "Poland",
            Market::Pm => "Saint Pierre and Miquelon",
            Market::Pn => "Pitcairn",
            Market::Pr => "Puerto Rico",
            Market::Ps => "Palestine, State of",
            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 (the)",
            Market::Rw => "Rwanda",
            Market::Sa => "Saudi Arabia",
            Market::Sb => "Solomon Islands",
            Market::Sc => "Seychelles",
            Market::Sd => "Sudan (the)",
            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 (the)",
            Market::Sz => "Eswatini",
            Market::Tc => "Turks and Caicos Islands (the)",
            Market::Td => "Chad",
            Market::Tf => "French Southern Territories (the)",
            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 => "Turkey",
            Market::Tt => "Trinidad and Tobago",
            Market::Tv => "Tuvalu",
            Market::Tw => "Taiwan (Province of China)",
            Market::Tz => "Tanzania, the United Republic of",
            Market::Ua => "Ukraine",
            Market::Ug => "Uganda",
            Market::Um => "United States Minor Outlying Islands (the)",
            Market::Us => "United States of America (the)",
            Market::Uy => "Uruguay",
            Market::Uz => "Uzbekistan",
            Market::Va => "Holy See (the)",
            Market::Vc => "Saint Vincent and the Grenadines",
            Market::Ve => "Venezuela (Bolivarian Republic of)",
            Market::Vg => "Virgin Islands (British)",
            Market::Vi => "Virgin Islands (U.S.)",
            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::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::Cr, Market::Cu, Market::Cv, Market::Cw, Market::Cx, Market::Cy, Market::Cz, Market::De, Market::Dj, Market::Dk, Market::Dm, Market::Do, Market::Dz, Market::Ec, Market::Ee, Market::Eg, Market::Eh, Market::Er, Market::Es, Market::Et, 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::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::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::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_uppercase().as_str() {
            "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),
            "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),
            "DJ" => Ok(Market::Dj),
            "DK" => Ok(Market::Dk),
            "DM" => Ok(Market::Dm),
            "DO" => Ok(Market::Do),
            "DZ" => Ok(Market::Dz),
            "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),
            "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),
            "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),
            "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),
            "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 code.
///
/// 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,
    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,
    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 ISO 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::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::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 ISO source data.
    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::Bi => "Bislama",
            Lang::Bm => "Bambara",
            Lang::Bn => "Bengali",
            Lang::Bo => "Tibetan",
            Lang::Br => "Breton",
            Lang::Bs => "Bosnian",
            Lang::Ca => "Catalan; Valencian",
            Lang::Ce => "Chechen",
            Lang::Ch => "Chamorro",
            Lang::Co => "Corsican",
            Lang::Cr => "Cree",
            Lang::Cs => "Czech",
            Lang::Cu => "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic",
            Lang::Cv => "Chuvash",
            Lang::Cy => "Welsh",
            Lang::Da => "Danish",
            Lang::De => "German",
            Lang::Dv => "Divehi; Dhivehi; Maldivian",
            Lang::Dz => "Dzongkha",
            Lang::Ee => "Ewe",
            Lang::El => "Modern Greek (1453-)",
            Lang::En => "English",
            Lang::Eo => "Esperanto",
            Lang::Es => "Spanish; Castilian",
            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 => "Gaelic; 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; Haitian Creole",
            Lang::Hu => "Hungarian",
            Lang::Hy => "Armenian",
            Lang::Hz => "Herero",
            Lang::Ia => "Interlingua (International Auxiliary Language Association)",
            Lang::Id => "Indonesian",
            Lang::Ie => "Interlingue; Occidental",
            Lang::Ig => "Igbo",
            Lang::Ii => "Sichuan Yi; Nuosu",
            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; Gikuyu",
            Lang::Kj => "Kuanyama; Kwanyama",
            Lang::Kk => "Kazakh",
            Lang::Kl => "Kalaallisut; Greenlandic",
            Lang::Km => "Central 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; Kyrgyz",
            Lang::La => "Latin",
            Lang::Lb => "Luxembourgish; Letzeburgesch",
            Lang::Lg => "Ganda",
            Lang::Li => "Limburgan; Limburger; Limburgish",
            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",
            Lang::Mt => "Maltese",
            Lang::My => "Burmese",
            Lang::Na => "Nauru",
            Lang::Nb => "Norwegian Bokmål",
            Lang::Nd => "North Ndebele",
            Lang::Ne => "Nepali",
            Lang::Ng => "Ndonga",
            Lang::Nl => "Dutch; Flemish",
            Lang::Nn => "Norwegian Nynorsk",
            Lang::No => "Norwegian",
            Lang::Nr => "South Ndebele",
            Lang::Nv => "Navajo; Navaho",
            Lang::Ny => "Chichewa; Chewa; Nyanja",
            Lang::Oc => "Occitan (post 1500)",
            Lang::Oj => "Ojibwa",
            Lang::Om => "Oromo",
            Lang::Or => "Oriya",
            Lang::Os => "Ossetian; Ossetic",
            Lang::Pa => "Panjabi; Punjabi",
            Lang::Pi => "Pali",
            Lang::Pl => "Polish",
            Lang::Ps => "Pushto; Pashto",
            Lang::Pt => "Portuguese",
            Lang::Qu => "Quechua",
            Lang::Rm => "Romansh",
            Lang::Rn => "Rundi",
            Lang::Ro => "Romanian; Moldavian; Moldovan",
            Lang::Ru => "Russian",
            Lang::Rw => "Kinyarwanda",
            Lang::Sa => "Sanskrit",
            Lang::Sc => "Sardinian",
            Lang::Sd => "Sindhi",
            Lang::Se => "Northern Sami",
            Lang::Sg => "Sango",
            Lang::Si => "Sinhala; Sinhalese",
            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 => "Sotho, Southern",
            Lang::Su => "Sundanese",
            Lang::Sv => "Swedish",
            Lang::Sw => "Swahili",
            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; Uyghur",
            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; Chuang",
            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::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::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),
            "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),
            "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)
    }
}
