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

Adds a rake task to detect missing translations #3401

Closed

Conversation

cypher
Copy link
Contributor

@cypher cypher commented Nov 9, 2024

Description

This adds a Rake task that compares the English translation keys for Avo with the Avo translations in the other locales, and reports any missing translations. If any are found, it exits with error code 1. It ignores any locales that don't have translations in the avo scope.

Run it with bundle exec rake avo:i18n:missing_translations

This could e.g. be run as part of a pre-release workflow to ensure that all locales have the required translation keys. This would prevent issues like #3400.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Screenshots & recording

Part of the output of this task if run against the current main branch:
Screenshot 2024-11-09 at 13 45 52

Note that this shows the key from #3400 as missing in the de locale, amongst others.

Manual review steps

  1. Run the rake task.
  2. Add one of the missing translations.
  3. Re-run the rake task, and see if the key is still reported as missing.

Copy link

codeclimate bot commented Nov 9, 2024

Code Climate has analyzed commit 95b40a0 and detected 0 issues on this pull request.

View more on Code Climate.

@cypher cypher force-pushed the i18n-task-to-detect-missing-translations branch from 760f6d9 to 95b40a0 Compare November 9, 2024 12:56
@Paul-Bob
Copy link
Contributor

Thank you for your contribution, @cypher!

We already have an i18n test at spec/system/i18n_spec.rb. The underlying issue was an outdated list of locales in config/i18n-tasks.yml. I've updated this list in PR #3402, so all locales should now be verified correctly.

Thanks once again, but I'll be closing this PR due to the reasons outlined above.

@Paul-Bob Paul-Bob closed this Nov 11, 2024
@cypher
Copy link
Contributor Author

cypher commented Nov 11, 2024

@Paul-Bob no worries, as long as it's fixed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants