Gå til hovedinnhold

XLIFF 1.2 format (.xlf, .xliff)

XLIFF 1.2 is the OASIS XML Localisation Interchange File Format — the bilingual exchange format that translation tools and TMS platforms use to move content between extraction and translation. A document groups <trans-unit> elements under <file> containers, each unit holding a <source> and an optional <target>, with inline markup represented through paired (bpt/ept, g) or standalone (x, ph) code elements and segmentation expressed via <seg-source> and <mrk mtype="seg">.

The reader emits one block per translatable <trans-unit>, carrying the source, any existing target, segmentation, alt-trans matches, and unit metadata. The writer updates targets and, by default, the target state attribute, so a round-tripped file reflects translation progress. This mirrors Okapi's XLIFF 1.2 filter.

IDxliff
SourceBuilt-in
Extensions.xlf, .xliff
MIME Typesapplication/xliff+xml, application/x-xliff+xml
CapabilitiesRead + Write

How kapi reads it

Parameters

ParameterTypeDefaultDescription
addAltTransbooleanfalseAllow addition of new alt-trans elements
addTargetLanguagebooleantrueAdd the target-language attribute to file elements if not already present
allowEmptyTargetsbooleanfalseAllow target elements with empty content to be written
alwaysAddTargetsbooleanfalseAdd target elements for monolingual XLIFF files that have no target in the source
codeFinderRulesarrayRegex patterns that match inline codes within translatable text
editAltTransbooleanfalseAllow editing of existing alt-trans elements
fallbackToIDbooleanfalseUse the trans-unit id attribute as the block name when no resname attribute is present
forceUniqueIdsbooleanfalseRewrite trans-unit IDs to enforce uniqueness across the file
ignoreInputSegmentationbooleanfalseIgnore seg-source/mrk segmentation from the input XLIFF and treat the full source as a single segment
includeExtensionsbooleantrueInclude non-standard namespace extension elements in extracted content
includeItsbooleantrueInclude ITS (Internationalization Tag Set) markup in extracted content
overrideTargetLanguagebooleanfalseOverride the target-language attribute in the output document with the pipeline target locale
preserveSpaceByDefaultbooleanfalseTreat all content as xml:space="preserve" unless explicitly overridden
targetStateValuestringneeds-translationState value to set on target elements when useTranslationTargetState is enabled
useCodeFinderbooleanfalseEnable regex-based inline code detection in translatable text
useTranslationTargetStatebooleantrueUpdate the state attribute on target elements when writing translated XLIFF

Configure these parameters interactively and copy the YAML on the Format Reference.

Examples

Mark targets as translated

Write a final target state instead of the default needs-translation.

useTranslationTargetState: true
targetStateValue: translated

Flatten input segmentation

Treat each source as one segment, ignoring seg-source markers.

ignoreInputSegmentation: true

Processing notes

  • One block is emitted per translatable <trans-unit>; units marked translate="no" are passed through as non-translatable.

  • Inline markup (bpt/ept, g, x, ph) and <seg-source>/<mrk mtype="seg"> segmentation are read into the block.

← Back to the Format Reference