Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let windows users use the LC_ALL env var to set locale #11721

Merged
merged 2 commits into from
Jun 21, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions pkg/minikube/translate/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package translate
import (
"encoding/json"
"fmt"
"os"
"runtime"
"strings"

"github.com/cloudfoundry-attic/jibber_jabber"
Expand Down Expand Up @@ -60,10 +62,20 @@ func T(s string) string {

// DetermineLocale finds the system locale and sets the preferred language for output appropriately.
func DetermineLocale() {
locale, err := jibber_jabber.DetectIETF()
if err != nil {
klog.V(1).Infof("Getting system locale failed: %v", err)
locale = ""
var locale string
// Allow windows users to overload the same env vars as unix users
if runtime.GOOS == "windows" {
if os.Getenv("LC_ALL") != "" {
spowelljr marked this conversation as resolved.
Show resolved Hide resolved
locale = os.Getenv("LC_ALL")
}
}
if locale == "" {
var err error
locale, err = jibber_jabber.DetectIETF()
if err != nil {
klog.V(1).Infof("Getting system locale failed: %v", err)
locale = ""
}
}
SetPreferredLanguage(locale)

Expand Down