Gå til hovedinnhold

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.

IDxliff2
SourceBuilt-in
Extensions.xlf, .xliff
MIME Typesapplication/xliff+xml
CapabilitiesRead + Write

How kapi reads it

Parameters

ParameterTypeDefaultDescription
codeFinderRulesarrayRegex patterns that match inline codes within translatable text
discardInvalidTargetsbooleanfalseDiscard targets that fail validation rather than rejecting the entire file
forceUniqueIdsbooleanfalseEnsure inline tag IDs are unique within each unit
ignoreTagTypeMatchbooleanfalseIgnore tag type mismatch between source and target segments
useCodeFinderbooleanfalseEnable regex-based inline code detection in translatable text
versionstring""Target XLIFF 2.x version to emit. Empty means: preserve the input document version on roundtrip, otherwise default to 2.2.
writeOriginalDatabooleantrueOutput 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