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 LocalizationsValidator using validation in Localized mixin #542

Conversation

danielpgross
Copy link
Collaborator

@danielpgross danielpgross commented Jan 28, 2025

TL;DR

Migrated LocalizationsValidator module from old tool version, reimplementing most of it for much better performance.

On my machine, the new implementation takes ~150ms compared to ~22s for the old version. The speedup is thanks to using the already loaded localizations rather than loading them all again.

What changed?

  • Added a validation method to the Localized mixin
  • Added a new LocalizationsValidator module to validate translations across categories, attributes, and values
  • Integrated validation into the generate_dist command

The old implementation checked for 2 cases:

  • Localization key missing
  • Localization key present, but name key missing for it

These are effectively the same check, since the name key being present requires the localization key itself to be present. In the new implementation, they are combined into a single check.

Copy link
Collaborator Author

danielpgross commented Jan 28, 2025

@danielpgross danielpgross changed the title Add validation to Localized and LocalizationsValidator Add LocalizationsValidator using validation in Localized mixin Jan 28, 2025
@danielpgross danielpgross marked this pull request as ready for review January 28, 2025 21:43
@danielpgross danielpgross force-pushed the 01-28-add_validation_to_localized_and_localizationsvalidator_ branch from f2176c1 to db61e20 Compare January 29, 2025 15:24
@danielpgross danielpgross merged commit 16cf66d into main Jan 29, 2025
6 checks passed
Copy link
Collaborator Author

Merge activity

  • Jan 29, 5:47 PM EST: A user merged this pull request with Graphite.

@danielpgross danielpgross deleted the 01-28-add_validation_to_localized_and_localizationsvalidator_ branch January 29, 2025 22:47
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