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

Add automatic locale detection #4199

Merged
merged 5 commits into from
May 3, 2019
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@
[[constraint]]
name = "golang.org/x/text"
revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475"

[[constraint]]
name = "github.com/cloudfoundry-attic/jibber_jabber"
branch = "master"
1 change: 1 addition & 0 deletions cmd/minikube/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ func main() {
}
console.SetOutFile(os.Stdout)
console.SetErrFile(os.Stderr)
console.DetermineLocale()
cmd.Execute()
}
10 changes: 10 additions & 0 deletions pkg/minikube/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"strconv"
"strings"

"github.com/cloudfoundry-attic/jibber_jabber"
"github.com/golang/glog"
isatty "github.com/mattn/go-isatty"
"golang.org/x/text/language"
Expand Down Expand Up @@ -198,6 +199,15 @@ func SetErrFile(w fdWriter) {
useColor = wantsColor(w.Fd())
}

func DetermineLocale() {
locale, err := jibber_jabber.DetectIETF()
if err != nil {
glog.Warningf("Getting system locale failed: %s", err)
locale = ""
}
SetPreferredLanguage(locale)
}

// wantsColor determines if the user might want colorized output.
func wantsColor(fd uintptr) bool {
// First process the environment: we allow users to force colors on or off.
Expand Down
201 changes: 201 additions & 0 deletions vendor/github.com/cloudfoundry-attic/jibber_jabber/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading