Qt uses TS files for automatic translations.
Qt TS (Translation Source) 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 slightly differently from most other formats to ensure compatibility with GL Strings.
IDs
When importing a TS file, IDs will be automatically generated following this pattern:
contextName$@SourceHash{$@CommentHash}[pluralisationType]
Note:
CommentHash is only present if there are 2 or more messages in the same context with the same source field attribute.pluralisationType is only included for plural messages.$@ is used as a delimiter in generated IDs. To prevent errors, avoid including $@ in your contextName values.SourceHash/CommentHash will have changed.Pluralisation
All supported pluralisation types can be included in the Qt TS export, but some may not be present in your export file, since Qt files apply special pluralisation rules for many languages.
Example:
[zero,one,two,few,many,other].[other].Qt uses 17 pluralisation styles, most of which are documented here.
Meta Attributes
After you import a TS file, your Project will have the following meta attributes:
ApplangaIDContextApplangaIDSourceDon't manually edit these atrributes or the strings IDs.
You can either import and export your TS files manually on the dashboard or you can automate your TS file translation process with the GL Strings Localization CLI.
| Specification | Value |
|---|---|
| File Extension | .ts |
| CLI Format Key | qt_ts |
| CLI Supported | true |
| SDK Supported | false |
| String Description Supported | true |
| Pluralization Supported | true |
<?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>