diff --git a/scripts/catalogs.js b/scripts/catalogs.js index 39e19450..debb0d43 100644 --- a/scripts/catalogs.js +++ b/scripts/catalogs.js @@ -73,18 +73,21 @@ function IDN(inputCode, outputCode) { return result; } -// Sort by percentage -const sortedCatalogs = Object.entries(catalogs) - .sort((a, b) => b[1] - a[1]) +const fullCatalogs = Object.entries(catalogs) + // sort by key + .sort((a, b) => a[0].localeCompare(b[0])) .map(([code, completion]) => { const nativeName = IDN(code, code); const name = IDN('en', code); - // let names = {}; return { code, nativeName, name, completion }; }); +// Sort by completion +const sortedCatalogs = [...fullCatalogs].sort( + (a, b) => b.completion - a.completion, +); console.table(sortedCatalogs); const path = 'src/data/catalogs.json'; -fs.writeFileSync(path, JSON.stringify(sortedCatalogs, null, 2)); +fs.writeFileSync(path, JSON.stringify(fullCatalogs, null, 2)); console.log('File written:', path); diff --git a/src/data/catalogs.json b/src/data/catalogs.json index f3a2b1cd..4a4272de 100644 --- a/src/data/catalogs.json +++ b/src/data/catalogs.json @@ -1,70 +1,16 @@ [ + { + "code": "ar-SA", + "nativeName": "العربية", + "name": "Arabic", + "completion": 26 + }, { "code": "ca-ES", "nativeName": "català", "name": "Catalan", "completion": 100 }, - { - "code": "es-ES", - "nativeName": "español", - "name": "Spanish", - "completion": 100 - }, - { - "code": "eu-ES", - "nativeName": "euskara", - "name": "Basque", - "completion": 100 - }, - { - "code": "fi-FI", - "nativeName": "suomi", - "name": "Finnish", - "completion": 100 - }, - { - "code": "kab", - "nativeName": "Taqbaylit", - "name": "Kabyle", - "completion": 100 - }, - { - "code": "ru-RU", - "nativeName": "русский", - "name": "Russian", - "completion": 100 - }, - { - "code": "zh-CN", - "nativeName": "简体中文", - "name": "Simplified Chinese", - "completion": 100 - }, - { - "code": "gl-ES", - "nativeName": "galego", - "name": "Galician", - "completion": 98 - }, - { - "code": "de-DE", - "nativeName": "Deutsch", - "name": "German", - "completion": 97 - }, - { - "code": "fr-FR", - "nativeName": "français", - "name": "French", - "completion": 97 - }, - { - "code": "ko-KR", - "nativeName": "한국어", - "name": "Korean", - "completion": 84 - }, { "code": "cs-CZ", "nativeName": "čeština", @@ -72,40 +18,10 @@ "completion": 79 }, { - "code": "fa-IR", - "nativeName": "فارسی", - "name": "Persian", - "completion": 68 - }, - { - "code": "nl-NL", - "nativeName": "Nederlands", - "name": "Dutch", - "completion": 48 - }, - { - "code": "lt-LT", - "nativeName": "lietuvių", - "name": "Lithuanian", - "completion": 42 - }, - { - "code": "ja-JP", - "nativeName": "日本語", - "name": "Japanese", - "completion": 32 - }, - { - "code": "ar-SA", - "nativeName": "العربية", - "name": "Arabic", - "completion": 26 - }, - { - "code": "it-IT", - "nativeName": "italiano", - "name": "Italian", - "completion": 24 + "code": "de-DE", + "nativeName": "Deutsch", + "name": "German", + "completion": 97 }, { "code": "eo-UY", @@ -113,18 +29,102 @@ "name": "Esperanto", "completion": 14 }, + { + "code": "es-ES", + "nativeName": "español", + "name": "Spanish", + "completion": 99 + }, + { + "code": "eu-ES", + "nativeName": "euskara", + "name": "Basque", + "completion": 100 + }, + { + "code": "fa-IR", + "nativeName": "فارسی", + "name": "Persian", + "completion": 68 + }, + { + "code": "fi-FI", + "nativeName": "suomi", + "name": "Finnish", + "completion": 100 + }, + { + "code": "fr-FR", + "nativeName": "français", + "name": "French", + "completion": 97 + }, + { + "code": "gl-ES", + "nativeName": "galego", + "name": "Galician", + "completion": 98 + }, { "code": "he-IL", "nativeName": "עברית", "name": "Hebrew", "completion": 11 }, + { + "code": "it-IT", + "nativeName": "italiano", + "name": "Italian", + "completion": 24 + }, + { + "code": "ja-JP", + "nativeName": "日本語", + "name": "Japanese", + "completion": 31 + }, + { + "code": "kab", + "nativeName": "Taqbaylit", + "name": "Kabyle", + "completion": 100 + }, + { + "code": "ko-KR", + "nativeName": "한국어", + "name": "Korean", + "completion": 84 + }, + { + "code": "lt-LT", + "nativeName": "lietuvių", + "name": "Lithuanian", + "completion": 42 + }, + { + "code": "nl-NL", + "nativeName": "Nederlands", + "name": "Dutch", + "completion": 48 + }, + { + "code": "ru-RU", + "nativeName": "русский", + "name": "Russian", + "completion": 99 + }, { "code": "th-TH", "nativeName": "ไทย", "name": "Thai", "completion": 3 }, + { + "code": "zh-CN", + "nativeName": "简体中文", + "name": "Simplified Chinese", + "completion": 100 + }, { "code": "zh-TW", "nativeName": "繁體中文",