Skip to content

Update translations automatically when an origin entry is saved (T11.1) - #1

Merged
afonic merged 2 commits into
mainfrom
auto-update-on-save
Oct 10, 2026
Merged

afonic merged 2 commits into
mainfrom
auto-update-on-save

Conversation

@afonic

@afonic afonic commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Builds T11.1: saving a published entry in its origin can update its translations by itself. Off by default.

Settings (new Automation tab)

  • Update translations automatically (auto_update): each published save of an origin entry starts the same run as the origin's Update translations, into every localization: the fields whose origin changed and the fields not translated yet. Fields edited by hand are never overwritten; a save that changes no text starts nothing.
  • Create missing localizations (auto_update_create): also translates the entry into the collection's sites that have no localization of it yet, as Translate into… does, following the New localizations setting.
  • Collections (auto_update_collections): limits it to some collections; empty means all that are not excluded.
  • Publish updates (auto_update_publish): in collections with revisions, publishes the update instead of leaving it in the working copy (unless the localization already had unpublished changes).

How it runs

  • QueueTranslationUpdates listens to the initial EntrySaved (not the re-saves core does to localizations after their origin) and dispatches UpdateTranslations for a published origin whose collection is covered.
  • With a queue worker, the job waits 10 seconds on the queue (unique until processing, so quick saves make one update) and starts a queue run. Without one, it runs after the save's response and drives the run in that process (cli driver, no PHP time limit). A save while an earlier run of the entry is still moving waits for it, so the same fields are not paid for twice.
  • AutoUpdater builds the run as the user who saved (their site rights apply), estimates it without calling a model, and drops it when nothing is pending. It's a normal run otherwise: Runs page, cost, revisions, one commit, Resume after a stall.
  • This is a run rather than the plan's original job translating each localization with TargetTranslator, which could outlast a queue connection's retry_after and left no trace beyond the log.

Where it shows

  • The origin's banner says when saves update translations. After a save it shows "Updating the translations automatically into Greek…", follows the run and shows its result, or says the translations were updated if they're current before it sees the run.
  • The localization's banner shows "Updated automatically from English on …" (plus "not published yet" while the update waits in a working copy).
  • The runs list and run page mark automatic runs. Their usage counts under Automatic updates on the Overview. tolk:doctor and the Audit page say how automatic updates run.

Docs

configuration.md (Automation), editor.md and bulk-and-runs.md ("Automatic updates"), troubleshooting.md, extending.md, README, CHANGELOG, the Boost guideline, and T11.1 in TASKS.md.

Tests

  • tests/Feature/AutoUpdateTest.php: off by default; only the changed field is updated in each localization; hand edits kept; drafts, other collections, excluded collections and entries without localizations start nothing; the cascade re-save doesn't dispatch a second job; quick saves make one queued job; a provider failure leaves the localization outdated and the save succeeds; missing localizations are created only with the toggle; the saver's site rights apply; one commit per run; waiting for an earlier run.
  • Also SettingsTest, EditorStatusTest, EditorPushTest, AuditTest, plus Vitest for the banner, the after-save follower, the save hook and the run pages.
  • tests/Browser/editor-auto-update.spec.js: in the sandbox, a save updates the Greek translation and the banner shows it; the Greek banner says when; the runs list marks the run; creating missing localizations; nothing happens with the setting off.
  • Pest 3,363 passed, Vitest 622, Playwright 69 passed and 4 skipped (the screenshot specs), Pint clean, resources/dist/build rebuilt.

afonic added 2 commits October 9, 2026 21:36
…its origin, as a run of the entry, off by default (T11.1)

A setting on the new Automation tab turns it on, for every collection or a list; a second one also creates the missing localizations, and a third publishes updates in collections with revisions. With a queue worker the run's lanes go on the queue after 10 seconds; without one, the process that saved the entry drives the run after its response. The origin's banner follows the run after a save, the localization's banner says when an automatic update last saved it, and the runs list, the run page, the Overview's usage and tolk:doctor name automatic updates.
…t is done when it finished before the banner saw its run

The origin's status lists the sites an automatic update covers, so a missing site that the settings do not create no longer keeps the banner waiting. Adds a browser scenario for automatic updates.
@afonic
afonic merged commit 41bfa34 into main Oct 10, 2026
14 checks passed
@afonic
afonic deleted the auto-update-on-save branch October 10, 2026 07:21
afonic added a commit that referenced this pull request Oct 15, 2026
Update translations automatically when an origin entry is saved (T11.1)
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.

1 participant