Skip to content

Commit d3343dd

Browse files
committed
Sort locales according to their names
1 parent 832f987 commit d3343dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

modules/translation/translation.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
package translation
66

77
import (
8+
"sort"
9+
810
"code.gitea.io/gitea/modules/log"
911
"code.gitea.io/gitea/modules/options"
1012
"code.gitea.io/gitea/modules/setting"
@@ -72,6 +74,11 @@ func InitLocales() {
7274
for i, v := range langs {
7375
allLangs = append(allLangs, LangType{v, names[i]})
7476
}
77+
78+
// Sort languages according to their name - needed for the user settings
79+
sort.Slice(allLangs, func(i, j int) bool {
80+
return allLangs[i].Name < allLangs[j].Name
81+
})
7582
}
7683

7784
// Match matches accept languages

0 commit comments

Comments
 (0)