I need to sort an array of objects by key in Latvian language but when I use Intl.Collator or compareLocale, the output is not correct.
My example:
function letterSort(lang, strings) {
strings.sort(new Intl.Collator(lang).compare);
return strings;
}
console.log(letterSort('lv', ['ā', 'a', 'ābols','anna']));
// expected output: Array ["a", "anna", "ā", "ābols"]
// actual output: Array ["a", "ā", "ābols", "anna"]
Any ideas what can be done? Thank you!