Skip to main content

Qt TS format

Qt Linguist TS is the bilingual XML format used by Qt's lupdate and lrelease tools to carry UI translations. A <TS> document groups one or more <context> elements; each context groups <message> entries with a <source> and a <translation>. Translation state is encoded on the <translation> element's type attribute: no type means approved, unfinished means pending review, and obsolete means the entry is unused. Plural messages (numerus="yes") carry one <numerusform> per locale plural form. Inline non-XML bytes appear as <byte value="…"/> elements.

The reader extracts each message's source as a translatable block, matched with its existing translation, and preserves the context and message structure for the writer. The format is detected by sniffing for a <TS> … </TS> document rather than by the .ts extension, which collides with TypeScript.

IDts
SourceBuilt-in
MIME Typesapplication/x-ts, application/x-linguist
CapabilitiesRead + Write

This format has no configurable parameters.

Examples

Translate a Qt UI catalogue

No configuration is required. Declare the format to extract each <message> source and merge translations back into the .ts document.

format:
name: ts

Processing notes

  • One translatable block per <message>; context and message structure round-trip as skeleton.

  • Plural messages carry one <numerusform> per locale plural form.

  • Translation state (approved / unfinished / obsolete) is read from the <translation> type attribute.

Limitations

  • The format is not auto-detected by the .ts file extension (it conflicts with TypeScript); detection relies on sniffing the <TS> root element or an explicit format declaration.

  • Non-XML bytes (<byte value="…"/> elements) are surfaced as inline placeholder runs and preserved through exchange; they are not decoded to their raw character equivalents on read.

  • There are no configurable parameters; behaviour follows the default contract.

  • Each <numerusform> of a plural message is written from its own part of the translation. A translation that no longer divides into the forms, such as an edit that joins two forms or one translation written for the whole message over forms that hold text, is refused and the document is left unwritten.

  • A plural message's forms that were empty when read are written empty, so a translation written for such a message does not reach the file.

← Back to the Format Reference