Qt Linguist is a tool Qt provides to support the i18n process for Qt-based applications. Qt TS is the resource file format to externalize your translations.
Format
- the file format is based on XML
- the attribute
language
of the<TS>
node has to be given and must specify the target locale used in this file using ISO 639-1 (it is allowed to use_
as region separator, e.g.,en_US
) - the
language
attribute will be used by LingoHub to determine the language of the translations in the file - if there is a language in the filename, this information won’t be used
- every
message
element will result in a segment in LingoHub - the
source>
attribute will be used as the segment key - if
<message>
is grouped inside<context>
, the<name>
element value will prefix the segment key.
So a<source>
value has to be unique in its context. - the
<translation>
element holds the content of the segment and is understood as the translation for the language specified by thelanguage
attribute in the root node - the content of
<comment>
attributes will be imported as the description for the segment <location>
elements will be stored by LingoHub and exported as imported- Placeholders are specified by
%
followed by a number, eg.:%1
Examples
Additional example files can be accessed here.
<?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 %1</source>
<translation>Hallo %1</translation>
</message>
</context>
<context>
<name>installscript</name>
<message>
<location filename="../views/public.ui" line="36"/>
<source>This is a dynamically created page.</source>
<translation>Diese Seite wurde dynamisch erzeugt.</translation>
</message>
</context>
</TS>
References
Updated 17 days ago