fix: split the apple locale on the region for LANG

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:
Sylvia Crowe 2024-03-13 17:59:43 -07:00
parent fc0b82836c
commit 3135a3cd76

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