Switch the common/native text

Prevents the lang selector from being jumpy
This commit is contained in:
Lim Chee Aun 2024-08-14 11:48:14 +08:00
parent 868e613089
commit 3048bd1eea

View file

@ -27,12 +27,12 @@ export default function LangSelector() {
</>
);
}
const common = localeCode2Text(lang);
const native = localeCode2Text({ code: lang, locale: lang });
const same = common === native;
const common = localeCode2Text(lang);
const showCommon = !!common && common !== native;
return (
<option value={lang} key={lang}>
{same ? common : `${common} (${native})`}
{showCommon ? `${native} (${common})` : native}
</option>
);
})}