feat: weblate

This commit is contained in:
2025-08-04 16:02:45 +02:00
parent 855a4c37c4
commit 8cfda5229f
24 changed files with 3936 additions and 5 deletions

34
pkg/lang/lang.go Normal file
View File

@ -0,0 +1,34 @@
package lang
import (
"os"
"strings"
"github.com/leonelquinteros/gotext"
)
func GetLocale() string {
if loc := os.Getenv("LC_MESSAGES"); loc != "" {
return NormalizeLocale(loc)
}
if loc := os.Getenv("LANG"); loc != "" {
return NormalizeLocale(loc)
}
return "C.UTF-8"
}
func NormalizeLocale(loc string) string {
if idx := strings.Index(loc, "."); idx != -1 {
return loc[:idx]
}
if idx := strings.Index(loc, "@"); idx != -1 {
return loc[:idx]
}
return loc
}
var T = gotext.Get