Список языковых кодов в YAML или JSON?

Есть ли список кодов языков в YAML или JSON где-то там?

Другой формат в порядке, я могу его преобразовать, если это необходимо.

Ответ 1

/**
 * @author Phil Teare
 * using wikipedia data
 */
isoLangs = {
    "ab":{
        "name":"Abkhaz",
        "nativeName":"аҧсуа"
    },
    "aa":{
        "name":"Afar",
        "nativeName":"Afaraf"
    },
    "af":{
        "name":"Afrikaans",
        "nativeName":"Afrikaans"
    },
    "ak":{
        "name":"Akan",
        "nativeName":"Akan"
    },
    "sq":{
        "name":"Albanian",
        "nativeName":"Shqip"
    },
    "am":{
        "name":"Amharic",
        "nativeName":"አማርኛ"
    },
    "ar":{
        "name":"Arabic",
        "nativeName":"العربية"
    },
    "an":{
        "name":"Aragonese",
        "nativeName":"Aragonés"
    },
    "hy":{
        "name":"Armenian",
        "nativeName":"Հայերեն"
    },
    "as":{
        "name":"Assamese",
        "nativeName":"অসমীয়া"
    },
    "av":{
        "name":"Avaric",
        "nativeName":"авар мацӀ, магӀарул мацӀ"
    },
    "ae":{
        "name":"Avestan",
        "nativeName":"avesta"
    },
    "ay":{
        "name":"Aymara",
        "nativeName":"aymar aru"
    },
    "az":{
        "name":"Azerbaijani",
        "nativeName":"azərbaycan dili"
    },
    "bm":{
        "name":"Bambara",
        "nativeName":"bamanankan"
    },
    "ba":{
        "name":"Bashkir",
        "nativeName":"башҡорт теле"
    },
    "eu":{
        "name":"Basque",
        "nativeName":"euskara, euskera"
    },
    "be":{
        "name":"Belarusian",
        "nativeName":"Беларуская"
    },
    "bn":{
        "name":"Bengali",
        "nativeName":"বাংলা"
    },
    "bh":{
        "name":"Bihari",
        "nativeName":"भोजपुरी"
    },
    "bi":{
        "name":"Bislama",
        "nativeName":"Bislama"
    },
    "bs":{
        "name":"Bosnian",
        "nativeName":"bosanski jezik"
    },
    "br":{
        "name":"Breton",
        "nativeName":"brezhoneg"
    },
    "bg":{
        "name":"Bulgarian",
        "nativeName":"български език"
    },
    "my":{
        "name":"Burmese",
        "nativeName":"ဗမာစာ"
    },
    "ca":{
        "name":"Catalan; Valencian",
        "nativeName":"Català"
    },
    "ch":{
        "name":"Chamorro",
        "nativeName":"Chamoru"
    },
    "ce":{
        "name":"Chechen",
        "nativeName":"нохчийн мотт"
    },
    "ny":{
        "name":"Chichewa; Chewa; Nyanja",
        "nativeName":"chiCheŵa, chinyanja"
    },
    "zh":{
        "name":"Chinese",
        "nativeName":"中文 (Zhōngwén), 汉语, 漢語"
    },
    "cv":{
        "name":"Chuvash",
        "nativeName":"чӑваш чӗлхи"
    },
    "kw":{
        "name":"Cornish",
        "nativeName":"Kernewek"
    },
    "co":{
        "name":"Corsican",
        "nativeName":"corsu, lingua corsa"
    },
    "cr":{
        "name":"Cree",
        "nativeName":"ᓀᐦᐃᔭᐍᐏᐣ"
    },
    "hr":{
        "name":"Croatian",
        "nativeName":"hrvatski"
    },
    "cs":{
        "name":"Czech",
        "nativeName":"česky, čeština"
    },
    "da":{
        "name":"Danish",
        "nativeName":"dansk"
    },
    "dv":{
        "name":"Divehi; Dhivehi; Maldivian;",
        "nativeName":"ދިވެހި"
    },
    "nl":{
        "name":"Dutch",
        "nativeName":"Nederlands, Vlaams"
    },
    "en":{
        "name":"English",
        "nativeName":"English"
    },
    "eo":{
        "name":"Esperanto",
        "nativeName":"Esperanto"
    },
    "et":{
        "name":"Estonian",
        "nativeName":"eesti, eesti keel"
    },
    "ee":{
        "name":"Ewe",
        "nativeName":"Eʋegbe"
    },
    "fo":{
        "name":"Faroese",
        "nativeName":"føroyskt"
    },
    "fj":{
        "name":"Fijian",
        "nativeName":"vosa Vakaviti"
    },
    "fi":{
        "name":"Finnish",
        "nativeName":"suomi, suomen kieli"
    },
    "fr":{
        "name":"French",
        "nativeName":"français, langue française"
    },
    "ff":{
        "name":"Fula; Fulah; Pulaar; Pular",
        "nativeName":"Fulfulde, Pulaar, Pular"
    },
    "gl":{
        "name":"Galician",
        "nativeName":"Galego"
    },
    "ka":{
        "name":"Georgian",
        "nativeName":"ქართული"
    },
    "de":{
        "name":"German",
        "nativeName":"Deutsch"
    },
    "el":{
        "name":"Greek, Modern",
        "nativeName":"Ελληνικά"
    },
    "gn":{
        "name":"Guaraní",
        "nativeName":"Avañeẽ"
    },
    "gu":{
        "name":"Gujarati",
        "nativeName":"ગુજરાતી"
    },
    "ht":{
        "name":"Haitian; Haitian Creole",
        "nativeName":"Kreyòl ayisyen"
    },
    "ha":{
        "name":"Hausa",
        "nativeName":"Hausa, هَوُسَ"
    },
    "he":{
        "name":"Hebrew (modern)",
        "nativeName":"עברית"
    },
    "hz":{
        "name":"Herero",
        "nativeName":"Otjiherero"
    },
    "hi":{
        "name":"Hindi",
        "nativeName":"हिन्दी, हिंदी"
    },
    "ho":{
        "name":"Hiri Motu",
        "nativeName":"Hiri Motu"
    },
    "hu":{
        "name":"Hungarian",
        "nativeName":"Magyar"
    },
    "ia":{
        "name":"Interlingua",
        "nativeName":"Interlingua"
    },
    "id":{
        "name":"Indonesian",
        "nativeName":"Bahasa Indonesia"
    },
    "ie":{
        "name":"Interlingue",
        "nativeName":"Originally called Occidental; then Interlingue after WWII"
    },
    "ga":{
        "name":"Irish",
        "nativeName":"Gaeilge"
    },
    "ig":{
        "name":"Igbo",
        "nativeName":"Asụsụ Igbo"
    },
    "ik":{
        "name":"Inupiaq",
        "nativeName":"Iñupiaq, Iñupiatun"
    },
    "io":{
        "name":"Ido",
        "nativeName":"Ido"
    },
    "is":{
        "name":"Icelandic",
        "nativeName":"Íslenska"
    },
    "it":{
        "name":"Italian",
        "nativeName":"Italiano"
    },
    "iu":{
        "name":"Inuktitut",
        "nativeName":"ᐃᓄᒃᑎᑐᑦ"
    },
    "ja":{
        "name":"Japanese",
        "nativeName":"日本語 (にほんご/にっぽんご)"
    },
    "jv":{
        "name":"Javanese",
        "nativeName":"basa Jawa"
    },
    "kl":{
        "name":"Kalaallisut, Greenlandic",
        "nativeName":"kalaallisut, kalaallit oqaasii"
    },
    "kn":{
        "name":"Kannada",
        "nativeName":"ಕನ್ನಡ"
    },
    "kr":{
        "name":"Kanuri",
        "nativeName":"Kanuri"
    },
    "ks":{
        "name":"Kashmiri",
        "nativeName":"कश्मीरी, كشميري‎"
    },
    "kk":{
        "name":"Kazakh",
        "nativeName":"Қазақ тілі"
    },
    "km":{
        "name":"Khmer",
        "nativeName":"ភាសាខ្មែរ"
    },
    "ki":{
        "name":"Kikuyu, Gikuyu",
        "nativeName":"Gĩkũyũ"
    },
    "rw":{
        "name":"Kinyarwanda",
        "nativeName":"Ikinyarwanda"
    },
    "ky":{
        "name":"Kirghiz, Kyrgyz",
        "nativeName":"кыргыз тили"
    },
    "kv":{
        "name":"Komi",
        "nativeName":"коми кыв"
    },
    "kg":{
        "name":"Kongo",
        "nativeName":"KiKongo"
    },
    "ko":{
        "name":"Korean",
        "nativeName":"한국어 (韓國語), 조선말 (朝鮮語)"
    },
    "ku":{
        "name":"Kurdish",
        "nativeName":"Kurdî, كوردی‎"
    },
    "kj":{
        "name":"Kwanyama, Kuanyama",
        "nativeName":"Kuanyama"
    },
    "la":{
        "name":"Latin",
        "nativeName":"latine, lingua latina"
    },
    "lb":{
        "name":"Luxembourgish, Letzeburgesch",
        "nativeName":"Lëtzebuergesch"
    },
    "lg":{
        "name":"Luganda",
        "nativeName":"Luganda"
    },
    "li":{
        "name":"Limburgish, Limburgan, Limburger",
        "nativeName":"Limburgs"
    },
    "ln":{
        "name":"Lingala",
        "nativeName":"Lingála"
    },
    "lo":{
        "name":"Lao",
        "nativeName":"ພາສາລາວ"
    },
    "lt":{
        "name":"Lithuanian",
        "nativeName":"lietuvių kalba"
    },
    "lu":{
        "name":"Luba-Katanga",
        "nativeName":""
    },
    "lv":{
        "name":"Latvian",
        "nativeName":"latviešu valoda"
    },
    "gv":{
        "name":"Manx",
        "nativeName":"Gaelg, Gailck"
    },
    "mk":{
        "name":"Macedonian",
        "nativeName":"македонски јазик"
    },
    "mg":{
        "name":"Malagasy",
        "nativeName":"Malagasy fiteny"
    },
    "ms":{
        "name":"Malay",
        "nativeName":"bahasa Melayu, بهاس ملايو‎"
    },
    "ml":{
        "name":"Malayalam",
        "nativeName":"മലയാളം"
    },
    "mt":{
        "name":"Maltese",
        "nativeName":"Malti"
    },
    "mi":{
        "name":"Māori",
        "nativeName":"te reo Māori"
    },
    "mr":{
        "name":"Marathi (Marāṭhī)",
        "nativeName":"मराठी"
    },
    "mh":{
        "name":"Marshallese",
        "nativeName":"Kajin M̧ajeļ"
    },
    "mn":{
        "name":"Mongolian",
        "nativeName":"монгол"
    },
    "na":{
        "name":"Nauru",
        "nativeName":"Ekakairũ Naoero"
    },
    "nv":{
        "name":"Navajo, Navaho",
        "nativeName":"Diné bizaad, Dinékʼehǰí"
    },
    "nb":{
        "name":"Norwegian Bokmål",
        "nativeName":"Norsk bokmål"
    },
    "nd":{
        "name":"North Ndebele",
        "nativeName":"isiNdebele"
    },
    "ne":{
        "name":"Nepali",
        "nativeName":"नेपाली"
    },
    "ng":{
        "name":"Ndonga",
        "nativeName":"Owambo"
    },
    "nn":{
        "name":"Norwegian Nynorsk",
        "nativeName":"Norsk nynorsk"
    },
    "no":{
        "name":"Norwegian",
        "nativeName":"Norsk"
    },
    "ii":{
        "name":"Nuosu",
        "nativeName":"ꆈꌠ꒿ Nuosuhxop"
    },
    "nr":{
        "name":"South Ndebele",
        "nativeName":"isiNdebele"
    },
    "oc":{
        "name":"Occitan",
        "nativeName":"Occitan"
    },
    "oj":{
        "name":"Ojibwe, Ojibwa",
        "nativeName":"ᐊᓂᔑᓈᐯᒧᐎᓐ"
    },
    "cu":{
        "name":"Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic",
        "nativeName":"ѩзыкъ словѣньскъ"
    },
    "om":{
        "name":"Oromo",
        "nativeName":"Afaan Oromoo"
    },
    "or":{
        "name":"Oriya",
        "nativeName":"ଓଡ଼ିଆ"
    },
    "os":{
        "name":"Ossetian, Ossetic",
        "nativeName":"ирон æвзаг"
    },
    "pa":{
        "name":"Panjabi, Punjabi",
        "nativeName":"ਪੰਜਾਬੀ, پنجابی‎"
    },
    "pi":{
        "name":"Pāli",
        "nativeName":"पाऴि"
    },
    "fa":{
        "name":"Persian",
        "nativeName":"فارسی"
    },
    "pl":{
        "name":"Polish",
        "nativeName":"polski"
    },
    "ps":{
        "name":"Pashto, Pushto",
        "nativeName":"پښتو"
    },
    "pt":{
        "name":"Portuguese",
        "nativeName":"Português"
    },
    "qu":{
        "name":"Quechua",
        "nativeName":"Runa Simi, Kichwa"
    },
    "rm":{
        "name":"Romansh",
        "nativeName":"rumantsch grischun"
    },
    "rn":{
        "name":"Kirundi",
        "nativeName":"kiRundi"
    },
    "ro":{
        "name":"Romanian, Moldavian, Moldovan",
        "nativeName":"română"
    },
    "ru":{
        "name":"Russian",
        "nativeName":"русский язык"
    },
    "sa":{
        "name":"Sanskrit (Saṁskṛta)",
        "nativeName":"संस्कृतम्"
    },
    "sc":{
        "name":"Sardinian",
        "nativeName":"sardu"
    },
    "sd":{
        "name":"Sindhi",
        "nativeName":"सिन्धी, سنڌي، سندھی‎"
    },
    "se":{
        "name":"Northern Sami",
        "nativeName":"Davvisámegiella"
    },
    "sm":{
        "name":"Samoan",
        "nativeName":"gagana faa Samoa"
    },
    "sg":{
        "name":"Sango",
        "nativeName":"yângâ tî sängö"
    },
    "sr":{
        "name":"Serbian",
        "nativeName":"српски језик"
    },
    "gd":{
        "name":"Scottish Gaelic; Gaelic",
        "nativeName":"Gàidhlig"
    },
    "sn":{
        "name":"Shona",
        "nativeName":"chiShona"
    },
    "si":{
        "name":"Sinhala, Sinhalese",
        "nativeName":"සිංහල"
    },
    "sk":{
        "name":"Slovak",
        "nativeName":"slovenčina"
    },
    "sl":{
        "name":"Slovene",
        "nativeName":"slovenščina"
    },
    "so":{
        "name":"Somali",
        "nativeName":"Soomaaliga, af Soomaali"
    },
    "st":{
        "name":"Southern Sotho",
        "nativeName":"Sesotho"
    },
    "es":{
        "name":"Spanish; Castilian",
        "nativeName":"español, castellano"
    },
    "su":{
        "name":"Sundanese",
        "nativeName":"Basa Sunda"
    },
    "sw":{
        "name":"Swahili",
        "nativeName":"Kiswahili"
    },
    "ss":{
        "name":"Swati",
        "nativeName":"SiSwati"
    },
    "sv":{
        "name":"Swedish",
        "nativeName":"svenska"
    },
    "ta":{
        "name":"Tamil",
        "nativeName":"தமிழ்"
    },
    "te":{
        "name":"Telugu",
        "nativeName":"తెలుగు"
    },
    "tg":{
        "name":"Tajik",
        "nativeName":"тоҷикӣ, toğikī, تاجیکی‎"
    },
    "th":{
        "name":"Thai",
        "nativeName":"ไทย"
    },
    "ti":{
        "name":"Tigrinya",
        "nativeName":"ትግርኛ"
    },
    "bo":{
        "name":"Tibetan Standard, Tibetan, Central",
        "nativeName":"བོད་ཡིག"
    },
    "tk":{
        "name":"Turkmen",
        "nativeName":"Türkmen, Түркмен"
    },
    "tl":{
        "name":"Tagalog",
        "nativeName":"Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔"
    },
    "tn":{
        "name":"Tswana",
        "nativeName":"Setswana"
    },
    "to":{
        "name":"Tonga (Tonga Islands)",
        "nativeName":"faka Tonga"
    },
    "tr":{
        "name":"Turkish",
        "nativeName":"Türkçe"
    },
    "ts":{
        "name":"Tsonga",
        "nativeName":"Xitsonga"
    },
    "tt":{
        "name":"Tatar",
        "nativeName":"татарча, tatarça, تاتارچا‎"
    },
    "tw":{
        "name":"Twi",
        "nativeName":"Twi"
    },
    "ty":{
        "name":"Tahitian",
        "nativeName":"Reo Tahiti"
    },
    "ug":{
        "name":"Uighur, Uyghur",
        "nativeName":"Uyƣurqə, ئۇيغۇرچە‎"
    },
    "uk":{
        "name":"Ukrainian",
        "nativeName":"українська"
    },
    "ur":{
        "name":"Urdu",
        "nativeName":"اردو"
    },
    "uz":{
        "name":"Uzbek",
        "nativeName":"zbek, Ўзбек, أۇزبېك‎"
    },
    "ve":{
        "name":"Venda",
        "nativeName":"Tshivenḓa"
    },
    "vi":{
        "name":"Vietnamese",
        "nativeName":"Tiếng Việt"
    },
    "vo":{
        "name":"Volapük",
        "nativeName":"Volapük"
    },
    "wa":{
        "name":"Walloon",
        "nativeName":"Walon"
    },
    "cy":{
        "name":"Welsh",
        "nativeName":"Cymraeg"
    },
    "wo":{
        "name":"Wolof",
        "nativeName":"Wollof"
    },
    "fy":{
        "name":"Western Frisian",
        "nativeName":"Frysk"
    },
    "xh":{
        "name":"Xhosa",
        "nativeName":"isiXhosa"
    },
    "yi":{
        "name":"Yiddish",
        "nativeName":"ייִדיש"
    },
    "yo":{
        "name":"Yoruba",
        "nativeName":"Yorùbá"
    },
    "za":{
        "name":"Zhuang, Chuang",
        "nativeName":"Saɯ cueŋƅ, Saw cuengh"
    }
}

