Skip to content

Commit

Permalink
Fix documentation and sort case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
delvh committed Jan 8, 2022
1 parent d3343dd commit 905fdb7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/translation/translation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package translation

import (
"sort"
"strings"

"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/options"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
})
}

Expand Down

0 comments on commit 905fdb7

Please sign in to comment.