From 550d9c97161a9b1dde1a81536fe306487f89481d Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:52:02 -0700 Subject: [PATCH] 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. --- wavesrv/pkg/scbase/scbase.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wavesrv/pkg/scbase/scbase.go b/wavesrv/pkg/scbase/scbase.go index 9ba375991..795f02833 100644 --- a/wavesrv/pkg/scbase/scbase.go +++ b/wavesrv/pkg/scbase/scbase.go @@ -393,7 +393,9 @@ func determineLang() string { log.Printf("error executing 'defaults read -g AppleLocale': %v\n", err) return "" } - return strings.TrimSpace(string(out)) + ".UTF-8" + strOut := string(out) + truncOut := strings.Split(strOut, "@")[0] + return strings.TrimSpace(truncOut) + ".UTF-8" } else { // this is specifically to get the wavesrv LANG so waveshell // on a remote uses the same LANG