From 3bb93ce60bc00b9bb0e13ae9f540fdfd0dfa0f60 Mon Sep 17 00:00:00 2001 From: Floran Pagliai Date: Mon, 22 Jul 2024 11:36:10 +0200 Subject: [PATCH] Feature/Google language codes (#59) --- data/languages.json | 56 +++++++++++++++++++++++++++++++++++++++++ tests/languages.test.js | 6 +++++ 2 files changed, 62 insertions(+) diff --git a/data/languages.json b/data/languages.json index f82c624..aba40da 100644 --- a/data/languages.json +++ b/data/languages.json @@ -1023,6 +1023,62 @@ "rtl": "false", "country_flag_code": "ph", "variant": "false" + }, + { + "code": "ay", + "english_name": "Aymara", + "local_name": "Aymara", + "rtl": "false", + "country_flag_code": "bo", + "variant": "false" + }, + { + "code": "dv", + "english_name": "Dhivehi", + "local_name": "ދިވެހި", + "rtl": "true", + "country_flag_code": "mv", + "variant": "false" + }, + { + "code": "ee", + "english_name": "Ewe", + "local_name": "Eʋegbe", + "rtl": "false", + "country_flag_code": "gh", + "variant": "false" + }, + { + "code": "gn", + "english_name": "Guarani", + "local_name": "Avañe'ẽ", + "rtl": "false", + "country_flag_code": "py", + "variant": "false" + }, + { + "code": "ln", + "english_name": "Lingala", + "local_name": "Lingála", + "rtl": "false", + "country_flag_code": "cd", + "variant": "false" + }, + { + "code": "qu", + "english_name": "Quechua", + "local_name": "Runa Simi", + "rtl": "false", + "country_flag_code": "pe", + "variant": "false" + }, + { + "code": "ts", + "english_name": "Tsonga", + "local_name": "Xitsonga", + "rtl": "false", + "country_flag_code": "za", + "variant": "false" } ] } diff --git a/tests/languages.test.js b/tests/languages.test.js index 50cb187..93622bb 100644 --- a/tests/languages.test.js +++ b/tests/languages.test.js @@ -15,10 +15,16 @@ test('Data structure is valid', () => { }); }); + test('There is no duplicate code', () => { const codes = languages.map((language) => language.code); const uniqueCodes = [...new Set(codes)]; + // Find duplicated language codes + const duplicatedCodes = codes.filter((code, index) => codes.indexOf(code) !== index); + if (duplicatedCodes.length > 0) { + console.log('Duplicated language code(s):', duplicatedCodes); + } expect(codes.length).toBe(uniqueCodes.length); });