This commit is contained in:
Milan Nikolic
2026-06-25 21:52:23 +02:00
parent 4e2f78026d
commit 18e9adabaa
20 changed files with 1653 additions and 113 deletions
+26
View File
@@ -0,0 +1,26 @@
//go:build !windows
package i18n
import (
"os"
"strings"
)
// systemLangCode returns the two-letter language code from the POSIX locale environment, or "".
func systemLangCode() string {
for _, env := range []string{"LC_ALL", "LC_MESSAGES", "LANG"} {
v := os.Getenv(env)
if v == "" || v == "C" || v == "POSIX" {
continue
}
if i := strings.IndexAny(v, "_.@"); i >= 0 {
v = v[:i]
}
return strings.ToLower(v)
}
return ""
}