System configuration navigation
| Configuration area | System configuration ID in translate5 |
|---|---|
| File formats | runtimeOptions.import.xlf.placeablesXpathes |
Versioning
Current translate5 version 7.35.5 Changelogs documented up to version 7.25.1
What are XPaths?
XPath stands for “XML Path Language”. It is a query language that can be used to e.g. select, filter and analyse specific elements, attributes or text content within an XML document.
The XPath expression in the .xml block below on the left specifically targets the “PowerScan 3000” text passage, which should not be translated, but rather directly taken over into the target text.
XPath-Regel //ph[@translate = 'no']/@equiv-text | .xml-Code <root> <segment id="2"> <source>To install <ph equiv-text="PowerScan 3000" translate="no" locked="true"/>, follow the instructions.</source> <target>Um <ph equiv-text="PowerScan 3000" translate="no" locked="true"/> zu installieren, folgen Sie den Anweisungen.<target> </segment> </root> |
Identifying placeholders (placeables) in files during import with XPath expressions
First of all: you can use this feature for inline tags originating from various source file formats. In most cases, these would be XML files. However, in translate5, these files are first sent to Okapi for format conversion, and Okapi returns XLIFF 1.2. The process described below is based on these returned XLIFF files.
Placeables are usually marked by internal tags, allowing translate5 to recognize them in the unmasked content of an internal tag when importing Xliff files. The XPath expressions are interpreted relative to the content of the tag, which serves as the root context, rather than relative to the entire document.
If an internal tag is identified as a placeholder, it receives an additional “class” attribute with the designation “t5placeable” and the referenced content is saved in a data property: data-t5content="something".
The placeholder passages are then displayed as protected tags in the editor. However, in such a way that the translator can display them using full tag view.
The following file was used for this example: placeables_example.xliff
Examples of XPath Rules
- Generally, Placeables can be created by referencing the XLIFF tags in the segment directly - OR by referencing the markup that is replaced by the XLIFF-tag (Note: Not all XLIFF tags replace markup).
- The replaced Markup within an XLIFF-tag is searched only for <ph> and <it> -tags. The content is unescaped for XPath evaluation.
- The XPath must refer to text. If the XPath cannot be found or if the referenced text is empty, no placeable is created and the tag is displayed as a “normal” internal tag.
| XLIFF Tag | XPath | Referenced Text | Notes |
|---|---|---|---|
<ph id="5" ax:element-id="1234">Product XYZ</ph> | //ph[@ax:element-id="1234"] | Product XYZ | Reference to a <ph> placeholder tag from Across |
<ph id="2" ctype="x-br"><VARIABLE type="placeholder" name="Some NAME"/></ph> | //VARIABLE[@type='placeholder']/@name | Some NAME | A reference to the markup enclosed in the placeholder tag <ph>. Note that the referenced markup is escaped |
<it id="1" pos="open"><FIELD type="Headline"></it> | //FIELD/@type | Headline | A reference to the markup enclosed in an isolating <it> tag. Note that the referenced markup is escaped. |
Application in translate5
If translate5 does not recognize all placeables in your Xliff files, you can go to the system configuration > “File formats” > “XLIFF Import: Placeables detection XPaths” to insert the XPath expressions that match your placeables.
| These settings can be overwritten during import and at client level. |

