Skip to main content
Version: v11.10

Translation Queue

The translation queue is a Symfony messenger queue which is responsible for processing translation entries.

Configuration

Cronjob

*/5 * * * * php bin/console messenger:consume twocream_deepl_translation --time-limit 300

Structure of the queue message

Class

Twocream\DeepLBundle\MessageQueue\Message\ElementTranslationMessage

Description

NameValue
Constructorpublic function __construct(int $elementId, string $elementType, string $pimcoreSourceLanguage, ?array $pimcoreTargetLanguages = null, ?TranslationContextInterface $translationContext = null, bool $skipExistingTranslation = false, bool $allowInheritedValues = false,bool $doPublishVersion = true)
$elementIdID of the element (object, asset, ...)
$elementTypeType of the element (object, asset, ...)
$pimcoreSourceLanguageThe source language (de, en, ...)
Optional
$pimcoreTargetLanguagesA collection of target languages with the following structure: ['de', 'en', 'fr']
$translationContextThe Translation context contains all information, this differs depending on the element type (metadata fields, relation fields, glossaries, ....).
$skipExistingTranslationDecides whether or not to overwrite existing field contents.
$allowInheritedValuesDecides whether or not to account for the fallbacks of languages (e.g. in a localized field) as well as for the element inheritence. If so, they are stored locally on the element.
$doPublishVersionDecides whether the first translated version is published or only saved as a version.

Usage

Creation of new translation entries

A translation entry is required to translate an element (e.g. an object). Such entries can be created flexibly, including several optional parameters.

info

Below is an example of parameter assignment, it is however only for illustration purposes and not strictly required.

<?php

$glossaries = [
'de' => [
'en' => 'GLOSSAR_ID'
]
];

$objectTranslationContext = new ObjectTranslationContextDto(glossaries: $glossaries);

$elementTranslationMessage = new ElementTranslationMessage(
$element->getId(),
$element->getType(),
'de',
pimcoreTargetLanguages: ['en'],
translationContext: $objectTranslationContext,
skipExistingTranslation: true,
allowInheritedValues: true,
doPublishVersion: true
);