Ответ 2

julianromera и ответы instine объединяются:

 [
      {"code":"ab","name":"Abkhaz","nativeName":"аҧсуа"},
      {"code":"aa","name":"Afar","nativeName":"Afaraf"},
      {"code":"af","name":"Afrikaans","nativeName":"Afrikaans"},
      {"code":"ak","name":"Akan","nativeName":"Akan"},
      {"code":"sq","name":"Albanian","nativeName":"Shqip"},
      {"code":"am","name":"Amharic","nativeName":"አማርኛ"},
      {"code":"ar","name":"Arabic","nativeName":"العربية"},
      {"code":"an","name":"Aragonese","nativeName":"Aragonés"},
      {"code":"hy","name":"Armenian","nativeName":"Հայերեն"},
      {"code":"as","name":"Assamese","nativeName":"অসমীয়া"},
      {"code":"av","name":"Avaric","nativeName":"авар мацӀ, магӀарул мацӀ"},
      {"code":"ae","name":"Avestan","nativeName":"avesta"},
      {"code":"ay","name":"Aymara","nativeName":"aymar aru"},
      {"code":"az","name":"Azerbaijani","nativeName":"azərbaycan dili"},
      {"code":"bm","name":"Bambara","nativeName":"bamanankan"},
      {"code":"ba","name":"Bashkir","nativeName":"башҡорт теле"},
      {"code":"eu","name":"Basque","nativeName":"euskara, euskera"},
      {"code":"be","name":"Belarusian","nativeName":"Беларуская"},
      {"code":"bn","name":"Bengali","nativeName":"বাংলা"},
      {"code":"bh","name":"Bihari","nativeName":"भोजपुरी"},
      {"code":"bi","name":"Bislama","nativeName":"Bislama"},
      {"code":"bs","name":"Bosnian","nativeName":"bosanski jezik"},
      {"code":"br","name":"Breton","nativeName":"brezhoneg"},
      {"code":"bg","name":"Bulgarian","nativeName":"български език"},
      {"code":"my","name":"Burmese","nativeName":"ဗမာစာ"},
      {"code":"ca","name":"Catalan; Valencian","nativeName":"Català"},
      {"code":"ch","name":"Chamorro","nativeName":"Chamoru"},
      {"code":"ce","name":"Chechen","nativeName":"нохчийн мотт"},
      {"code":"ny","name":"Chichewa; Chewa; Nyanja","nativeName":"chiCheŵa, chinyanja"},
      {"code":"zh","name":"Chinese","nativeName":"中文 (Zhōngwén), 汉语, 漢語"},
      {"code":"cv","name":"Chuvash","nativeName":"чӑваш чӗлхи"},
      {"code":"kw","name":"Cornish","nativeName":"Kernewek"},
      {"code":"co","name":"Corsican","nativeName":"corsu, lingua corsa"},
      {"code":"cr","name":"Cree","nativeName":"ᓀᐦᐃᔭᐍᐏᐣ"},
      {"code":"hr","name":"Croatian","nativeName":"hrvatski"},
      {"code":"cs","name":"Czech","nativeName":"česky, čeština"},
      {"code":"da","name":"Danish","nativeName":"dansk"},
      {"code":"dv","name":"Divehi; Dhivehi; Maldivian;","nativeName":"ދިވެހި"},
      {"code":"nl","name":"Dutch","nativeName":"Nederlands, Vlaams"},
      {"code":"en","name":"English","nativeName":"English"},
      {"code":"eo","name":"Esperanto","nativeName":"Esperanto"},
      {"code":"et","name":"Estonian","nativeName":"eesti, eesti keel"},
      {"code":"ee","name":"Ewe","nativeName":"Eʋegbe"},
      {"code":"fo","name":"Faroese","nativeName":"føroyskt"},
      {"code":"fj","name":"Fijian","nativeName":"vosa Vakaviti"},
      {"code":"fi","name":"Finnish","nativeName":"suomi, suomen kieli"},
      {"code":"fr","name":"French","nativeName":"français, langue française"},
      {"code":"ff","name":"Fula; Fulah; Pulaar; Pular","nativeName":"Fulfulde, Pulaar, Pular"},
      {"code":"gl","name":"Galician","nativeName":"Galego"},
      {"code":"ka","name":"Georgian","nativeName":"ქართული"},
      {"code":"de","name":"German","nativeName":"Deutsch"},
      {"code":"el","name":"Greek, Modern","nativeName":"Ελληνικά"},
      {"code":"gn","name":"Guaraní","nativeName":"Avañeẽ"},
      {"code":"gu","name":"Gujarati","nativeName":"ગુજરાતી"},
      {"code":"ht","name":"Haitian; Haitian Creole","nativeName":"Kreyòl ayisyen"},
      {"code":"ha","name":"Hausa","nativeName":"Hausa, هَوُسَ"},
      {"code":"he","name":"Hebrew (modern)","nativeName":"עברית"},
      {"code":"hz","name":"Herero","nativeName":"Otjiherero"},
      {"code":"hi","name":"Hindi","nativeName":"हिन्दी, हिंदी"},
      {"code":"ho","name":"Hiri Motu","nativeName":"Hiri Motu"},
      {"code":"hu","name":"Hungarian","nativeName":"Magyar"},
      {"code":"ia","name":"Interlingua","nativeName":"Interlingua"},
      {"code":"id","name":"Indonesian","nativeName":"Bahasa Indonesia"},
      {"code":"ie","name":"Interlingue","nativeName":"Originally called Occidental; then Interlingue after WWII"},
      {"code":"ga","name":"Irish","nativeName":"Gaeilge"},
      {"code":"ig","name":"Igbo","nativeName":"Asụsụ Igbo"},
      {"code":"ik","name":"Inupiaq","nativeName":"Iñupiaq, Iñupiatun"},
      {"code":"io","name":"Ido","nativeName":"Ido"},
      {"code":"is","name":"Icelandic","nativeName":"Íslenska"},
      {"code":"it","name":"Italian","nativeName":"Italiano"},
      {"code":"iu","name":"Inuktitut","nativeName":"ᐃᓄᒃᑎᑐᑦ"},
      {"code":"ja","name":"Japanese","nativeName":"日本語 (にほんご/にっぽんご)"},
      {"code":"jv","name":"Javanese","nativeName":"basa Jawa"},
      {"code":"kl","name":"Kalaallisut, Greenlandic","nativeName":"kalaallisut, kalaallit oqaasii"},
      {"code":"kn","name":"Kannada","nativeName":"ಕನ್ನಡ"},
      {"code":"kr","name":"Kanuri","nativeName":"Kanuri"},
      {"code":"ks","name":"Kashmiri","nativeName":"कश्मीरी, كشميري‎"},
      {"code":"kk","name":"Kazakh","nativeName":"Қазақ тілі"},
      {"code":"km","name":"Khmer","nativeName":"ភាសាខ្មែរ"},
      {"code":"ki","name":"Kikuyu, Gikuyu","nativeName":"Gĩkũyũ"},
      {"code":"rw","name":"Kinyarwanda","nativeName":"Ikinyarwanda"},
      {"code":"ky","name":"Kirghiz, Kyrgyz","nativeName":"кыргыз тили"},
      {"code":"kv","name":"Komi","nativeName":"коми кыв"},
      {"code":"kg","name":"Kongo","nativeName":"KiKongo"},
      {"code":"ko","name":"Korean","nativeName":"한국어 (韓國語), 조선말 (朝鮮語)"},
      {"code":"ku","name":"Kurdish","nativeName":"Kurdî, كوردی‎"},
      {"code":"kj","name":"Kwanyama, Kuanyama","nativeName":"Kuanyama"},
      {"code":"la","name":"Latin","nativeName":"latine, lingua latina"},
      {"code":"lb","name":"Luxembourgish, Letzeburgesch","nativeName":"Lëtzebuergesch"},
      {"code":"lg","name":"Luganda","nativeName":"Luganda"},
      {"code":"li","name":"Limburgish, Limburgan, Limburger","nativeName":"Limburgs"},
      {"code":"ln","name":"Lingala","nativeName":"Lingála"},
      {"code":"lo","name":"Lao","nativeName":"ພາສາລາວ"},
      {"code":"lt","name":"Lithuanian","nativeName":"lietuvių kalba"},
      {"code":"lu","name":"Luba-Katanga","nativeName":""},
      {"code":"lv","name":"Latvian","nativeName":"latviešu valoda"},
      {"code":"gv","name":"Manx","nativeName":"Gaelg, Gailck"},
      {"code":"mk","name":"Macedonian","nativeName":"македонски јазик"},
      {"code":"mg","name":"Malagasy","nativeName":"Malagasy fiteny"},
      {"code":"ms","name":"Malay","nativeName":"bahasa Melayu, بهاس ملايو‎"},
      {"code":"ml","name":"Malayalam","nativeName":"മലയാളം"},
      {"code":"mt","name":"Maltese","nativeName":"Malti"},
      {"code":"mi","name":"Māori","nativeName":"te reo Māori"},
      {"code":"mr","name":"Marathi (Marāṭhī)","nativeName":"मराठी"},
      {"code":"mh","name":"Marshallese","nativeName":"Kajin M̧ajeļ"},
      {"code":"mn","name":"Mongolian","nativeName":"монгол"},
      {"code":"na","name":"Nauru","nativeName":"Ekakairũ Naoero"},
      {"code":"nv","name":"Navajo, Navaho","nativeName":"Diné bizaad, Dinékʼehǰí"},
      {"code":"nb","name":"Norwegian Bokmål","nativeName":"Norsk bokmål"},
      {"code":"nd","name":"North Ndebele","nativeName":"isiNdebele"},
      {"code":"ne","name":"Nepali","nativeName":"नेपाली"},
      {"code":"ng","name":"Ndonga","nativeName":"Owambo"},
      {"code":"nn","name":"Norwegian Nynorsk","nativeName":"Norsk nynorsk"},
      {"code":"no","name":"Norwegian","nativeName":"Norsk"},
      {"code":"ii","name":"Nuosu","nativeName":"ꆈꌠ꒿ Nuosuhxop"},
      {"code":"nr","name":"South Ndebele","nativeName":"isiNdebele"},
      {"code":"oc","name":"Occitan","nativeName":"Occitan"},
      {"code":"oj","name":"Ojibwe, Ojibwa","nativeName":"ᐊᓂᔑᓈᐯᒧᐎᓐ"},
      {"code":"cu","name":"Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic","nativeName":"ѩзыкъ словѣньскъ"},
      {"code":"om","name":"Oromo","nativeName":"Afaan Oromoo"},
      {"code":"or","name":"Oriya","nativeName":"ଓଡ଼ିଆ"},
      {"code":"os","name":"Ossetian, Ossetic","nativeName":"ирон æвзаг"},
      {"code":"pa","name":"Panjabi, Punjabi","nativeName":"ਪੰਜਾਬੀ, پنجابی‎"},
      {"code":"pi","name":"Pāli","nativeName":"पाऴि"},
      {"code":"fa","name":"Persian","nativeName":"فارسی"},
      {"code":"pl","name":"Polish","nativeName":"polski"},
      {"code":"ps","name":"Pashto, Pushto","nativeName":"پښتو"},
      {"code":"pt","name":"Portuguese","nativeName":"Português"},
      {"code":"qu","name":"Quechua","nativeName":"Runa Simi, Kichwa"},
      {"code":"rm","name":"Romansh","nativeName":"rumantsch grischun"},
      {"code":"rn","name":"Kirundi","nativeName":"kiRundi"},
      {"code":"ro","name":"Romanian, Moldavian, Moldovan","nativeName":"română"},
      {"code":"ru","name":"Russian","nativeName":"русский язык"},
      {"code":"sa","name":"Sanskrit (Saṁskṛta)","nativeName":"संस्कृतम्"},
      {"code":"sc","name":"Sardinian","nativeName":"sardu"},
      {"code":"sd","name":"Sindhi","nativeName":"सिन्धी, سنڌي، سندھی‎"},
      {"code":"se","name":"Northern Sami","nativeName":"Davvisámegiella"},
      {"code":"sm","name":"Samoan","nativeName":"gagana faa Samoa"},
      {"code":"sg","name":"Sango","nativeName":"yângâ tî sängö"},
      {"code":"sr","name":"Serbian","nativeName":"српски језик"},
      {"code":"gd","name":"Scottish Gaelic; Gaelic","nativeName":"Gàidhlig"},
      {"code":"sn","name":"Shona","nativeName":"chiShona"},
      {"code":"si","name":"Sinhala, Sinhalese","nativeName":"සිංහල"},
      {"code":"sk","name":"Slovak","nativeName":"slovenčina"},
      {"code":"sl","name":"Slovene","nativeName":"slovenščina"},
      {"code":"so","name":"Somali","nativeName":"Soomaaliga, af Soomaali"},
      {"code":"st","name":"Southern Sotho","nativeName":"Sesotho"},
      {"code":"es","name":"Spanish; Castilian","nativeName":"español, castellano"},
      {"code":"su","name":"Sundanese","nativeName":"Basa Sunda"},
      {"code":"sw","name":"Swahili","nativeName":"Kiswahili"},
      {"code":"ss","name":"Swati","nativeName":"SiSwati"},
      {"code":"sv","name":"Swedish","nativeName":"svenska"},
      {"code":"ta","name":"Tamil","nativeName":"தமிழ்"},
      {"code":"te","name":"Telugu","nativeName":"తెలుగు"},
      {"code":"tg","name":"Tajik","nativeName":"тоҷикӣ, toğikī, تاجیکی‎"},
      {"code":"th","name":"Thai","nativeName":"ไทย"},
      {"code":"ti","name":"Tigrinya","nativeName":"ትግርኛ"},
      {"code":"bo","name":"Tibetan Standard, Tibetan, Central","nativeName":"བོད་ཡིག"},
      {"code":"tk","name":"Turkmen","nativeName":"Türkmen, Түркмен"},
      {"code":"tl","name":"Tagalog","nativeName":"Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔"},
      {"code":"tn","name":"Tswana","nativeName":"Setswana"},
      {"code":"to","name":"Tonga (Tonga Islands)","nativeName":"faka Tonga"},
      {"code":"tr","name":"Turkish","nativeName":"Türkçe"},
      {"code":"ts","name":"Tsonga","nativeName":"Xitsonga"},
      {"code":"tt","name":"Tatar","nativeName":"татарча, tatarça, تاتارچا‎"},
      {"code":"tw","name":"Twi","nativeName":"Twi"},
      {"code":"ty","name":"Tahitian","nativeName":"Reo Tahiti"},
      {"code":"ug","name":"Uighur, Uyghur","nativeName":"Uyƣurqə, ئۇيغۇرچە‎"},
      {"code":"uk","name":"Ukrainian","nativeName":"українська"},
      {"code":"ur","name":"Urdu","nativeName":"اردو"},
      {"code":"uz","name":"Uzbek","nativeName":"zbek, Ўзбек, أۇزبېك‎"},
      {"code":"ve","name":"Venda","nativeName":"Tshivenḓa"},
      {"code":"vi","name":"Vietnamese","nativeName":"Tiếng Việt"},
      {"code":"vo","name":"Volapük","nativeName":"Volapük"},
      {"code":"wa","name":"Walloon","nativeName":"Walon"},
      {"code":"cy","name":"Welsh","nativeName":"Cymraeg"},
      {"code":"wo","name":"Wolof","nativeName":"Wollof"},
      {"code":"fy","name":"Western Frisian","nativeName":"Frysk"},
      {"code":"xh","name":"Xhosa","nativeName":"isiXhosa"},
      {"code":"yi","name":"Yiddish","nativeName":"ייִדיש"},
      {"code":"yo","name":"Yoruba","nativeName":"Yorùbá"},
      {"code":"za","name":"Zhuang, Chuang","nativeName":"Saɯ cueŋƅ, Saw cuengh"}
    ]

