TS File

Qt uses ts files for automatic translations​.

Qt ts files are xml files which are used by the Qt Linguist application. They also get used to provide automatic translations for Qt Applications.

This format behaves a little different than most other formats in order to make it compatible with Applanga.

  1. Id's

    When importing an Ts file Id's will be automatically generated. This follows the following Pattern contextName$@SourceHash{$@CommentHash}[pluralisationType]

    Note:

    1.1 CommentHash is only present if there are 2 or more messages in the same context with the same source field attribute.

    1.2 pluralistaionType is only given for plural messages.

    1.3 $@ is the delimiter for the id's do not use them lightly with this format

    1.4 If you change the Source/Comment message in your application and import that ts file again, you will end up with legacy id's since the Hash has changed. So you should try to avoid this.

  2. Pluralisation

    All pluralisation types that Applanga supports are supported with the Qt Ts export, but they might not be contained in your export file, since Qt has special pluralisation styles for many languages

    Example:

    For arabic (ar) export, all pluralisations would be present in the exported file [zero,one,two,few,many,other].

    For japanese (ja) export, only one pluralisation type would be present [other].

    Qt uses 17 of those pluralisation styles. Most of them are documented here.

  3. Meta attributes

    After you imported a Ts file, your Project will have meta attributes called ApplangaIDContext and ApplangaIDSource.

    Both attributes should not be edited manually !

You can either import and export your .ts files manually on the dashboard or you can automate your TS file translation process with the Applanga Localization CLI.

File Extension
.ts
CLI format key
qt_ts
CLI Supported
true
SDK Supported
false
String Description Supported
true
Pluralization Supported
true

Example:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de">
<context>
    <name>UiContext</name>
    <message>
        <source>Name</source>
        <comment>An example entry for Name</comment>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <source>This is just a Sample</source>
        <translation>Dies ist nur ein Beispiel</translation>
    </message>
</context>
<context>
    <name>CodeContext</name>
    <message>
        <source>I am a message in which was written in Code</source>
        <translation type="unfinished"></translation>
    </message>
</context>
</TS>