Skip to content
Novus Examples
xlf1.5 KB

XLIFF 1.2 — Plurals (en to pl)

The XLIFF 1.2 half of a version twin covering how each version expresses a plural group. XLIFF 1.2 uses a <group restype="x-gettext-plurals"> whose trans-units are ordered by gettext form index; XLIFF 2.0 dropped restype, so the same content becomes one <unit> per CLDR category, named by category rather than by index.

Preview — first 34 linesxlf
<?xml version="1.0" encoding="UTF-8"?>
<!-- XLIFF 1.2 has no plural construct. The de-facto convention, established by the gettext
     round-trip tools, is a <group restype="x-gettext-plurals"> whose trans-units are ordered by
     the target locale's gettext FORM INDEX. Polish has three forms, so this group has three
     units and the group is only meaningful alongside the Plural-Forms header it came from. -->
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" target-language="pl" datatype="po" original="messages.po">
    <header>
      <note>Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10&gt;=2 &amp;&amp; n%10&lt;=4 &amp;&amp; (n%100&lt;12 || n%100&gt;14) ? 1 : 2);</note>
    </header>
    <body>
      <group id="files" restype="x-gettext-plurals">
        <trans-unit id="files[0]">
          <source>%d file</source>
          <target state="translated">%d plik</target>
        </trans-unit>
        <trans-unit id="files[1]">
          <source>%d files</source>
          <target state="translated">%d pliki</target>
        </trans-unit>
        <trans-unit id="files[2]">
          <source>%d files</source>
          <target state="translated">%d plików</target>
        </trans-unit>
      </group>
      <trans-unit id="browser.title">
        <source>Files</source>
        <target state="translated">Pliki</target>
        <note>Window title for the file browser</note>
      </trans-unit>
    </body>
  </file>
</xliff>

Specifications

Source Language
en
Target Language
pl
Aspect
how each version expresses a plural group
Twin Of
the same content in the other XLIFF version
Version
1.2 (OASIS)
Namespace
urn:oasis:names:tc:xliff:document:1.2
Seed
20260807
Wave
p7
Line Endings
LF

Testing contract

Expected to pass
Scenario
Convert one file to the other version and back.
Expected result
The round trip needs the locale's Plural-Forms expression to map form index 2 to the CLDR category 'many' — a converter that maps positionally mis-keys the third form.

What is a .xlf file?

.xlf is a common file extension for XLIFF, the OASIS XML Localization Interchange File Format — identical in content to .xliff. It carries translatable source and target segments with metadata for exchange between localization tools, and is frequently the extension emitted by Angular and Symfony toolchains.

How to use this file

Use an example .xlf file to test XLIFF parsers, Angular/Symfony i18n pipelines, and CAT tools, or as input for XLIFF version conversion and catalog migration.

How to use this file for testing

“XLIFF 1.2 — Plurals (en to pl)” 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("plurals-1.2.xlf")
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.