Ответ 3

Я думаю, что Организация Объединенных Наций или ИСО фактически публикуют этот список в формате CSV. Это будет конечный источник.

Однако я не уверен, что они публикуют его бесплатно.

EDIT: На самом деле ссылка находится в статье Wikipedia, с которой вы связались. Американская библиотека Конгресса была назначена официальным органом регистрации ISO и публикует весь, официальный, обновленный список как тривиальный для анализа текста файл бесплатно.

Формат выглядит следующим образом:

ara||ar|Arabic|arabe
arc|||Official Aramaic (700-300 BCE); Imperial Aramaic (700-300 BCE)|araméen d'empire (700-300 BCE)
arg||an|Aragonese|aragonais
arm|hye|hy|Armenian|arménien
arn|||Mapudungun; Mapuche|mapudungun; mapuche; mapuce
arp|||Arapaho|arapaho
art|||Artificial languages|artificielles, langues
arw|||Arawak|arawak
asm||as|Assamese|assamais
ast|||Asturian; Bable; Leonese; Asturleonese|asturien; bable; léonais; asturoléonais
ath|||Athapascan languages|athapascanes, langues

Это 5 полей, разделенных вертикальными полосами:

  • ISO 639-2 Библиографический код Alpha-3
  • ISO 639-2 Код терминологии Alpha-3
  • ISO 639-1 Код Alpha-2
  • Английское название (имена)
  • Имя французского языка

