IBackgroundTaskHandler - CreateTranslation
Creates the translations in the target languages starting from the specified source language objects.
Input data
The input data XML specifies...
- How to get to the target languages which will be created.
- The target languages can be selected by the user or can be calculated using the requested and inherited languages or it can be a combination of both.
- The source language objects of one logical object
- data
-
Input data root element.
- Required: yes
- targetlanguages
-
Element containing a comma-space separated list with target languages which are selected by the user
- Required: no
- requestedlanguages
-
Element indicating whether the requested languages of the current object must be merged with the supplied target languages
- Required: yes
- Allowed values: true/false
- inheritedlanguages
-
Element indicating whether the requested (and inherited) languages of the maps or topics referencing the current object must be merged with the supplied target languages
- Required: yes
- Allowed values: true/false
- ishfields
-
A Metadata XML structure to specify extra fields which will be set when creating new target language objects.
- Required: no
- ishobjects
-
Source language object container which should contain minimally one ishobject.
- Required: yes
- ishobject
-
The ishobject element with the following required attributes specifies one source language object:
- ishtype
- The object type (ISHMasterDoc, ISHModule, ISHIllustration, ISHTemplate or ISHLibrary)
- ishref
- String with the logical identifier of the object
- ishlogicalref
- The identifier of the logical level
- ishversionref
- The identifier of the version level
- ishlngref
- The identifier of the language level
Input data example
This example shows typical event input data for this background task:<data>
<targetlanguages>en, fr, de, es, is, it, ja, nl</targetlanguages>
<requestedlanguages>false</requestedlanguages>
<inheritedlanguages>false</inheritedlanguages>
<ishfields>
<ishfield name="FCOMMENTS" level="lng"></ishfield>
<ishfield name="FTRANSLATOR" level="lng">admin</ishfield>
</ishfields>
<ishobjects>
<ishobject ishref="GUID-F907E081-CAF5-4B3F-91F3-8CADDD573C00" ishtype="ISHLibrary" ishlogicalref="6256" ishversionref="6258" ishlngref="7193"/>
<ishobject ishref="GUID-F907E081-CAF5-4B3F-91F3-8CADDD573C00" ishtype="ISHLibrary" ishlogicalref="6256" ishversionref="6258" ishlngref="6262"/>
</ishobjects>
</data>
Background task configuration
There are no configurable parameters.
Default background task configuration example
The following configuration gets and handles a CREATETRANSLATION event from the background task queue:<handler eventType="CREATETRANSLATION">
<scheduler executeSynchronously="false" />
<authorization type="authenticationContext" />
<execution timeout="01:00:00" recoveryGracePeriod="00:10:00" isolationLevel="None" useSingleThreadApartment="false" />
<activator>
<net name="CreateTranslation">
<parameters />
</net>
</activator>
<errorHandler maximumRetries="3">
<actions>
<add errorNumber="*" action="Retry" delay="00:10:00" />
</actions>
</errorHandler>
</handler>
Flow
- The incoming source language objects are validated.
- Assemble the target languages
- The target languages which are selected by the user and passed via the input event data
- If the parameter requestedlanguages is true, add the requested languages of the current object
- If the parameter inheritedlanguages is true, calculate and add the inherited languages of the current object
- The inherited languages are the requested (and inherited) languages of the maps or topics referencing the current object.
- The inherited languages are the requested (and inherited) languages of the maps or topics referencing the current object.
- If the object is an illustration, get the resolutions which can be translated.
- Get the initial status (e.g. To be translated) for the new target language objects using the user role
VUSERROLETRANSLATORSERVICE - If the target language (and resolution) does not already exist, the (preferred) source language object from the supplied source language objects is selected to create the new target language object
- Assemble the metadata for the new target language object
- First of all, the (initial) status and the source language are set
- Then some fields are copied from the source language object
- The fields which must be copied from the source language object are configured in the Translation Management configuration .
- So, first conditionally publish the Translation Management configuration using the following conditions:
- ISHType: The type of the object (
ISHMasterDoc,ISHModule,ISHIllustration,ISHTemplateorISHLibrary) - FMAPID: The unique identifier of the logical level (
LogicalId) - VERSION: The version number of the object (e.g.
2.1.0) - DOC-LANGUAGE: The target language (e.g.
fr) - FSOURCELANGUAGE: The source language (e.g.
en) - FRESOLUTION: The resolution (e.g.
Low) - EDT: The element name of the EDT (e.g.
EDTXML) - ISHUserGroup: The element names of the user groups which has write access to the object (e.g.
VUSERGROUPSYSTEMMANAGEMENT)
- ISHType: The type of the object (
- Then the first (remaining)
ishfieldselement is used, to retrieve and copy the values from the source language object
- Finally, the fields supplied by the input event data are added.
- Get the blob for the new target language object
- For illustrations and other non XML objects, the blob from the source language is used.
- For xml objects (EDTXML), the blob from the source language is used unless a Translation Management extension "targetxmlfilegeneration" is configured in the Extension configuration
<translationmanagement> <targetxmlfilegeneration sourceref="PreTranslation" /> </translationmanagement>If a Translation Management extension "targetxmlfilegeneration" is configured, the context is assembled with
- The blob of the current source language object
- The blob of the previous (released) target language object.
- The blob of the released source language object in the same version as the previous (released) target language object.
The context is passed to the configured handler and the returned result is used as blob for the new target language object.
- Create a new target language object using the CreateTranslation method which is very similar to the DocumentObj25.Create method.
There are some (small) differences between the CreateTranslation method and the standard DocumentObj25.Create method:
- Of course there is no check on other authoring languages BUT there is an extra check to ensure that the source language used to create this translation still exists and is released.
- When creating a new authoring language, the initial status must be an initial status for one of the user roles that the current user has. During the creation of a translation the initial status must be an initial status for the user role
VUSERROLETRANSLATORSERVICE. The user triggering the creation of the translation does not need to have the user roleVUSERROLETRANSLATORSERVICE! - During the creation of a new translation, all configured write plugins are executed. Although out-of-the-box there are a lot less write plugins configured, the only difference with the standard DocumentObj25.Create method is that the ishcondition "CurrentAction" is "CreateTranslation" and not "Create".