XLIFF 2.x format (.xlf, .xliff)
XLIFF 2.x is the modern OASIS Localization Interchange File Format. It
replaces the 1.2 element soup with an explicit <unit>/<segment>
structure, file-scoped notes, a small set of inline tag elements
(ph, pc, sc/ec, mrk), and per-segment translation states. The
reader accepts the 2.0, 2.1, and 2.2 namespaces as one compatible
family.
The reader emits one block per translatable unit and preserves inline markup as raw inner XML so unmodified content round-trips byte-for-byte. The writer can emit any 2.x version: by default it preserves the input document's version on round-trip and falls back to 2.2 for content extracted from a non-XLIFF source. This mirrors Okapi's XLIFF 2 filter.
How kapi reads it
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
codeFinderRules | array | Regex patterns that match inline codes within translatable text | |
discardInvalidTargets | boolean | false | Discard targets that fail validation rather than rejecting the entire file |
forceUniqueIds | boolean | false | Ensure inline tag IDs are unique within each unit |
ignoreTagTypeMatch | boolean | false | Ignore tag type mismatch between source and target segments |
useCodeFinder | boolean | false | Enable regex-based inline code detection in translatable text |
version | string | "" | Target XLIFF 2.x version to emit. Empty means: preserve the input document version on roundtrip, otherwise default to 2.2. |
writeOriginalData | boolean | true | Output includes original data when available |
Configure these parameters interactively and copy the YAML on the Format Reference.
Examples
Force XLIFF 2.0 output
Emit 2.0 regardless of the input document version.
version: "2.0"
Tolerate invalid targets
Drop targets that fail validation rather than rejecting the file.
discardInvalidTargets: true
Processing notes
One block is emitted per translatable unit; inline markup is preserved as raw inner XML for byte-faithful round-trips.
The 2.0, 2.1, and 2.2 namespaces are accepted as a compatible family on read.
← Back to the Format Reference