From 3baa63de6fa89f6ce8c48ae0e40293f386b55a05 Mon Sep 17 00:00:00 2001 From: Dmytro Date: Sun, 16 Jul 2017 23:30:19 +0300 Subject: [PATCH] Add minimal list of Language names by alpha-2 code --- dist/minimal/README.md | 8 ++++++-- dist/minimal/languages.en.min.json | 1 + gulpfile.js | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 dist/minimal/languages.en.min.json diff --git a/dist/minimal/README.md b/dist/minimal/README.md index 5112bce..50387e3 100644 --- a/dist/minimal/README.md +++ b/dist/minimal/README.md @@ -1,4 +1,4 @@ -# Countries: minimal size data +# Countries & Languages: minimal size files This directory contains simplified data for each list, converting `Object` with fields to `Array` with fields in predefined order to decrease the file size (and traffic). @@ -12,7 +12,11 @@ Example: `{"UA":"Ukraine"}` Example: `{"UA":["Ukraine","Україна","380","EU","Kyiv","UAH",["uk"]]}` (`name`, `native`, `phone`, `continent`, `capital`, `currency`, `languages`). -## Languages ~6KB +## Language names (English) by **ISO 639-1 alpha-2** code ~2KB + +Example: `{"uk":"Ukrainian"}` + +## Languages ~4KB Example: `{"uk":["Ukrainian","Українська",0]}` (`name`, `native`, `rtl`). diff --git a/dist/minimal/languages.en.min.json b/dist/minimal/languages.en.min.json new file mode 100644 index 0000000..f826c2e --- /dev/null +++ b/dist/minimal/languages.en.min.json @@ -0,0 +1 @@ +{"af":"Afrikaans","am":"Amharic","ar":"Arabic","ay":"Aymara","az":"Azerbaijani","be":"Belarusian","bg":"Bulgarian","bi":"Bislama","bn":"Bengali","bs":"Bosnian","ca":"Catalan","ch":"Chamorro","cs":"Czech","da":"Danish","de":"German","dv":"Divehi","dz":"Dzongkha","el":"Greek","en":"English","es":"Spanish","et":"Estonian","eu":"Basque","fa":"Persian","ff":"Peul","fi":"Finnish","fj":"Fijian","fo":"Faroese","fr":"French","ga":"Irish","gl":"Galician","gn":"Guarani","gv":"Manx","he":"Hebrew","hi":"Hindi","hr":"Croatian","ht":"Haitian","hu":"Hungarian","hy":"Armenian","id":"Indonesian","is":"Icelandic","it":"Italian","ja":"Japanese","ka":"Georgian","kg":"Kongo","kk":"Kazakh","kl":"Greenlandic","km":"Cambodian","ko":"Korean","ku":"Kurdish","ky":"Kirghiz","la":"Latin","lb":"Luxembourgish","ln":"Lingala","lo":"Laotian","lt":"Lithuanian","lv":"Latvian","mg":"Malagasy","mh":"Marshallese","mi":"Maori","mk":"Macedonian","mn":"Mongolian","ms":"Malay","mt":"Maltese","my":"Burmese","na":"Nauruan","nd":"North Ndebele","ne":"Nepali","nl":"Dutch","nn":"Norwegian Nynorsk","no":"Norwegian","nr":"South Ndebele","ny":"Chichewa","oc":"Occitan","pa":"Panjabi / Punjabi","pl":"Polish","ps":"Pashto","pt":"Portuguese","qu":"Quechua","rn":"Kirundi","ro":"Romanian","ru":"Russian","rw":"Rwandi","sg":"Sango","si":"Sinhalese","sk":"Slovak","sl":"Slovenian","sm":"Samoan","sn":"Shona","so":"Somalia","sq":"Albanian","sr":"Serbian","ss":"Swati","st":"Southern Sotho","sv":"Swedish","sw":"Swahili","ta":"Tamil","tg":"Tajik","th":"Thai","ti":"Tigrinya","tk":"Turkmen","tn":"Tswana","to":"Tonga","tr":"Turkish","ts":"Tsonga","uk":"Ukrainian","ur":"Urdu","uz":"Uzbek","ve":"Venda","vi":"Vietnamese","xh":"Xhosa","zh":"Chinese","zu":"Zulu"} diff --git a/gulpfile.js b/gulpfile.js index 6056d97..f004672 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -114,6 +114,13 @@ gulp.task(DO_MINIMAL, function (callback) { }); fs.writeFileSync(`${DIST}${DO_MINIMAL}/${COUNTRIES}.${DO_MINIMAL}.${DO_MIN}.${JSON_EXT}`, JSON.stringify(minCountries) + LF); + // Languages: each item is a String language name in English + const minLanguageNames = {}; + Object.keys(languagesInUse).forEach(code => { + minLanguageNames[code] = languagesInUse[code].name; + }); + fs.writeFileSync(`${DIST}${DO_MINIMAL}/${LANGUAGES}.en.${DO_MIN}.${JSON_EXT}`, JSON.stringify(minLanguageNames) + LF); + // Languages: each item is an Array of fields in order const minLanguages = {}; Object.keys(languagesInUse).forEach(code => {