Should use localeCompare

This commit is contained in:
Lim Chee Aun 2024-08-18 12:46:45 +08:00
parent 0f41d46c52
commit 480e1aa733

View file

@ -44,8 +44,8 @@ export default function LangSelector() {
if (a.code === 'pseudo-LOCALE') return 1;
if (b.code === 'pseudo-LOCALE') return -1;
// Sort by common name
if (a._common < b._common) return -1;
if (a._common > b._common) return 1;
const order = a._common.localeCompare(b._common, i18n.locale);
if (order !== 0) return order;
// Sort by code (fallback)
if (a.code < b.code) return -1;
if (a.code > b.code) return 1;