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 5
5
package translation
6
6
7
7
import (
8
+ "sort"
9
+ "strings"
10
+
8
11
"code.gitea.io/gitea/modules/log"
9
12
"code.gitea.io/gitea/modules/options"
10
13
"code.gitea.io/gitea/modules/setting"
31
34
supportedTags []language.Tag
32
35
)
33
36
34
- // AllLangs returns all supported langauages
37
+ // AllLangs returns all supported languages sorted by name
35
38
func AllLangs () []LangType {
36
39
return allLangs
37
40
}
@@ -72,6 +75,11 @@ func InitLocales() {
72
75
for i , v := range langs {
73
76
allLangs = append (allLangs , LangType {v , names [i ]})
74
77
}
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
+ })
75
83
}
76
84
77
85
// Match matches accept languages
You can’t perform that action at this time.
0 commit comments