Qt

Qt Linguist is a tool provided by Qt to support the internationalization process for Qt-based applications. The Qt TS format is the standard resource file format for these translations.

Format

  • The file format is based on XML.
  • The language attribute of the <TS> node must be specified using ISO 639-1 language codes (e.g., en_US).
  • LingoHub uses the language attribute to determine the target language of the translations.
  • Every <message> element corresponds to a segment in LingoHub.
  • LingoHub uses the <source> element as the segment key.
  • If <message> elements are grouped within a <context>, the <name> element value prefixes the segment key.
  • The <translation> element contains the segment content.
  • The content of <comment> attributes is imported as the segment description.
  • LingoHub preserves and exports <location> elements as they were imported.
  • Placeholders follow the % syntax followed by a number (e.g., %1).

LingoHints can be included in a comment:

<message>
  <source>hello_user</source>
  <translation>Hallo %1</translation>
  <comment><lh>{"status": "DRAFT","qc": {"min": "3","max": "20"},"labels": ["q3-2024"],"not_translatable": false}</lh></comment>
</message>

Example

Additional example files are available on GitHub.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
    <name>Page</name>
    <message>
        <source>translations_example</source>
        <translation>Beispiel für Übersetzungen</translation>
    </message>
    <message>
        <source>hello_user</source>
        <translation>Hallo %1</translation>
    </message>
</context>
<context>
    <name>installscript</name>
    <message>
        <location filename="../views/public.ui" line="36"/>
        <source>dynamic_page_message</source>
        <translation>Diese Seite wurde dynamisch erzeugt.</translation>
    </message>
</context>
</TS>

References