Translations management events¶
The Translations management package dispatches events when it translates content, creates side-by-side translation drafts, records translation attempts and review decisions, and runs bulk translation jobs.
<>Update the intro: there are now also bulk translation job events.</>
Translation events¶
Translation events are dispatched for every field in each selected target language. Use them for logging, analytics, and observability. Both events are read-only, you can't use them to override the translation result.
| Event | Dispatched by | Dispatched when |
|---|---|---|
BeforeTranslateEvent |
EventDispatchingProviderTranslator |
Before a translation request is sent to the provider |
TranslateEvent |
EventDispatchingProviderTranslator |
After a translation response is received |
Side-by-side creation events¶
Side-by-side creation events are dispatched when preparing a new translation draft.
| Event | Dispatched by | Dispatched when |
|---|---|---|
OnContentSideBySideTranslationCreateEvent |
ContentTranslationCreateController |
When creating a draft side-by-side translation of a content item |
OnProductSideBySideTranslationCreateEvent |
ProductTranslationViewController |
When creating a draft side-by-side translation of a product |
Translation attempt events¶
Translation attempt events are dispatched once for each content item and target language that a translation provider is asked to translate: in the back office, in bulk translation jobs, and with the console command.
They implement TranslationAttemptEventInterface, which gives access to the content ID, the provider identifier, and the source and target language codes.
If a listener throws an exception, the exception is logged and doesn't stop the translation.
| Event | Dispatched when |
|---|---|
TranslationAttemptSucceededEvent |
After the provider translated the content item, also when the translated draft is discarded later |
TranslationAttemptFailedEvent |
When the request to the provider failed |
TranslationDraftCreationFailedEvent |
When the provider translated the content item, but the translated draft or its review status couldn't be created |
Review events¶
| Event | Dispatched when |
|---|---|
AutoTranslationReviewStatusUpdatedEvent |
After the review status of one or more machine translations changed, for example when a reviewer approved or rejected them, or when the translation was published |
A batch update, such as approving many translations at once, dispatches the event once, with the IDs of all the updated auto-translation records.
The event's context identifies the content item or product when the update concerned a single one, and is null otherwise.
Bulk translation events¶
Bulk translation events are dispatched by the worker that processes bulk translation jobs. They're informative: you can't use them to change the job.
| Event | Dispatched when |
|---|---|
BulkTranslationJobStartedEvent |
When the worker starts processing a pending job |
BulkTranslationJobFinishedEvent |
When a job ends with the "For review", "Completed", or "Failed" status, also after a retry |
BulkTranslationJobRemovedEvent |
When the removal of a job that a user requested ends |
BulkTranslationJobStartedEvent isn't dispatched again when a job resumes after the worker stopped, so listeners might miss the start of a job.
BulkTranslationJobFinishedEvent carries the final status and the number of failed items.
BulkTranslationJobRemovedEvent carries the number of remaining items: if some drafts couldn't be removed, the job stays listed with these items.