From 51bbda75ee4172972e5b1e532d9935d0e55aee5a Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Mon, 5 Apr 2021 21:52:20 +0800 Subject: [PATCH] Sort the language list (correctly) --- ui/component/settingLanguage/view.jsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ui/component/settingLanguage/view.jsx b/ui/component/settingLanguage/view.jsx index b6aaddeba..d8d530fa2 100644 --- a/ui/component/settingLanguage/view.jsx +++ b/ui/component/settingLanguage/view.jsx @@ -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.' )} > - {Object.values(languages) - .sort() + {Object.entries(languages) + .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) => { - const lang = String(language); + const langKey = language[0]; + const langName = String(language[1]); return ( - ); })}