Skip to content
Novus Examples
xliff2.4 KB

XLIFF 2.0 — Inline codes (en to de)

The XLIFF 2.0 half of a version twin covering how each version represents inline markup and placeholders. XLIFF 1.2 keeps the original markup inline in <bpt>/<ept> and uses <g>, <x/> and <ph>; XLIFF 2.0 replaced all of them with <pc>, <ph/>, <sc/>/<ec/> and moved the markup into an <originalData> block referenced by id.

Preview — first 50 linesxliff
<?xml version="1.0" encoding="UTF-8"?>
<!-- XLIFF 2.0 replaced the 1.2 inline vocabulary wholesale: <pc> for a paired code (or <sc/>/<ec/>
     when the pair crosses a segment boundary), <ph/> for standalone codes and placeholders, and
     an <originalData> block that holds the markup by reference rather than inline. The ids are
     NOT the 1.2 ids: 2.0 requires inline-code ids to be unique within the unit, and the original
     markup moves out of the text into data elements. A 1.2 -> 2.0 converter that keeps the old
     ids and inlines the markup produces a file that validates and still round-trips wrong. -->
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="de">
  <file id="f1" original="upgrade.html">
    <unit id="u1">
      <originalData>
        <data id="d1">&lt;b&gt;</data>
        <data id="d2">&lt;/b&gt;</data>
      </originalData>
      <segment state="translated">
        <source>Your plan renews on <pc id="1" dataRefStart="d1" dataRefEnd="d2">14 March</pc>.</source>
        <target>Ihr Tarif verlängert sich am <pc id="1" dataRefStart="d1" dataRefEnd="d2">14. März</pc>.</target>
      </segment>
    </unit>
    <unit id="u2">
      <originalData>
        <data id="d3">&lt;br/&gt;</data>
      </originalData>
      <segment state="translated">
        <source>Line one<ph id="2" dataRef="d3"/>line two</source>
        <target>Zeile eins<ph id="2" dataRef="d3"/>Zeile zwei</target>
      </segment>
    </unit>
    <unit id="u3">
      <originalData>
        <data id="d4">&lt;a href="/help"&gt;</data>
        <data id="d5">&lt;/a&gt;</data>
      </originalData>
      <segment state="translated">
        <source>See the <pc id="3" dataRefStart="d4" dataRefEnd="d5">help centre</pc> for details.</source>
        <target>Weitere Informationen finden Sie im <pc id="3" dataRefStart="d4" dataRefEnd="d5">Hilfecenter</pc>.</target>
      </segment>
    </unit>
    <unit id="u4">
      <originalData>
        <data id="d6">%1$s</data>
        <data id="d7">%2$d</data>
      </originalData>
      <notes><note>%1$s and %2$d are positional and MAY be reordered by the target language.</note></notes>
      <segment state="initial">
        <source>Welcome back, <ph id="4" dataRef="d6"/> — you have <ph id="5" dataRef="d7"/> new messages.</source>
        <target>Willkommen zurück, <ph id="4" dataRef="d6"/> — Sie haben <ph id="5" dataRef="d7"/> neue Nachrichten.</target>
      </segment>
    </unit>
  </file>
52 lines total — download for the full file.

Specifications

Source Language
en
Target Language
de
Aspect
how each version represents inline markup and placeholders
Twin Of
the same content in the other XLIFF version
Version
2.0 (OASIS)
Namespace
urn:oasis:names:tc:xliff:document:2.0
Seed
20260807
Wave
p7
Line Endings
LF

Testing contract

Expected to pass
Scenario
Extract the translatable text and the inline-code inventory from both files.
Expected result
Both yield the same four segments and the same four codes, but the 2.0 file resolves its markup through dataRef/dataRefStart/dataRefEnd rather than reading it from the text — a converter that inlines the data produces a file that validates and round-trips wrong.

What is a .xliff file?

XLIFF (XML Localization Interchange File Format) is an OASIS-standard XML format for exchanging translatable content between tools. It wraps source and target text in trans-units (1.2) or units and segments (2.0), with metadata, states, and notes. It is the lingua franca between authoring tools and translation-management systems.

How to use this file

Use an example .xliff file to test XLIFF parsers and validators, CAT tools and translation-management systems, and converters between XLIFF 1.2 and 2.0 or to other catalog formats.

How to use this file for testing

“XLIFF 2.0 — Inline codes (en to de)” is a deterministic Novus Examples fixture for Internationalization, Localization catalogs. Parallel text and accented, multi-script content — for testing translation pipelines, Unicode handling, and localization tooling.

Documented properties for this file: seed 20260807 · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Translation-catalog fixtures carry the same message set across formats, each with its native placeholder syntax. Test your i18n loader, catalog converter, or translation-memory tool, and use the RTL and CJK variants to check bidirectional text and Unicode handling.

Load the catalog with your i18n framework and verify placeholder interpolation and plural handling; the RTL and CJK variants exercise bidirectional text and font fallback.

Code examples

from translate.storage.xliff import xlifffile  # pip install translate-toolkit

store = xlifffile.parsefile("inline-2.0.xliff")
for unit in store.units[:5]:
    print(unit.source, "->", unit.target)

Generated by generation/localization_p7.py. Free for any use, no attribution required — license.