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 all commits
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
18 changes: 14 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,18 @@ 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" {
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