File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 55package translation
66
77import (
8+ "sort"
9+ "strings"
10+
811 "code.gitea.io/gitea/modules/log"
912 "code.gitea.io/gitea/modules/options"
1013 "code.gitea.io/gitea/modules/setting"
3134 supportedTags []language.Tag
3235)
3336
34- // AllLangs returns all supported langauages
37+ // AllLangs returns all supported languages sorted by name
3538func AllLangs () []LangType {
3639 return allLangs
3740}
@@ -72,6 +75,11 @@ func InitLocales() {
7275 for i , v := range langs {
7376 allLangs = append (allLangs , LangType {v , names [i ]})
7477 }
78+
79+ // Sort languages case insensitive according to their name - needed for the user settings
80+ sort .Slice (allLangs , func (i , j int ) bool {
81+ return strings .ToLower (allLangs [i ].Name ) < strings .ToLower (allLangs [j ].Name )
82+ })
7583}
7684
7785// Match matches accept languages
You can’t perform that action at this time.
0 commit comments