Sorting language available automatically

This commit is contained in:
Donald Zou 2025-04-20 02:40:36 +08:00
parent 149a8e910d
commit 51ab8c556a
2 changed files with 6 additions and 6 deletions

View File

@ -2995,7 +2995,7 @@ class Locale:
self.localePath = './static/locale/' self.localePath = './static/locale/'
self.activeLanguages = {} self.activeLanguages = {}
with open(os.path.join(f"{self.localePath}active_languages.json"), "r") as f: with open(os.path.join(f"{self.localePath}active_languages.json"), "r") as f:
self.activeLanguages = json.loads(''.join(f.readlines())) self.activeLanguages = sorted(json.loads(''.join(f.readlines())), key=lambda x : x['lang_name'])
def getLanguage(self) -> dict | None: def getLanguage(self) -> dict | None:
currentLanguage = DashboardConfig.GetConfig("Server", "dashboard_language")[1] currentLanguage = DashboardConfig.GetConfig("Server", "dashboard_language")[1]

View File

@ -1,9 +1,4 @@
[ [
{
"lang_id": "ar-sa",
"lang_name": "Arabic",
"lang_name_localized": "العربية"
},
{ {
"lang_id": "zh-cn", "lang_id": "zh-cn",
"lang_name": "Chinese (Simplified)", "lang_name": "Chinese (Simplified)",
@ -24,6 +19,11 @@
"lang_name": "Dutch", "lang_name": "Dutch",
"lang_name_localized": "Nederlands" "lang_name_localized": "Nederlands"
}, },
{
"lang_id": "ar-sa",
"lang_name": "Arabic",
"lang_name_localized": "العربية"
},
{ {
"lang_id": "en", "lang_id": "en",
"lang_name": "English", "lang_name": "English",