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

cleanup translations and fix update-translations.sh #102072

Merged
merged 3 commits into from
Jul 6, 2021

Conversation

atiratree
Copy link
Member

What type of PR is this?

/kind cleanup
/sig cli

What this PR does / why we need it:

  • the script hack/update-translations.sh stopped working
  • translations include old currently unused msgids and do not include new msgids

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

  • I added a new option to the update-translations.sh script to fix old/new msgids. I am not sure if we should include this logic with already present -g option or have it as a new standalone option -k.
  • I am deprecating old msgids but keeping them in the file as obsolete (#~). It is like that, because it is nice to run this script automatically, but to keep the old unused translations in the file. So the translators can easily copy changed translation when for example only one letter changed. The obsoleted translations need to be removed manually, which is easy since they are at the end of the file.
  • I am not sure if I should split this PR into multiple ones? The first commit is fixing/adding new logic to update-translations.sh and the rest are various generated changes

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 17, 2021
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label May 17, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @atiratree!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @atiratree. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/kubectl labels May 17, 2021
@atiratree
Copy link
Member Author

/check-cla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 17, 2021
@atiratree
Copy link
Member Author

/assign @soltysh

Copy link
Member

@dougsland dougsland left a comment

Choose a reason for hiding this comment

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

@atiratree could you please squash your patches so would be easier to review it?

@atiratree
Copy link
Member Author

@dougsland I have squashed all the generated changes to one commit, but kept the features commits for better clarity

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 1, 2021
@pacoxu pacoxu added this to Backlog in SIG CLI Jul 5, 2021
- update template.pot
- reformat .po files
- regenerate .mo files
- regenarate and mark obsolete translations
- remove obsolete default/english translations
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 5, 2021
@atiratree
Copy link
Member Author

rebased

@soltysh
Copy link
Contributor

soltysh commented Jul 6, 2021

/ok-to-test
/triage accepted

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 6, 2021
@soltysh
Copy link
Contributor

soltysh commented Jul 6, 2021

/priority backlog

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 6, 2021
Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atiratree, soltysh

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:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 6, 2021
@k8s-ci-robot k8s-ci-robot merged commit 1726371 into kubernetes:master Jul 6, 2021
SIG CLI automation moved this from Backlog to Done Jul 6, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Jul 6, 2021
@hwdef
Copy link
Member

hwdef commented Aug 18, 2023

I'm a bit confused about this pr, if an English language is not translated and it needs to be translated, it won't be added to the corresponding language's po file after running this script with -k.

The result now is that the en_US file has 6,000+ lines but the other languages have only a few lines. For example, zh_CN has only 3000+ lines and ko_KR has less than a hundred lines.

@atiratree
Can you help me with something?

@atiratree
Copy link
Member Author

atiratree commented Aug 22, 2023

@hwdef We are only storing the translated parts. The rest will be defaulted to english. If you want to add new translations. you need to first generate the template.pot file, then you can open the k8s.po file for each language in poedit where you can import the empty lines from the template.pot. Then you can manually translate and edit in poedit. You may find some of the commented out translations good for reuse if only for an example a punctuation changed in the source text

Nevertheless, the translations and the script are not really well maintained. So, if you want to help with this effort , I suggest to visit sig-cli call and ask there first.

Useful resource is also the gettext documentation: https://www.gnu.org/software/gettext/manual/gettext.html#Template

@hwdef
Copy link
Member

hwdef commented Aug 23, 2023

Thank you! I wil try what you said.

@hwdef
Copy link
Member

hwdef commented Aug 23, 2023

 then you can open the k8s.po file for each language in poedit where you can import the empty lines from the template.pot

Do you mean this?

截屏2023-08-23 10 37 15

@atiratree
Copy link
Member Author

yes, although for some finer tuning, you may need to consult the gettext CLI tools/documentation or do it manually

@hwdef
Copy link
Member

hwdef commented Aug 23, 2023

Thank you very much!

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. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants