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 ability to localize all strings output to console #4464

Merged
merged 32 commits into from
Jun 21, 2019

Conversation

sharifelgamal
Copy link
Collaborator

@sharifelgamal sharifelgamal commented Jun 10, 2019

  • Adds code to translate strings based on system locale
  • Adds string extraction code, in order to keep translations up to date
  • Refactoring of some console code

@sharifelgamal sharifelgamal added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 10, 2019
@sharifelgamal sharifelgamal requested a review from tstromberg June 10, 2019 19:08
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 10, 2019
@k8s-ci-robot k8s-ci-robot requested a review from RA489 June 10, 2019 19:09
Copy link
Contributor

@tstromberg tstromberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks surprisingly complete and very close to mergeable. Thank you for your hard work!

pkg/minikube/translate/translations/fr-FR.json Outdated Show resolved Hide resolved
hack/extract.go Outdated Show resolved Hide resolved
hack/extract.go Outdated Show resolved Hide resolved
hack/extract.go Outdated Show resolved Hide resolved
hack/extract.go Outdated Show resolved Hide resolved
pkg/minikube/translate/translate.go Outdated Show resolved Hide resolved
"unable to set logtostderr": " ",
"unsupported driver: %s": " ",
"using image repository %s": " "
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a newline?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json.Marshal spits the string out like this, not entirely sure how I'd want to add a newline there.

pkg/minikube/translate/translations/fr-FR.json Outdated Show resolved Hide resolved
hack/extract.go Outdated Show resolved Hide resolved
"Sorry that minikube crashed. If this was unexpected, we would love to hear from you:": " ",
"Sorry, the --gpu feature is currently only supported with --vm-driver=kvm2": " ",
"Sorry, the --hidden feature is currently only supported with --vm-driver=kvm2": " ",
"Stopping %q in %s ...": " ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now see why you were worried about context. I wonder if it's possible for us to provide a way so that callers can give translators more of a hint, such as:

Stopping %(name of service)s... in %(name of host)q ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary and will be added in a future PR.

hack/extract.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 11, 2019
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 11, 2019
pkg/minikube/extract/extract.go Outdated Show resolved Hide resolved
@tstromberg
Copy link
Contributor

/approved

@tstromberg
Copy link
Contributor

/lgtm

Just be sure to give the PR description a title that works well in the release notes.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 19, 2019
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 20, 2019
@sharifelgamal sharifelgamal changed the title WIP: Localization Add ability to localize all strings output to console Jun 20, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 20, 2019
@sharifelgamal
Copy link
Collaborator Author

This should now be ready for final review and merge.

PrintToScreenNoInterface("http://kubernetes.io")

// Test with something that Go thinks looks like a URL
PrintToScreenNoInterface("Hint: This is not a URL, come on.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha love this

cmd/extract/extract.go Show resolved Hide resolved
@tstromberg
Copy link
Contributor

/lgtm /approve /ship-it!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sharifelgamal, tstromberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [sharifelgamal,tstromberg]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sharifelgamal sharifelgamal merged commit 37f09da into kubernetes:master Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants