XLIFF 1.2 · XLIFF 2.0 · gettext PO and POT · translation memory · glossary · QA checks · .mo output

XLIFF and PO Translation Editor

Translate a localisation file in a segment grid with locked inline tags, memory matches from a TMX, glossary hints and checks for placeholders, numbers and tags. Saving changes only what you edited. There is no machine translation.

1. Open a file

Choose an .xlf, .xliff, .po or .pot file

Up to 40 MB and 200,000 segments

XLIFF and PO Translation Editor

Operator: Abdulla Al Fahad. How tools are built and checked

Developers hand translators XLIFF or PO files, and the translators' tools do two things that matter to the developer: they keep the file's structure intact so it merges back cleanly, and they stop translators from breaking the code inside strings, such as %s, {0} or an inline <g> tag. This page edits the file in a segment grid and checks each string for exactly those problems.

It does not translate anything for you. There is no machine translation: every target is typed by a person or copied from a translation memory that the person loaded.

Key features

  • XLIFF 1.2, XLIFF 2.0 and gettext PO or POT in one grid, with source, target, state, notes and context for every segment
  • Inline tags such as <g>, <x/>, <pc> and <ph/> shown as locked chips, with a text box that refuses edits which would delete one
  • TMX 1.4 memory with exact and fuzzy matches shown as a percentage, and a button to fill untranslated segments from exact matches
  • A glossary CSV that highlights source terms and flags a translation that lacks the agreed term
  • Checks for missing translations, tags, placeholders, numbers, whitespace, length, repeated source text and PO plural counts
  • Saving the same format, compiling a .mo, and exporting the translated segments as TMX

How the file is edited, checked and saved back

An XLIFF file is read with a scanner that remembers where every element starts and ends. Saving does not rebuild the document: it replaces only the text inside the <target> elements you edited, adds a <target> after the <source> of units that had none, and updates the state attribute. Everything else, including extension namespaces, vendor attributes, notes and whitespace, is copied byte for byte. A file that declares a DOCTYPE or an ENTITY is refused, because external entities are a known way to make an XML reader fetch or expose data.

Inline codes are converted to tokens while you edit: an opening <g id="1"> becomes {1}, its closing tag becomes {/1}, and a standalone <x id="2"/> becomes {1/} or the next free number. Elements with their own content, such as <ph> holding text, are kept whole as one token. When the segment is saved, each token is replaced by the exact original markup, and the rest of the text is escaped.

A PO file is read and written with the gettext-parser library. The file is decoded with the charset its header declares (UTF-8 when none is given) and always saved as UTF-8 with the header updated. Entries, translator and extracted comments, references and flags are kept; the file is re-serialised, so very long lines may be re-wrapped, comment markers can gain a space and the charset is written in lower case. Unlike XLIFF, a saved PO is therefore not byte-identical to the original, even when nothing was edited. A translation you typed but did not confirm is saved with the fuzzy flag, so it does not reach a compiled .mo by accident.

XLIFF states are mapped to four: new, needs review, translated and final. XLIFF 1.2 has all four. XLIFF 2.0 has initial, translated, reviewed and final, so needs review is saved as initial.

How it works

The grid is virtual: only the rows in view are drawn, so a file of tens of thousands of segments scrolls normally. Checks run on the rows you see and on the segment you are editing; the Run all checks button covers the whole file, and the With issues filter uses the same rules.

Common use cases

  • A mobile developer receives a 3,000-string XLIFF back from an agency and runs all checks and works through the placeholder errors, mostly translators who dropped %@ or reordered unnumbered %s, before the build.
  • A volunteer translating an open-source project loads messages.po, fills the 120 strings that a TMX of an earlier release matches exactly, marks them Needs review, and works through the rest.
  • A localisation manager compiles the final PO to a .mo and exports a TMX of the translated segments to seed the next project's memory.
  • A support team keeps a glossary of 40 product terms. The editor highlights them in the source and warns when a translation uses a different word.

How to use this tool

  1. Open the .xlf, .xliff, .po or .pot file; the page shows its format, languages and word count.
  2. Optionally load a TMX memory and a glossary CSV.
  3. Click a segment, type the translation, and press Ctrl+Enter to confirm it and move on.
  4. Read the checks under the editor for each segment, and use the filters to find new, review and problem segments.
  5. Save the file, compile a .mo for a PO, or export a TMX of what you have translated.

Example

A four-unit XLIFF 1.2 file with an extension attribute, one inline tag and one untranslated unit

Unit 2 has the source "Save <x id="2"/> files & exit" and no target. Type "Speichern {1/} Dateien & beenden" and confirm it.

What changes in the saved file

One line is added after the source: <target state="translated" xml:lang="de">Speichern <x id="2"/> Dateien &amp; beenden</target>. The file goes from 25 to 26 lines. With no edit at all, the saved text is identical to the input, including the ext:build attribute and the extension element inside the first unit.

Tips for best results

  • Use positional specifiers such as %1$s and %2$s when a translation has to reorder arguments. The check accepts a reordered numbered list and warns on a reordered unnumbered one.
  • Mark memory-filled segments as Needs review rather than Translated until someone has read them; an exact memory match can still be wrong in context.
  • Press Ctrl+Enter only when a segment is finished. For PO, anything left in Needs review is written as fuzzy and left out of the compiled .mo.
  • Set the length limit to 150 or 200 percent for interface strings with limited room, and the page will flag the long ones.

Common pitfalls

Tag tokens are numbered by this page, not taken from the id attributes, so a {2} in the editor is not necessarily tag id 2 in the file. Use the chips under the box to insert them.

Memory matches are Levenshtein similarity on the plain text. A 95 percent match can differ in the one word that matters, and nothing here tells you which.

The PO is re-serialised on saving, so a diff against the original can show re-wrapped lines, re-spaced comment markers and a lower-case charset even where nothing changed. The entries themselves are intact.

Common errors and how to fix them

"This file declares a DOCTYPE or an ENTITY, which this page refuses to read."
Remove the declaration, or re-export the file without a DTD. XLIFF files do not need one.
"The closing tag </g> does not match the open <source>. The XML is not well-formed."
The file has a broken tag, often from hand editing. Fix the markup in a text editor; the page does not guess what was meant.
"Inline tags are locked: {1} cannot be deleted."
A tag from the source must stay in the translation. Move the cursor around it, or use the chip to insert it where the sentence needs it.
"The Plural-Forms header says 3 forms, but this entry has 2."
The entry has too few msgstr lines for the language. Open it and fill every plural form, or correct the header if it names the wrong language rules.
"No translation units were found in this XLIFF file."
The file has no trans-unit (1.2) or unit (2.0) with a source element. Check that it is a translation file, not a manifest or a TMX.

Best practices

  • Run all checks before saving and fix the errors first; the warnings are suggestions.
  • Keep the original file beside the edited one and compare them in a diff viewer: an XLIFF edit should show only target lines.
  • Compile the .mo from the final PO on the same page, so the two cannot drift apart.

Checks and what each one looks for

Placeholders: printf specifiers (%s, %d, %1$s, %-5.2f), named ones (%(name)s, {name}, {{name}}, ${name}, {0}) and the argument names of ICU messages. Text inside the branches of an ICU plural or select is treated as text, so translating it does not trigger an error, while a lost argument does. Numbers are compared as digit strings with separators removed, so 1,000 and 1.000 count as the same figure and 3 against 4 does not.

Tags: the set of tokens in source and target must match. Whitespace: leading and trailing spaces must match. Plurals: the number of forms must equal nplurals from the header and none may be empty. Repeats: a target identical to a source of four or more letters is flagged, because it is often an untranslated copy.

Checked against GNU msgfmt

The .mo writer follows GNU msgfmt's layout, including its string order, hash table size and hash function. For a 320-entry UTF-8 PO with contexts, plurals and German, Japanese, Cyrillic, Hebrew and Greek text, its output is byte-identical to the .mo that msgfmt produces from the same file. Like msgfmt, it leaves fuzzy and untranslated entries out. msgfmt also expands format macros such as %<PRIuMAX> and drops POT-Creation-Date, which this page does not, so a file that uses them gives a different .mo.

Frequently asked questions

Does it translate with a machine?

No. There is no machine translation in the page. Suggestions come only from a TMX memory you load and from the glossary you load.

What happens to translate="no" units?

They are listed as Locked, shown for context and never changed. They are left out of the word count and the checks.

Why does a PO plural entry show several boxes?

gettext stores one translation per plural form, and the number comes from the Plural-Forms header. A language such as Polish needs three, Japanese one. The editor shows one box per form and checks that none is empty.

When would I use the document or subtitle translator instead?

Those translate with a model that runs in your browser. This editor is for a human translator working in a localisation file, with memory, glossary and checks, and it leaves the file's structure as it found it.

Can it open a TMX as the document to edit?

No. A TMX is a memory, not a translation file. Load it in the memory box to get matches while editing an XLIFF or PO.