Sort the language list (correctly)
This commit is contained in:
parent
64928213bf
commit
51bbda75ee
1 changed files with 12 additions and 5 deletions
|
@ -41,13 +41,20 @@ function SettingLanguage(props: Props) {
|
||||||
'Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.'
|
'Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{Object.values(languages)
|
{Object.entries(languages)
|
||||||
.sort()
|
.sort((a, b) => {
|
||||||
|
const lhs = String(a[1]);
|
||||||
|
const rhs = String(b[1]);
|
||||||
|
if (lhs < rhs) return -1;
|
||||||
|
if (lhs > rhs) return 1;
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
.map((language) => {
|
.map((language) => {
|
||||||
const lang = String(language);
|
const langKey = language[0];
|
||||||
|
const langName = String(language[1]);
|
||||||
return (
|
return (
|
||||||
<option key={lang} value={lang}>
|
<option key={langKey} value={langKey}>
|
||||||
{lang}
|
{langName}
|
||||||
</option>
|
</option>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
Loading…
Reference in a new issue