Wiki

Clone wiki

XLIFF Toolkit / Protected_Content

Protected Content

<Table of Content>

XLIFF allows to mark up content with a translate attribute indicating whether or not the selected content is translatable:

<source>To translate or <mrk id="1" translate="no">not to translate</mrk>.</source>

When working with such content, it is often necessary to protect the non-translatable chunk. For example if you wanted to submit the segment to a machine translation system.

Because the translate property can be nested, can span across several segments or can have its boundaries in <segment> and <ignorable> elements, it is not very easy to process.

The library provides you with various useful methods to deal with protected content. For example:

  • The hideProtectedContent() method in the Unit class folds all the spans of non-translatable text into a special temporary marker.
  • The showProtectedContent() method unfold any folded protected content.
  • The getTranslateStateEndings() method creates a list of booleans indicating the translate state at the end of each part in a unit.

In the code text representation of the content, the folded protected content is indicated with a tag reference using Fragment.PCONT_STANDALONE as its first character. Any tag within the protected content is still accessible from the list of tags.

Updated