mirror of
https://github.com/Jguer/yay.git
synced 2025-12-27 11:06:51 -05:00
Fix locale initialization logic (#2619)
* Fix locale initialization logic * add comment * Update main.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update GitHub Actions workflow for testing * Update GitHub Actions workflow to allow artifact overwrite * Update GitHub Actions workflow to allow artifact overwrite --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
8
main.go
8
main.go
@@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
||||
"github.com/leonelquinteros/gotext"
|
||||
|
||||
@@ -27,7 +28,12 @@ func initGotext() {
|
||||
}
|
||||
|
||||
if lc := os.Getenv("LANGUAGE"); lc != "" {
|
||||
gotext.Configure(localePath, lc, "yay")
|
||||
// Split LANGUAGE by ':' and prioritize the first locale
|
||||
// Should fix in gotext to support this
|
||||
locales := strings.Split(lc, ":")
|
||||
if len(locales) > 0 && locales[0] != "" {
|
||||
gotext.Configure(localePath, locales[0], "yay")
|
||||
}
|
||||
} else if lc := os.Getenv("LC_ALL"); lc != "" {
|
||||
gotext.Configure(localePath, lc, "yay")
|
||||
} else if lc := os.Getenv("LC_MESSAGES"); lc != "" {
|
||||
|
||||
Reference in New Issue
Block a user