From 905fdb7967dade08a040b68e4a4e88ee1ed099a1 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 8 Jan 2022 12:03:54 +0100 Subject: [PATCH] Fix documentation and sort case insensitive --- modules/translation/translation.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/translation/translation.go b/modules/translation/translation.go index 9db731fecbe84..2dce6e16b9528 100644 --- a/modules/translation/translation.go +++ b/modules/translation/translation.go @@ -6,6 +6,7 @@ package translation import ( "sort" + "strings" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/options" @@ -33,7 +34,7 @@ var ( supportedTags []language.Tag ) -// AllLangs returns all supported langauages +// AllLangs returns all supported languages sorted by name func AllLangs() []LangType { return allLangs } @@ -75,9 +76,9 @@ func InitLocales() { allLangs = append(allLangs, LangType{v, names[i]}) } - // Sort languages according to their name - needed for the user settings + // Sort languages case insensitive according to their name - needed for the user settings sort.Slice(allLangs, func(i, j int) bool { - return allLangs[i].Name < allLangs[j].Name + return strings.ToLower(allLangs[i].Name) < strings.ToLower(allLangs[j].Name) }) }