Exchange translations with XLIFF (censhare Client)
XLIFF is an XML format for the exchange of data between translation memories. Learn how to use the censhare XLIFF2 interface in a translation workflow. The example refers to an InDesign layout. The workflow can be adapted to other source formats.
Context
censhare uses version 1.2 of the XLIFF standard for the export and import of XLIFF files. The export and import are done in the censhare Client. Import and export are based on the XLIFF2 module in the censhare Admin Client.
Introduction
The XLIFF format is used to exchange content with external translation-service providers. In censhare, you can export XLIFF files from InCopy assets that are placed in an InDesign layout or are on their own. The XLIFF files are then imported into an external translation tool like SDL Trados Studio. After the translation, the external translation service provider exports the results into XLIFF files again. These XLIFF files now contain the source text and the translated target text. You then import these XLIFF files into censhare again. The target texts are then copied into the InCopy assets for the target language.
censhare provides a server action in the censhare Client to export and import XLIFF files. There is also an automatic import and export for XLIFF that is based on hot folders.
What is XLIFF?
An XLIFF file is an XML interchange format to help translate texts of any source format by a translation agency into other languages. For this purpose, a document is converted to XLIFF which is then understood by the translation software. If multiple ICML files are associated with the source document, the placed text is exported into a coherent XLIFF document. The individual ICML files are separated from each other by the XML element "<file>" in the XLIFF document.
The text is divided into so-called. TUs (translation units), where the structure of these units results from the structure of the source document. Normally, the text is segmented into a translation unit that corresponds to a full sentence. The text to be translated in a translation unit is framed by an opening and a closing XML element " <source>". The translated text is marked by the XML element " <target>".
The Example Layout
A sample layout
Asset structure of the sample layout
The depicted sample article consists of an InDesign layout that has three InCopy stories assigned. To export an XLIFF, it is necessary to set the original language of the document in the metadata. As shown in figure "Asset structure of the sample layout", the document originates from English and should be translated into German.
Step 1: Create asset structure duplicate
For this purpose, it is first necessary to run the "duplicate asset structure" server action. In the dialog box of the module "duplicate asset structure" select the target language for the document to be translated. In the above example, "German" is selected as the target language. When creating a structure duplicate asset, the resulting duplicate is assigned to the source asset.
Step 2: XLIFF Export
In the following, the InDesign layout can be exported as XLIFF file and passed on to a translator or agency.
Note that only those texts are exported for translation that has been placed as an ICML file in the InDesign layout. For instance, if a layout includes text boxes that are not linked as InCopy files in censhare, those texts are not exported either. If multiple ICML files are linked to the source InDesign document, the placed texts are exported into one coherent XLIFF document. An export of single ICML files is also possible.
For the XLIFF export select the source asset in the censhare Client and call the "Export XLIFF" server action. This can be a single asset with an ICML text or layout asset where multiple ICML texts are placed, like the example shown here.
Select target or source asset
If the source asset has two or more language variants, you have to define which variants censhare shall take into account for the export. You can also choose the target asset for the export if you do not have access to the source asset. One reason for this could be that the source asset belongs to another domain as the target asset and you are not allowed to access that domain. If you have selected the target asset, you must now select the "The asset selected for export is the target language" option. censhare will then adjust the dialog. Otherwise, you cannot execute the XLIFF export.
Handling intermediate languages
When translating seldom languages, there is not always a translator for a direct translation from the source language to the target language. In this case, a widespread language such as English is chosen as an intermediate step. In this case, the source asset has a language variant for the intermediate language. In turn, the intermediate language asset has one for the target language. Select the source asset if you want to translate the source language into the intermediate language. Select the intermediate language for the XLIFF export if you want to translate the intermediate language into the target language. If you do not have access to the source respective intermediate language asset, select the appropriate target asset instead and set the "The asset selected for export is the target language" option.
If you select an intermediate language, there are two cases: You translate the intermediate language into the target language. The "The asset selected for export is the target language" option is not selected. If you want to translate the source language into the intermediate language, select the option. Tip: The "Selected asset for export contains target language" option was called "Export target language" earlier.
How to handle country codes
In the Export dialog, the source language field is already filled with the country code that is defined in censhare for the language. If there is a mapping defined at the XLIFF Export configuration, censhare will enter the according XLIFF language code.
The language code in the "Source language" field must meet the requirements of the XLIFF-1.2 standard. You will find more details at the RFC 4646, the successor of the RFC 3066. The language code has the format "xx" or "xx-YY". censhare will not accept the input if the entry does not have one of the two formats.
"xx" is the international language code in small letters. If necessary, this code can be extended with a language variant in large letters "YY", for example, "de-CH" for the German language spoken in Switzerland.
If you choose the "Fill target elements with source" option, censhare will copy the content of the source language to the target field (of the XLIFF file) in order to assist the translator.
Tip: If the XLIFF document shall be translated with SDL Trados Studio, then you must not select the "Fill target elements with source" option. Otherwise, you cannot import the translated XLIFF document back into censhare. This is due to a bug in SDL Trados Studio.
With "Verbose export report" detailed information is displayed in a log window when the XLIFF export is complete.
If you have selected a source asset for the XLIFF export, the dialog below the general options lists all the target assets for which an export is possible. The "Selected asset for export contains target language" option is not checked. Every entry contains the ID and the name of the according target asset. If a layout asset has more than one structure duplicate for different languages, for example, censhare creates one entry for each variant in the dialog.
Select target language assets
You have to mark a target asset if you want to export it. If only one target asset exists, censhare will choose this one for translation automatically. For each target asset, you have to enter the target language and choose the appropriate "Asset structure setting ID".
The "Asset structure setting ID" tells censhare how to find the ICML assets with the texts to export. The source layout asset is the starting point for this search. Each setting ID has assigned an according set of rules. Choose the same setting ID that has been used to create the structure variant for the target language. If the source is an ICML asset, this setting is not taken into account. The target language must be a XLIFF language code, too, and uses the same format as the source language.
If you have selected the "The asset selected for export is the target language" option, you can only start the XLIFF export for the selected target asset. censhare then displays the settings for "Asset structure settings ID" and "Target language" directly behind the option. censhare checks whether the entry in the target language field has the predefined format, analogue to the one for the source language.
If the "The asset selected for the export is the target language" option is not selected, censhare checks the field only if you have selected the corresponding entry for the export. As with the source language, the target language is also mapped to the corresponding XLIFF language code, if defined.
Start the export
When you have entered all your configuration options, click OK. censhare will close the dialog and start to create the desired XLIFF file. Before that, you have to choose the location to store XLIFF file in a second dialog.
After the successful export, the assets of ICML files will stay open. You may not change this. Otherwise, you cannot reimport the XLIFF file with the translated texts anymore.
The export checks if the ICML file is malformed. If the ICML file is malformed, the export fails, and you receive an error message. (For administrators: There is also an entry written into the log file.)
Step 3: Translation
The translation of an XLIFF file is done by a translation software, such as "SDL Trados Studio" or "Across". The following outlines a translation with SDL Trados Studio as an example.
For this purpose, the XLIFF document originating from censhare is imported into SDL Trados Studio, for example using "Translating single file". The software checks the XLIFF file, its source and target language and sets up the translation project accordingly.
In the next step, the translator performs the actual translation being supported by SDL Studio. In the left pane. the source language can be seen and on the right-hand side, the target text (the translation) is inserted.
Provided that all tags that are in a source text (see purple highlighted items in the left half of screenshot to the left) are also transferred to the target text. If this is not completed, the XLIFF document may no longer be imported into censhare under certain circumstances. To prevent such errors in translation, the software checks that all the tags of the source are included in the target. If this is not the case, the translator gets notified by error messages.
Once the translation is completed, and all "translation units" have been marked as completed by the translator, the XLIFF is exported. In SDL Trados Studio, use "Advanced Save | Save source text as" to export the file.
This results in an XLIFF file that contains both the source and the target text and is then used to import the translation to censhare.
Step 4: Import XLIFF
After the translation agency has completed the translation process, the finished XLIFF document can be imported back into censhare.
Note: If an older version of the SDL Trados Studio is used as a translation tool, it is possible that the encoding of the translated files does not match. Our XLIFF2-Export encodes the files as UTF-8, the export from SDL Trados Studio is however comes with ISO Latin 1. In this case, the translated XLIFF file must be recoded to UTF-8 before importing, by using a plain text editor such as Textwrangler. In newer versions, this bug no longer occurs (tested with SDL Trados Studio 2015 SR2, 12.2.5082.0).
To import the XLIFF file, the server action "Import XLIFF" is applied on the selected InDesign asset. A dialog box opens where you can select whether the assets are left open in this state after the import or if they will be saved and closed. In the next dialog, select the XLIFF file that you want to translate.
After the import has been completed, you will see a status report, which summarizes if the operation was successful or aborted due to errors. If the user has not selected the "Keep checked out" option, the translated assets are closed.
The import checks if the XLIFF file is malformed. If the ICML file is malformed, the import fails and you receive an error message. (For administrators: There is also an entry written into the log file.)
If you open the InDesign structure duplicate, it contains the translated document and the XLIFF workflow is complete.
Result
You create a duplicate structure of the InDesign layout asset for the target language. You export an XLIFF file that contains the InCopy stories to be translated. After the texts are translated you reimport the XLIFF with the translated content. The translated InCopy stories are now available in the InDesign layout for the target language.