Итак, это действительно в формате CSV, если вы интерпретируете это как значения, разделенные символами, вместо значений, разделенных запятыми, которые позволяют большинство парсеров CSV.

Ответ 4

Оформить заказ исходный код в записи Википедии.

Это очень простой формат - ячейки таблицы разделяются на ||. Это намного проще анализировать, чем HTML.

Ответ 5

Я создаю json file, включая все языки во всех переводах. В my github repo вы также найдете script и источники для создания этого json файла.

Ответ 6

Он доступен в HTML по ссылке, которую вы опубликовали в своем вопросе:) Серьезно, если этот список в Википедии завершен, то его можно легко схватить, используя lxml.html (в Python) или любую подобную библиотеку на вашем любимом языке.

Ответ 7

Эта функция PHP преобразует языковой код в имя языка, используя файл данных Библиотеки Конгресса:

function lang_code_to_name($code)
{
    // init
    $lines = array();
    $line_items = array();
    $language = '';
    $code = strtolower($code);

    // strip any possible sub-language
    $pos = strpos($code, '-');
    if ($pos) {$code = substr($code, 0, $pos);}

    // get code list from Library of Congress
    // format: five elements per line
    // ISO 639-2 Alpha-3 bibliographic code|ISO 639-2 Alpha-3 terminology code|ISO 639-1 Alpha-2 code|English language name(s)|French language name(s)
    $url = 'http://loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt';
    $list = file_get_contents($url);

    if (!$list) {return $language;}

    // read the file
    $lines = explode("\n", $list);
    for ($i; $i < sizeof($lines); $i++)
    {
        $line_item = explode("|", $lines[$i]);
        if (($line_item[0] == $code) || ($line_item[1] == $code) || ($line_item[2] == $code))
        {
            $language = $line_item[3];
            break;
        }
    }

    // exit
    return $language;
}

