(Feat): Initial Commit
Some checks failed
Build & Test / build-test (push) Has been cancelled
Build & Test / swagger-codegen-cli (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled

This commit is contained in:
2026-07-03 19:41:31 +05:30
commit 7e940c83a7
461 changed files with 45002 additions and 0 deletions

23
internal/util/lang.go Normal file
View File

@@ -0,0 +1,23 @@
// nolint:revive
package util
import (
"sort"
"golang.org/x/text/collate"
"golang.org/x/text/language"
)
// SortCollateStringSlice is used to sort a slice of strings if the language specific order of caracters is
// important for the order of the string.
// ! The slice passed will be changed.
func SortCollateStringSlice(slice []string, lang language.Tag, options ...collate.Option) {
if len(options) == 0 {
options = []collate.Option{collate.IgnoreCase, collate.IgnoreWidth}
}
coll := collate.New(lang, options...)
sort.Slice(slice, func(i int, j int) bool {
return coll.CompareString(slice[i], slice[j]) < 0
})
}