Skip to content

Commit

Permalink
Feature/Google language codes (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
floranpagliai authored Jul 22, 2024
1 parent cefa5f1 commit 3bb93ce
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
56 changes: 56 additions & 0 deletions data/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
6 changes: 6 additions & 0 deletions tests/languages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit 3bb93ce

Please sign in to comment.