Ответ 8

Вы также можете попробовать этот JSON, записанный как список объектов:

[
  {
    "code": "ab",
    "name": "Abkhaz"
  },
  {
    "code": "aa",
    "name": "Afar"
  },
  {
    "code": "af",
    "name": "Afrikaans"
  },
  {
    "code": "ak",
    "name": "Akan"
  },
  {
    "code": "sq",
    "name": "Albanian"
  },
  {
    "code": "am",
    "name": "Amharic"
  },
  {
    "code": "ar",
    "name": "Arabic"
  },
  {
    "code": "an",
    "name": "Aragonese"
  },
  {
    "code": "hy",
    "name": "Armenian"
  },
  {
    "code": "as",
    "name": "Assamese"
  },
  {
    "code": "av",
    "name": "Avaric"
  },
  {
    "code": "ae",
    "name": "Avestan"
  },
  {
    "code": "ay",
    "name": "Aymara"
  },
  {
    "code": "az",
    "name": "Azerbaijani"
  },
  {
    "code": "bm",
    "name": "Bambara"
  },
  {
    "code": "ba",
    "name": "Bashkir"
  },
  {
    "code": "eu",
    "name": "Basque"
  },
  {
    "code": "be",
    "name": "Belarusian"
  },
  {
    "code": "bn",
    "name": "Bengali; Bangla"
  },
  {
    "code": "bh",
    "name": "Bihari"
  },
  {
    "code": "bi",
    "name": "Bislama"
  },
  {
    "code": "bs",
    "name": "Bosnian"
  },
  {
    "code": "br",
    "name": "Breton"
  },
  {
    "code": "bg",
    "name": "Bulgarian"
  },
  {
    "code": "my",
    "name": "Burmese"
  },
  {
    "code": "ca",
    "name": "Catalan; Valencian"
  },
  {
    "code": "ch",
    "name": "Chamorro"
  },
  {
    "code": "ce",
    "name": "Chechen"
  },
  {
    "code": "ny",
    "name": "Chichewa; Chewa; Nyanja"
  },
  {
    "code": "zh",
    "name": "Chinese"
  },
  {
    "code": "cv",
    "name": "Chuvash"
  },
  {
    "code": "kw",
    "name": "Cornish"
  },
  {
    "code": "co",
    "name": "Corsican"
  },
  {
    "code": "cr",
    "name": "Cree"
  },
  {
    "code": "hr",
    "name": "Croatian"
  },
  {
    "code": "cs",
    "name": "Czech"
  },
  {
    "code": "da",
    "name": "Danish"
  },
  {
    "code": "dv",
    "name": "Divehi; Dhivehi; Maldivian;"
  },
  {
    "code": "nl",
    "name": "Dutch"
  },
  {
    "code": "dz",
    "name": "Dzongkha"
  },
  {
    "code": "en",
    "name": "English"
  },
  {
    "code": "eo",
    "name": "Esperanto"
  },
  {
    "code": "et",
    "name": "Estonian"
  },
  {
    "code": "ee",
    "name": "Ewe"
  },
  {
    "code": "fo",
    "name": "Faroese"
  },
  {
    "code": "fj",
    "name": "Fijian"
  },
  {
    "code": "fi",
    "name": "Finnish"
  },
  {
    "code": "fr",
    "name": "French"
  },
  {
    "code": "ff",
    "name": "Fula; Fulah; Pulaar; Pular"
  },
  {
    "code": "gl",
    "name": "Galician"
  },
  {
    "code": "ka",
    "name": "Georgian"
  },
  {
    "code": "de",
    "name": "German"
  },
  {
    "code": "el",
    "name": "Greek, Modern"
  },
  {
    "code": "gn",
    "name": "Guaraní"
  },
  {
    "code": "gu",
    "name": "Gujarati"
  },
  {
    "code": "ht",
    "name": "Haitian; Haitian Creole"
  },
  {
    "code": "ha",
    "name": "Hausa"
  },
  {
    "code": "he",
    "name": "Hebrew (modern)"
  },
  {
    "code": "hz",
    "name": "Herero"
  },
  {
    "code": "hi",
    "name": "Hindi"
  },
  {
    "code": "ho",
    "name": "Hiri Motu"
  },
  {
    "code": "hu",
    "name": "Hungarian"
  },
  {
    "code": "ia",
    "name": "Interlingua"
  },
  {
    "code": "id",
    "name": "Indonesian"
  },
  {
    "code": "ie",
    "name": "Interlingue"
  },
  {
    "code": "ga",
    "name": "Irish"
  },
  {
    "code": "ig",
    "name": "Igbo"
  },
  {
    "code": "ik",
    "name": "Inupiaq"
  },
  {
    "code": "io",
    "name": "Ido"
  },
  {
    "code": "is",
    "name": "Icelandic"
  },
  {
    "code": "it",
    "name": "Italian"
  },
  {
    "code": "iu",
    "name": "Inuktitut"
  },
  {
    "code": "ja",
    "name": "Japanese"
  },
  {
    "code": "jv",
    "name": "Javanese"
  },
  {
    "code": "kl",
    "name": "Kalaallisut, Greenlandic"
  },
  {
    "code": "kn",
    "name": "Kannada"
  },
  {
    "code": "kr",
    "name": "Kanuri"
  },
  {
    "code": "ks",
    "name": "Kashmiri"
  },
  {
    "code": "kk",
    "name": "Kazakh"
  },
  {
    "code": "km",
    "name": "Khmer"
  },
  {
    "code": "ki",
    "name": "Kikuyu, Gikuyu"
  },
  {
    "code": "rw",
    "name": "Kinyarwanda"
  },
  {
    "code": "ky",
    "name": "Kyrgyz"
  },
  {
    "code": "kv",
    "name": "Komi"
  },
  {
    "code": "kg",
    "name": "Kongo"
  },
  {
    "code": "ko",
    "name": "Korean"
  },
  {
    "code": "ku",
    "name": "Kurdish"
  },
  {
    "code": "kj",
    "name": "Kwanyama, Kuanyama"
  },
  {
    "code": "la",
    "name": "Latin"
  },
  {
    "code": "lb",
    "name": "Luxembourgish, Letzeburgesch"
  },
  {
    "code": "lg",
    "name": "Ganda"
  },
  {
    "code": "li",
    "name": "Limburgish, Limburgan, Limburger"
  },
  {
    "code": "ln",
    "name": "Lingala"
  },
  {
    "code": "lo",
    "name": "Lao"
  },
  {
    "code": "lt",
    "name": "Lithuanian"
  },
  {
    "code": "lu",
    "name": "Luba-Katanga"
  },
  {
    "code": "lv",
    "name": "Latvian"
  },
  {
    "code": "gv",
    "name": "Manx"
  },
  {
    "code": "mk",
    "name": "Macedonian"
  },
  {
    "code": "mg",
    "name": "Malagasy"
  },
  {
    "code": "ms",
    "name": "Malay"
  },
  {
    "code": "ml",
    "name": "Malayalam"
  },
  {
    "code": "mt",
    "name": "Maltese"
  },
  {
    "code": "mi",
    "name": "MÄori"
  },
  {
    "code": "mr",
    "name": "Marathi (MarÄá¹­hÄ«)"
  },
  {
    "code": "mh",
    "name": "Marshallese"
  },
  {
    "code": "mn",
    "name": "Mongolian"
  },
  {
    "code": "na",
    "name": "Nauru"
  },
  {
    "code": "nv",
    "name": "Navajo, Navaho"
  },
  {
    "code": "nb",
    "name": "Norwegian Bokmål"
  },
  {
    "code": "nd",
    "name": "North Ndebele"
  },
  {
    "code": "ne",
    "name": "Nepali"
  },
  {
    "code": "ng",
    "name": "Ndonga"
  },
  {
    "code": "nn",
    "name": "Norwegian Nynorsk"
  },
  {
    "code": "no",
    "name": "Norwegian"
  },
  {
    "code": "ii",
    "name": "Nuosu"
  },
  {
    "code": "nr",
    "name": "South Ndebele"
  },
  {
    "code": "oc",
    "name": "Occitan"
  },
  {
    "code": "oj",
    "name": "Ojibwe, Ojibwa"
  },
  {
    "code": "cu",
    "name": "Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic"
  },
  {
    "code": "om",
    "name": "Oromo"
  },
  {
    "code": "or",
    "name": "Oriya"
  },
  {
    "code": "os",
    "name": "Ossetian, Ossetic"
  },
  {
    "code": "pa",
    "name": "Panjabi, Punjabi"
  },
  {
    "code": "pi",
    "name": "PÄli"
  },
  {
    "code": "fa",
    "name": "Persian (Farsi)"
  },
  {
    "code": "pl",
    "name": "Polish"
  },
  {
    "code": "ps",
    "name": "Pashto, Pushto"
  },
  {
    "code": "pt",
    "name": "Portuguese"
  },
  {
    "code": "qu",
    "name": "Quechua"
  },
  {
    "code": "rm",
    "name": "Romansh"
  },
  {
    "code": "rn",
    "name": "Kirundi"
  },
  {
    "code": "ro",
    "name": "Romanian, [])"
  },
  {
    "code": "ru",
    "name": "Russian"
  },
  {
    "code": "sa",
    "name": "Sanskrit (Saá¹ská¹›ta)"
  },
  {
    "code": "sc",
    "name": "Sardinian"
  },
  {
    "code": "sd",
    "name": "Sindhi"
  },
  {
    "code": "se",
    "name": "Northern Sami"
  },
  {
    "code": "sm",
    "name": "Samoan"
  },
  {
    "code": "sg",
    "name": "Sango"
  },
  {
    "code": "sr",
    "name": "Serbian"
  },
  {
    "code": "gd",
    "name": "Scottish Gaelic; Gaelic"
  },
  {
    "code": "sn",
    "name": "Shona"
  },
  {
    "code": "si",
    "name": "Sinhala, Sinhalese"
  },
  {
    "code": "sk",
    "name": "Slovak"
  },
  {
    "code": "sl",
    "name": "Slovene"
  },
  {
    "code": "so",
    "name": "Somali"
  },
  {
    "code": "st",
    "name": "Southern Sotho"
  },
  {
    "code": "az",
    "name": "South Azerbaijani"
  },
  {
    "code": "es",
    "name": "Spanish; Castilian"
  },
  {
    "code": "su",
    "name": "Sundanese"
  },
  {
    "code": "sw",
    "name": "Swahili"
  },
  {
    "code": "ss",
    "name": "Swati"
  },
  {
    "code": "sv",
    "name": "Swedish"
  },
  {
    "code": "ta",
    "name": "Tamil"
  },
  {
    "code": "te",
    "name": "Telugu"
  },
  {
    "code": "tg",
    "name": "Tajik"
  },
  {
    "code": "th",
    "name": "Thai"
  },
  {
    "code": "ti",
    "name": "Tigrinya"
  },
  {
    "code": "bo",
    "name": "Tibetan Standard, Tibetan, Central"
  },
  {
    "code": "tk",
    "name": "Turkmen"
  },
  {
    "code": "tl",
    "name": "Tagalog"
  },
  {
    "code": "tn",
    "name": "Tswana"
  },
  {
    "code": "to",
    "name": "Tonga (Tonga Islands)"
  },
  {
    "code": "tr",
    "name": "Turkish"
  },
  {
    "code": "ts",
    "name": "Tsonga"
  },
  {
    "code": "tt",
    "name": "Tatar"
  },
  {
    "code": "tw",
    "name": "Twi"
  },
  {
    "code": "ty",
    "name": "Tahitian"
  },
  {
    "code": "ug",
    "name": "Uyghur, Uighur"
  },
  {
    "code": "uk",
    "name": "Ukrainian"
  },
  {
    "code": "ur",
    "name": "Urdu"
  },
  {
    "code": "uz",
    "name": "Uzbek"
  },
  {
    "code": "ve",
    "name": "Venda"
  },
  {
    "code": "vi",
    "name": "Vietnamese"
  },
  {
    "code": "vo",
    "name": "Volapük"
  },
  {
    "code": "wa",
    "name": "Walloon"
  },
  {
    "code": "cy",
    "name": "Welsh"
  },
  {
    "code": "wo",
    "name": "Wolof"
  },
  {
    "code": "fy",
    "name": "Western Frisian"
  },
  {
    "code": "xh",
    "name": "Xhosa"
  },
  {
    "code": "yi",
    "name": "Yiddish"
  },
  {
    "code": "yo",
    "name": "Yoruba"
  },
  {
    "code": "za",
    "name": "Zhuang, Chuang"
  },
  {
    "code": "zu",
    "name": "Zulu"
  }
]

