Documentation section

File Format - Qt TS

Learn how to use Localazy CLI for app and software localization with translations in Qt’s Linguist .TS files.

Qt’s Linguist .TS files are fully supported by Localazy.

id-based files 🔗

By default, Localazy prefer message id as the identifier and in such a situation, the source is not required.

<!DOCTYPE TS>
  <TS>
    <context>
      <message id="file_identifier">
        <source></source>
        <translation>Translations of the given string</translation>
    </message>
  </context>
</TS>

By default, in the output file, the source is kept empty, but you can include include_source in features in the upload section to tell Localazy to output the source languge translation.

source-based files 🔗

If the message id is not provided or if you specify prefer_source_as_key in features in the upload section, the content of source is used as the key instead.

<!DOCTYPE TS>
  <TS>
    <context>
      <message>
        <source>source string or identifier</source>
        <translation>Translations of the given string</translation>
    </message>
  </context>
</TS>

In such a situation, it’s not replaced with the current source language translation when generating the translated file.

Using the source translation 🔗

The common situation is that there is no file for the source language, and the source translation is instead provided in the translated files like this:

<!DOCTYPE TS>
  <TS>
    <context>
      <message id="string_id">
        <source>Source language translation</source>
        <translation>Translations of the given string</translation>
    </message>
  </context>
</TS>

By adding source_is_content to features in the upload section, you can tell Localazy, to use content from source as the source language translation.

ICU plurals 🔗

This feature can enabled by adding plural_icu to features in the upload section.

<!DOCTYPE TS>
  <TS>
    <context>
      <message id="icu_plural">
        <source></source>
        <translation>There are {COUNT, plural, one {one user} other {# users}}.</translation>
    </message>
  </context>
</TS>

Only one ICU plural can be used in the string as otherwise, it wouldn’t be possible to convert it to a specific Localazy plural structure. If more ICU plurals are contained, the string is kept in the original form.

Allowed plurals types are: zero (=0), one (=1), two (=2), few, many, other.

Other ICU types like gender, number, etc. can be used but will not be converted and will be kept in string in the original form.

HTML entities 🔗

HTML entities are not allowed in TS files because they are not defined in the XML standard. Localazy can convert HTML entities to their Unicode representation when the file is imported.

This feature can be enabled by adding decode_html_entities to features in the upload section.

Skipping empty translations 🔗

By default, empty translations are imported as empty strings. If your format use empty translations for untranslated texts, add skip_empty to features in the upload section.

Filtering untranslated strings 🔗

By default, when the output file is generated, Localazy uses texts from the source languages when the translation in the exported language is missing.

This approach is safeguarding you from missing keys that can lead to crashes in some solutions/frameworks.

This feature can be disable by adding filter_untranslated to features in the upload section and reuploading your source language file.