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.
- 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: yes
- 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>
<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 which are selected by the user and passed via the input event data.
- If the object is an illustration, get the resolutions which can be translated.
- Get the initial status that is set in the translation management configuration (Admin.XMLTranslationConfiguration.xml) or the default value "To be translated" is used.
- 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 of the source language object 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".