Skip to content

Commit 905fdb7

Browse files
committed
Fix documentation and sort case insensitive
1 parent d3343dd commit 905fdb7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/translation/translation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package translation
66

77
import (
88
"sort"
9+
"strings"
910

1011
"code.gitea.io/gitea/modules/log"
1112
"code.gitea.io/gitea/modules/options"
@@ -33,7 +34,7 @@ var (
3334
supportedTags []language.Tag
3435
)
3536

36-
// AllLangs returns all supported langauages
37+
// AllLangs returns all supported languages sorted by name
3738
func AllLangs() []LangType {
3839
return allLangs
3940
}
@@ -75,9 +76,9 @@ func InitLocales() {
7576
allLangs = append(allLangs, LangType{v, names[i]})
7677
}
7778

78-
// Sort languages according to their name - needed for the user settings
79+
// Sort languages case insensitive according to their name - needed for the user settings
7980
sort.Slice(allLangs, func(i, j int) bool {
80-
return allLangs[i].Name < allLangs[j].Name
81+
return strings.ToLower(allLangs[i].Name) < strings.ToLower(allLangs[j].Name)
8182
})
8283
}
8384

0 commit comments

Comments
 (0)