close

Filter

loading table of contents...

CoreMedia Content Cloud v11 Upgrade Guide / Version 2110

Table Of Contents

6.2.7 Removal of Deprecated Version of XliffExporter

The deprecated interface com.coremedia.translate.xliff.exporter.XliffExporter (artifact: cap-xliff) and its related interfaces and classes have been removed.

Use the refactored, more flexible com.coremedia.cap.translate.xliff.XliffExporter instead.

Changes in Detail

The following classes/interfaces have been removed:

  • com.coremedia.translate.xliff.exporter.XliffExporter

    Use com.coremedia.cap.translate.xliff.XliffExporter instead.

  • Replaced by com.coremedia.translate.item.TranslateItem:

    • com.coremedia.translate.xliff.exporter.XliffExportElement

    • com.coremedia.translate.xliff.exporter.XliffExportElementBuilder

    • com.coremedia.translate.xliff.exporter.XliffExportElementCollectionBuilder

  • com.coremedia.translate.xliff.exporter.CapXliffExportException

  • com.coremedia.translate.xliff.CapXliffException

Extensions to Ease Upgrade

Some classes and interfaces have been extended, to provide the same behavior as the now removed, previously deprecated XliffExporter.

The interface ContentToTranslateItemTransformer, which is required as an intermediate step to transform contents (master and derived) to translate-items accepted by the current XliffExporter, has been extended by using a default locale mapper, by introducing the following default methods:

  • getDefaultLocaleMapper(), and

  • transform(masterSources, derivedTargets, strategy)

This default is the same as it has been used by the removed XliffExporter.

The XliffExportOptions class has been extended to provide a way to specify a default comment to apply to all translate items, which don't have a comment yet (added to XLIFF as <note>). See XliffExportOptions.DefaultCommentOption and its usages for details. This implements the same behavior as the removed XliffExporter, where you could hand over a comment on XLIFF export – and which also got applied to all translate-items, and thus to all XLIFF <file> entries.

And to ease, having a base set of options to modify for example by a new default comment, XliffExportOptions now provides a method builder() to create a derived set of options from the original one.

Typical Replacement

A typical replacement for the old XliffExporter is similar to Example 6.1, “Typical Modern XliffExporter Usage”.

XliffExportOptions xliffExportOptions = XliffExportOptions.xliffExportOptions()
    .option(
        XliffExportOptions.TargetOption.TARGET_EMPTY
    )
    .option(
        XliffExportOptions.DefaultCommentOption.of("default comment")
    )
    .build();
List<TranslateItem> items = contentToTranslateItemTransformer
    .transform(
        masterContentObjects,
        derivedContents,
        TransformStrategy.ITEM_PER_TARGET
    )
    .collect(toList());

Xliff xliff = xliffExporter.exportXliff(
    items,
    xliffExportOptions
);

      

Example 6.1. Typical Modern XliffExporter Usage


For details, see section Section 5.5.3.4, “XLIFF Integration” in Blueprint Developer Manual and corresponding JavaDoc.

Replacing setXliffExportElementFilter

The former XliffExporter provided a method for filtering contents, which should not be added to the XLIFF file: setXliffExportElementFilter.

In general, such filtering should happen when creating the TranslateItem instances (this is a so-called pre-processing stage). For details, see Section 5.5.3.4.2, “XLIFF Export” in Blueprint Developer Manual , especially Section 5.5.3.4, “XLIFF Integration” in Blueprint Developer Manual .

Nevertheless, in contexts, where you cannot directly influence the creation of translate-items, a fallback exists for the new XliffExporter: setTranslateItemFilter. This applies for example to the default XLIFF download as provided in CoreMedia Studio. As translate-items only provide the information relevant for translating a given content, you may miss some details which were available in the previous pre-processing stage via XliffExportElementFilter. If you require more details, you may want to replace the ContentToTranslateItemTransformer instead, which defaults to DefaultContentToTranslateItemTransformer.

Note

Generate XLIFF in Workflow Instead

The integrated XLIFF download in CoreMedia Studio provides only very limited control on XLIFF creation. In general, it is recommended disabling the download button for the given workflow instead and serve the XLIFF via a BLOB property of the workflow. The BLOB property is then set from a custom workflow action, which again can use the rich API as provided by the modern XliffExporter.

If it is about not repeating translation for unchanged properties, you may want to set translate.item.include-unchanged-properties to false, which will be taken into account when generating the translate-items. See Section “XLIFF Configuration Properties” in Blueprint Developer Manual .

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.