fix: split the apple locale on the region for LANG (#447)

We use AppleLocale to get the desired language when running on macos.
Unfortunately, if a region is set, the locale is not equivalent to the
LANG environment variable. It appends an extra region field that we did
not previously filter out. This change ensures that it will be filtered
out when present.
This commit is contained in:
Sylvie Crowe 2024-03-13 18:52:02 -07:00 committed by GitHub
parent 9eb7461964
commit 550d9c9716
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -393,7 +393,9 @@ func determineLang() string {
log.Printf("error executing 'defaults read -g AppleLocale': %v\n", err) log.Printf("error executing 'defaults read -g AppleLocale': %v\n", err)
return "" return ""
} }
return strings.TrimSpace(string(out)) + ".UTF-8" strOut := string(out)
truncOut := strings.Split(strOut, "@")[0]
return strings.TrimSpace(truncOut) + ".UTF-8"
} else { } else {
// this is specifically to get the wavesrv LANG so waveshell // this is specifically to get the wavesrv LANG so waveshell
// on a remote uses the same LANG // on a remote uses the same LANG