Ответ 9

Здесь маленький script в Groovy, который печатает JSON со всеми языковыми кодами с их родным, английским и португальским именами.

def en = new Locale("en")
def pt = new Locale("pt")
def nameFor(loc, lang) { loc.getDisplayLanguage(lang).replaceAll(/\S+/){ w -> w.toLowerCase().capitalize()} }

println("export default {")
Locale.getISOLanguages().each{
  def l = new Locale(it)
  println("  $it: {native: '${nameFor(l, l)}', en: '${nameFor(l, en)}', pt: '${nameFor(l, pt)}'},")
}
println("}")

$groovy langs2json.groovy > languagess.json

Ответ 10

Этот небольшой код может помочь построить массив, используя 2-буквенный код "iso639-1" в качестве "ключа" и имя языка как "значение", получающее данные: от http://loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt

<?php
$lang = array();
$row = 1;
if (($handle = fopen('http://loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt', 'r')) !== FALSE) {
  while (($data = fgetcsv($handle, 1000, '|')) !== FALSE) {
    $row++;
    if (!empty($data[2])) {
      /* to get only the first language (anything before ;) */
      $lang[$data[2]]  = strtok($data[3], ';'); 
     }
  }
  fclose($handle);
}

?>

Ответ 12

Я преобразовал 'Instine' answer в формат С#

public class Language
{
	public string Code;
	public string Name;
	public string NativeName;

