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

[core] Add script to sync translation files #3201

Merged
merged 6 commits into from
Nov 23, 2021

Conversation

m4theushw
Copy link
Member

@m4theushw m4theushw commented Nov 16, 2021

Currently, we have 22 translation files. It's becoming a pain to keep all of them in sync when a new key is added. I felt that in #2946 when I had to copy the English translation to the other locales. The purpose of this script is to use the English locale as the source of truth, then it goes over all the other files checking, for each key, if a translation was provided or not. If there's a translation it doesn't touch it, but if the translation is missing it automatically copies from the English file and marks it as a comment. The script also keeps the lines in the same order as the source of truth. To add a new key, you only need to first add it to the English locale, then run yarn l10n to propagate it to other files.

Besides the synchronization, the script is also capable of generating a report (by running yarn l10n --report) of the missing translations. Its content is used to update #3211. My idea is automatically update this issue in a GitHub Workflow whenever a new commit is made, similar to #2081.

@m4theushw m4theushw added the core Infrastructure work going on behind the scenes label Nov 17, 2021
@m4theushw m4theushw self-assigned this Nov 17, 2021
@m4theushw m4theushw marked this pull request as ready for review November 17, 2021 19:08
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 21, 2021
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 23, 2021
@m4theushw m4theushw merged commit d826fc7 into mui:master Nov 23, 2021
@m4theushw m4theushw deleted the sync-translations branch November 23, 2021 17:01
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 23, 2021

@m4theushw Cooool, for further automation, we could maybe make the script part of the CI. This would guarantee we never forget about it, nor we have regressions on it.

@mui-org/x speaking of CI tools and how we can make our work as maintainers easier. Would it make sense to dedicate some of the weekly meetings to maintain a backlog of tech tasks? Effectively, we could collaborate on the next opportunities. I will propose this topic in the next retrospective, maybe it will resonate with the team, if not, an idea to hurry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants