Open someusersomeuser opened 3 years ago
TranslationCollection.sort() method sort all items by kombined key like "section.subsection.item1" this works fine for sections where name without symbols
for sections with symbols, order incorrect. you need set custom default comparer in sort method like
comparer = (key1, key2) => {
const split1 = key1.split(delimiter);
const split2 = key2.split(delimiter);
let cmp = 0;
let i = 0;
while ((i< split1.length || i < split2.length) && cmp == 0){
cmp = (split1[i] || '').localeCompare(split2[i] || '');
i++;
}
return cmp;
}
sort order incorrect for sections contains "-" (maybe not only) { "section-1": {"item": "value"}, "section": {"item": "value"}, "sectionTwo": {"item": "value"}, }
need: "section" "section-1" "sectionTwo"