Skip to content

Auto sync and machine translation#887

Draft
th3hamm0r wants to merge 2 commits intowagtail:mainfrom
th3hamm0r:feature/789-auto-sync-and-machine-translation
Draft

Auto sync and machine translation#887
th3hamm0r wants to merge 2 commits intowagtail:mainfrom
th3hamm0r:feature/789-auto-sync-and-machine-translation

Conversation

@th3hamm0r
Copy link
Copy Markdown
Contributor

@th3hamm0r th3hamm0r commented Oct 21, 2025

This only partially implements the proposed changes of #789 (comment) and should be seen as an early draft now open for discussion.

TBD:

  • Publication + automatic machine translation: the attribute on the request looks a bit ugly, but it was the easiest and in my view the lightest approach (in contrast to sub-classing the EditView for Page).
  • I've left out snippets for now, but I could mostly mirror the page logic, but listen for the wagtail.signals.published signal instead of the after_publish_page hook (actually this signal could be used for pages too 🤔 )
  • I've skipped bulk sync for now, as it requires quite a lot of extra code and UI
  • The go_live_at date isn't synced at the moment (which is understandable, as there are other use cases too), so I had to skip the publish+machine-translation for future dates. I've ignored this in the auto-sync on publish action, as it looked sensible to me to get the new content into the translations when a publication is planned.

Todo:

  • Tests
  • Docs

Relates to #789

publish_translations=form.cleaned_data["publish_translations"],
)

self.components.save(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With publish+auto-machine-translate we cannot really handle those components, I think. With bulk actions we may add those components to the confirmation view. That's why I have not extracted them into update_translations().

I also don't fully understand them. Are those components meant to be created once per translation request or once per translation source? I know, it's up to the dev, but it would be nice to get some infos on how this has been used so far.

This can be enabled by setting
WAGTAILLOCALIZE_UPDATE_TRANSLATIONS_ON_PUBLISH = True

Relates to wagtail#789
@th3hamm0r th3hamm0r force-pushed the feature/789-auto-sync-and-machine-translation branch from 26da10a to 66eb251 Compare January 8, 2026 07:13
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.39%. Comparing base (ceaf5ee) to head (66eb251).

Files with missing lines Patch % Lines
wagtail_localize/wagtail_hooks.py 36.53% 26 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #887      +/-   ##
==========================================
- Coverage   93.07%   92.39%   -0.69%     
==========================================
  Files          47       47              
  Lines        4243     4297      +54     
  Branches      551      564      +13     
==========================================
+ Hits         3949     3970      +21     
- Misses        175      201      +26     
- Partials      119      126       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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