Release Notes / Version 11.2301
Table Of Contents
The deprecated interface
com.coremedia.translate.xliff.exporter.XliffExporter
(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.XliffExportElementCollectionBuilder
com.coremedia.translate.xliff.exporter.XliffExportElementBuilder
com.coremedia.translate.xliff.exporter.XliffExportElement
now unused
com.coremedia.translate.xliff.exporter.CapXliffExportException
now unused
com.coremedia.translate.xliff.CapXliffException
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 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()
, andtransform(masterSources, derivedTargets, strategy)
This default is the same as it has been used by the removed
XliffExporter
.
The
XliffExportOptions
have 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 simulates 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 this:
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);
For details, see section XLIFF Integration in Blueprint Developer Manual and corresponding JavaDoc.
Replacing setXliffExportElementFilter
The former
XliffExporter
provided a method for filtering contents, which shall not be added to the XLIFF:
setXliffExportElementFilter
.
In general, such filtering should happen when creating the
TranslateItem
instances (this is a so-called pre-processing stage). For details, see
XLIFF Export
in
Blueprint Developer Manual
(subsection of
XLIFF Integration
).
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. If you require more details about the involved contents, you may want to replace the
ContentToTranslateItemTransformer
instead, which defaults to
DefaultContentToTranslateItemTransformer
.
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.
(CMS-20068)