From 3135a3cd76496c69b4e4eaf5f785914e340bb7b8 Mon Sep 17 00:00:00 2001 From: Sylvia Crowe Date: Wed, 13 Mar 2024 17:59:43 -0700 Subject: [PATCH] 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. --- 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 9ba37599..795f0283 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