	public Language(string code, string name, string nativeName)
	{
		Code = code;
		Name = name;
		NativeName = nativeName;
	}

	public Language()
	{
	}
}

public class Languages
{
	public IList<Language> LanguagesList = new List<Language>();

	protected void AddLang(string code, string name, string nativeName)
	{
		var lang = new Language(code, name, nativeName);
		LanguagesList.Add(lang);
	}

	public void Initialize()
	{
		AddLang("ab", "Abkhaz", "аҧсуа");

		AddLang(
			"aa",
			"Afar",
			"Afaraf"
			);
		AddLang(
			"af",
			"Afrikaans",
			"Afrikaans"
			);
		AddLang(
			"ak",
			"Akan",
			"Akan"
			);
		AddLang(
			"sq",
			"Albanian",
			"Shqip"
			);
		AddLang(
			"am",
			"Amharic",
			"አማርኛ"
			);
		AddLang(
			"ar",
			"Arabic",
			"العربية"
			);
		AddLang(
			"an",
			"Aragonese",
			"Aragonés"
			);
		AddLang(
			"hy",
			"Armenian",
			"Հայերեն"
			);
		AddLang(
			"as",
			"Assamese",
			"অসমীয়া"
			);
		AddLang(
			"av",
			"Avaric",
			"авар мацӀ, магӀарул мацӀ"
			);
		AddLang(
			"ae",
			"Avestan",
			"avesta"
			);
		AddLang(
			"ay",
			"Aymara",
			"aymar aru"
			);
		AddLang(
			"az",
			"Azerbaijani",
			"azərbaycan dili"
			);
		AddLang(
			"bm",
			"Bambara",
			"bamanankan"
			);
		AddLang(
			"ba",
			"Bashkir",
			"башҡорт теле"
			);
		AddLang(
			"eu",
			"Basque",
			"euskara, euskera"
			);
		AddLang(
			"be",
			"Belarusian",
			"Беларуская"
			);
		AddLang(
			"bn",
			"Bengali",
			"বাংলা"
			);
		AddLang(
			"bh",
			"Bihari",
			"भोजपुरी"
			);
		AddLang(
			"bi",
			"Bislama",
			"Bislama"
			);
		AddLang(
			"bs",
			"Bosnian",
			"bosanski jezik"
			);
		AddLang(
			"br",
			"Breton",
			"brezhoneg"
			);
		AddLang(
			"bg",
			"Bulgarian",
			"български език"
			);
		AddLang(
			"my",
			"Burmese",
			"ဗမာစာ"
			);
		AddLang(
			"ca",
			"Catalan; Valencian",
			"Català"
			);
		AddLang(
			"ch",
			"Chamorro",
			"Chamoru"
			);
		AddLang(
			"ce",
			"Chechen",
			"нохчийн мотт"
			);
		AddLang(
			"ny",
			"Chichewa; Chewa; Nyanja",
			"chiCheŵa, chinyanja"
			);
		AddLang(
			"zh",
			"Chinese",
			"中文 (Zhōngwén), 汉语, 漢語"
			);
		AddLang(
			"cv",
			"Chuvash",
			"чӑваш чӗлхи"
			);
		AddLang(
			"kw",
			"Cornish",
			"Kernewek"
			);
		AddLang(
			"co",
			"Corsican",
			"corsu, lingua corsa"
			);
		AddLang(
			"cr",
			"Cree",
			"ᓀᐦᐃᔭᐍᐏᐣ"
			);
		AddLang(
			"hr",
			"Croatian",
			"hrvatski"
			);
		AddLang(
			"cs",
			"Czech",
			"česky, čeština"
			);
		AddLang(
			"da",
			"Danish",
			"dansk"
			);
		AddLang(
			"dv",
			"Divehi; Dhivehi; Maldivian;",
			"ދިވެހި"
			);
		AddLang(
			"nl",
			"Dutch",
			"Nederlands, Vlaams"
			);
		AddLang(
			"en",
			"English",
			"English"
			);
		AddLang(
			"eo",
			"Esperanto",
			"Esperanto"
			);
		AddLang(
			"et",
			"Estonian",
			"eesti, eesti keel"
			);
		AddLang(
			"ee",
			"Ewe",
			"Eʋegbe"
			);
		AddLang(
			"fo",
			"Faroese",
			"føroyskt"
			);
		AddLang(
			"fj",
			"Fijian",
			"vosa Vakaviti"
			);
		AddLang(
			"fi",
			"Finnish",
			"suomi, suomen kieli"
			);
		AddLang(
			"fr",
			"French",
			"français, langue française"
			);
		AddLang(
			"ff",
			"Fula; Fulah; Pulaar; Pular",
			"Fulfulde, Pulaar, Pular"
			);
		AddLang(
			"gl",
			"Galician",
			"Galego"
			);
		AddLang(
			"ka",
			"Georgian",
			"ქართული"
			);
		AddLang(
			"de",
			"German",
			"Deutsch"
			);
		AddLang(
			"el",
			"Greek, Modern",
			"Ελληνικά"
			);
		AddLang(
			"gn",
			"Guaraní",
			"Avañeẽ"
			);
		AddLang(
			"gu",
			"Gujarati",
			"ગુજરાતી"
			);
		AddLang(
			"ht",
			"Haitian; Haitian Creole",
			"Kreyòl ayisyen"
			);
		AddLang(
			"ha",
			"Hausa",
			"Hausa, هَوُسَ"
			);
		AddLang(
			"he",
			"Hebrew (modern)",
			"עברית"
			);
		AddLang(
			"hz",
			"Herero",
			"Otjiherero"
			);
		AddLang(
			"hi",
			"Hindi",
			"हिन्दी, हिंदी"
			);
		AddLang(
			"ho",
			"Hiri Motu",
			"Hiri Motu"
			);
		AddLang(
			"hu",
			"Hungarian",
			"Magyar"
			);
		AddLang(
			"ia",
			"Interlingua",
			"Interlingua"
			);
		AddLang(
			"id",
			"Indonesian",
			"Bahasa Indonesia"
			);
		AddLang(
			"ie",
			"Interlingue",
			"Originally called Occidental; then Interlingue after WWII"
			);
		AddLang(
			"ga",
			"Irish",
			"Gaeilge"
			);
		AddLang(
			"ig",
			"Igbo",
			"Asụsụ Igbo"
			);
		AddLang(
			"ik",
			"Inupiaq",
			"Iñupiaq, Iñupiatun"
			);
		AddLang(
			"io",
			"Ido",
			"Ido"
			);
		AddLang(
			"is",
			"Icelandic",
			"Íslenska"
			);
		AddLang(
			"it",
			"Italian",
			"Italiano"
			);
		AddLang(
			"iu",
			"Inuktitut",
			"ᐃᓄᒃᑎᑐᑦ"
			);
		AddLang(
			"ja",
			"Japanese",
			"日本語 (にほんご/にっぽんご)"
			);
		AddLang(
			"jv",
			"Javanese",
			"basa Jawa"
			);
		AddLang(
			"kl",
			"Kalaallisut, Greenlandic",
			"kalaallisut, kalaallit oqaasii"
			);
		AddLang(
			"kn",
			"Kannada",
			"ಕನ್ನಡ"
			);
		AddLang(
			"kr",
			"Kanuri",
			"Kanuri"
			);
		AddLang(
			"ks",
			"Kashmiri",
			"कश्मीरी, كشميري‎"
			);
		AddLang(
			"kk",
			"Kazakh",
			"Қазақ тілі"
			);
		AddLang(
			"km",
			"Khmer",
			"ភាសាខ្មែរ"
			);
		AddLang(
			"ki",
			"Kikuyu, Gikuyu",
			"Gĩkũyũ"
			);
		AddLang(
			"rw",
			"Kinyarwanda",
			"Ikinyarwanda"
			);
		AddLang(
			"ky",
			"Kirghiz, Kyrgyz",
			"кыргыз тили"
			);
		AddLang(
			"kv",
			"Komi",
			"коми кыв"
			);
		AddLang(
			"kg",
			"Kongo",
			"KiKongo"
			);
		AddLang(
			"ko",
			"Korean",
			"한국어 (韓國語), 조선말 (朝鮮語)"
			);
		AddLang(
			"ku",
			"Kurdish",
			"Kurdî, كوردی‎"
			);
		AddLang(
			"kj",
			"Kwanyama, Kuanyama",
			"Kuanyama"
			);
		AddLang(
			"la",
			"Latin",
			"latine, lingua latina"
			);
		AddLang(
			"lb",
			"Luxembourgish, Letzeburgesch",
			"Lëtzebuergesch"
			);
		AddLang(
			"lg",
			"Luganda",
			"Luganda"
			);
		AddLang(
			"li",
			"Limburgish, Limburgan, Limburger",
			"Limburgs"
			);
		AddLang(
			"ln",
			"Lingala",
			"Lingála"
			);
		AddLang(
			"lo",
			"Lao",
			"ພາສາລາວ"
			);
		AddLang(
			"lt",
			"Lithuanian",
			"lietuvių kalba"
			);
		AddLang(
			"lu",
			"Luba-Katanga",
			""
			);
		AddLang(
			"lv",
			"Latvian",
			"latviešu valoda"
			);
		AddLang(
			"gv",
			"Manx",
			"Gaelg, Gailck"
			);
		AddLang(
			"mk",
			"Macedonian",
			"македонски јазик"
			);
		AddLang(
			"mg",
			"Malagasy",
			"Malagasy fiteny"
			);
		AddLang(
			"ms",
			"Malay",
			"bahasa Melayu, بهاس ملايو‎"
			);
		AddLang(
			"ml",
			"Malayalam",
			"മലയാളം"
			);
		AddLang(
			"mt",
			"Maltese",
			"Malti"
			);
		AddLang(
			"mi",
			"Māori",
			"te reo Māori"
			);
		AddLang(
			"mr",
			"Marathi (Marāṭhī)",
			"मराठी"
			);
		AddLang(
			"mh",
			"Marshallese",
			"Kajin M̧ajeļ"
			);
		AddLang(
			"mn",
			"Mongolian",
			"монгол"
			);
		AddLang(
			"na",
			"Nauru",
			"Ekakairũ Naoero"
			);
		AddLang(
			"nv",
			"Navajo, Navaho",
			"Diné bizaad, Dinékʼehǰí"
			);
		AddLang(
			"nb",
			"Norwegian Bokmål",
			"Norsk bokmål"
			);
		AddLang(
			"nd",
			"North Ndebele",
			"isiNdebele"
			);
		AddLang(
			"ne",
			"Nepali",
			"नेपाली"
			);
		AddLang(
			"ng",
			"Ndonga",
			"Owambo"
			);
		AddLang(
			"nn",
			"Norwegian Nynorsk",
			"Norsk nynorsk"
			);
		AddLang(
			"no",
			"Norwegian",
			"Norsk"
			);
		AddLang(
			"ii",
			"Nuosu",
			"ꆈꌠ꒿ Nuosuhxop"
			);
		AddLang(
			"nr",
			"South Ndebele",
			"isiNdebele"
			);
		AddLang(
			"oc",
			"Occitan",
			"Occitan"
			);
		AddLang(
			"oj",
			"Ojibwe, Ojibwa",
			"ᐊᓂᔑᓈᐯᒧᐎᓐ"
			);
		AddLang(
			"cu",
			"Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic",
			"ѩзыкъ словѣньскъ"
			);
		AddLang(
			"om",
			"Oromo",
			"Afaan Oromoo"
			);
		AddLang(
			"or",
			"Oriya",
			"ଓଡ଼ିଆ"
			);
		AddLang(
			"os",
			"Ossetian, Ossetic",
			"ирон æвзаг"
			);
		AddLang(
			"pa",
			"Panjabi, Punjabi",
			"ਪੰਜਾਬੀ, پنجابی‎"
			);
		AddLang(
			"pi",
			"Pāli",
			"पाऴि"
			);
		AddLang(
			"fa",
			"Persian",
			"فارسی"
			);
		AddLang(
			"pl",
			"Polish",
			"Polski"
			);
		AddLang(
			"ps",
			"Pashto, Pushto",
			"پښتو"
			);
		AddLang(
			"pt",
			"Portuguese",
			"Português"
			);
		AddLang(
			"qu",
			"Quechua",
			"Runa Simi, Kichwa"
			);
		AddLang(
			"rm",
			"Romansh",
			"rumantsch grischun"
			);
		AddLang(
			"rn",
			"Kirundi",
			"kiRundi"
			);
		AddLang(
			"ro",
			"Romanian, Moldavian, Moldovan",
			"română"
			);
		AddLang(
			"ru",
			"Russian",
			"русский язык"
			);
		AddLang(
			"sa",
			"Sanskrit (Saṁskṛta)",
			"संस्कृतम्"
			);
		AddLang(
			"sc",
			"Sardinian",
			"sardu"
			);
		AddLang(
			"sd",
			"Sindhi",
			"सिन्धी, سنڌي، سندھی‎"
			);
		AddLang(
			"se",
			"Northern Sami",
			"Davvisámegiella"
			);
		AddLang(
			"sm",
			"Samoan",
			"gagana faa Samoa"
			);
		AddLang(
			"sg",
			"Sango",
			"yângâ tî sängö"
			);
		AddLang(
			"sr",
			"Serbian",
			"српски језик"
			);
		AddLang(
			"gd",
			"Scottish Gaelic; Gaelic",
			"Gàidhlig"
			);
		AddLang(
			"sn",
			"Shona",
			"chiShona"
			);
		AddLang(
			"si",
			"Sinhala, Sinhalese",
			"සිංහල"
			);
		AddLang(
			"sk",
			"Slovak",
			"slovenčina"
			);
		AddLang(
			"sl",
			"Slovene",
			"slovenščina"
			);
		AddLang(
			"so",
			"Somali",
			"Soomaaliga, af Soomaali"
			);
		AddLang(
			"st",
			"Southern Sotho",
			"Sesotho"
			);
		AddLang(
			"es",
			"Spanish; Castilian",
			"español, castellano"
			);
		AddLang(
			"su",
			"Sundanese",
			"Basa Sunda"
			);
		AddLang(
			"sw",
			"Swahili",
			"Kiswahili"
			);
		AddLang(
			"ss",
			"Swati",
			"SiSwati"
			);
		AddLang(
			"sv",
			"Swedish",
			"svenska"
			);
		AddLang(
			"ta",
			"Tamil",
			"தமிழ்"
			);
		AddLang(
			"te",
			"Telugu",
			"తెలుగు"
			);
		AddLang(
			"tg",
			"Tajik",
			"тоҷикӣ, toğikī, تاجیکی‎"
			);
		AddLang(
			"th",
			"Thai",
			"ไทย"
			);
		AddLang(
			"ti",
			"Tigrinya",
			"ትግርኛ"
			);
		AddLang(
			"bo",
			"Tibetan Standard, Tibetan, Central",
			"བོད་ཡིག"
			);
		AddLang(
			"tk",
			"Turkmen",
			"Türkmen, Түркмен"
			);
		AddLang(
			"tl",
			"Tagalog",
			"Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔"
			);
		AddLang(
			"tn",
			"Tswana",
			"Setswana"
			);
		AddLang(
			"to",
			"Tonga (Tonga Islands)",
			"faka Tonga"
			);
		AddLang(
			"tr",
			"Turkish",
			"Türkçe"
			);
		AddLang(
			"ts",
			"Tsonga",
			"Xitsonga"
			);
		AddLang(
			"tt",
			"Tatar",
			"татарча, tatarça, تاتارچا‎"
			);
		AddLang(
			"tw",
			"Twi",
			"Twi"
			);
		AddLang(
			"ty",
			"Tahitian",
			"Reo Tahiti"
			);
		AddLang(
			"ug",
			"Uighur, Uyghur",
			"Uyƣurqə, ئۇيغۇرچە‎"
			);
		AddLang(
			"uk",
			"Ukrainian",
			"українська"
			);
		AddLang(
			"ur",
			"Urdu",
			"اردو"
			);
		AddLang(
			"uz",
			"Uzbek",
			"zbek, Ўзбек, أۇزبېك‎"
			);
		AddLang(
			"ve",
			"Venda",
			"Tshivenḓa"
			);
		AddLang(
			"vi",
			"Vietnamese",
			"Tiếng Việt"
			);
		AddLang(
			"vo",
			"Volapük",
			"Volapük"
			);
		AddLang(
			"wa",
			"Walloon",
			"Walon"
			);
		AddLang(
			"cy",
			"Welsh",
			"Cymraeg"
			);
		AddLang(
			"wo",
			"Wolof",
			"Wollof"
			);
		AddLang(
			"fy",
			"Western Frisian",
			"Frysk"
			);
		AddLang(
			"xh",
			"Xhosa",
			"isiXhosa"
			);
		AddLang(
			"yi",
			"Yiddish",
			"ייִדיש"
			);
		AddLang(
			"yo",
			"Yoruba",
			"Yorùbá"
			);
		AddLang(
			"za",
			"Zhuang, Chuang",
			"Saɯ cueŋƅ, Saw cuengh");
	}
}