Skip to content

Commit

Permalink
Merge pull request #11721 from sharifelgamal/windows-locale
Browse files Browse the repository at this point in the history
let windows users use the LC_ALL env var to set locale
  • Loading branch information
sharifelgamal authored Jun 21, 2021
2 parents c020ce1 + 867ad61 commit 49f9bc8
Showing 1 changed file with 14 additions and 4 deletions.
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

0 comments on commit 49f9bc8

Please sign in to comment.