Supported formats

Weblate supports any translation format understood by Translate-toolkit, however each format being slightly different, there might be some issues with not well tested formats.

Weblate does support both monolingual and bilingual formats. Bilingual formats store two languages in single file - source and translation (typical examples is GNU Gettext, XLIFF or Apple OS X strings). On the other side, monolingual formats identify the string by ID and each language file contains only mapping of those to given language (typically Android string resources). Some file formats are used in both variants, see detailed description below.

For correct use of monolingual files, Weblate requires access to file containing complete list of strings to translate with their source - this file is called Monolingual base language file within Weblate, though the naming might vary in your application.

GNU Gettext

Most widely used format in translating free software. This was first format supported by Weblate and still has best support.

Weblate supports contextual information stored in the file, adjusting it’s headers or linking to corresponding source files.

The bilingual gettext PO file typically looks like:

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "Monday"
msgstr "Pondělí"

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "Tuesday"
msgstr "Úterý"

#: weblate/accounts/avatar.py:163
msgctxt "No known user"
msgid "None"
msgstr "Žádný"

Monolingual Gettext

Some projects decide to use Gettext as monolingual formats - they code just IDs in their source code and the string needs to be translated to all languages, including English. Weblate does support this, though you have to choose explicitly this file format when importing components into Weblate.

The monolingual gettext PO file typically looks like:

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-monday"
msgstr "Pondělí"

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-tuesday"
msgstr "Úterý"

#: weblate/accounts/avatar.py:163
msgid "none-user"
msgstr "Žádný"

While the base language file will be:

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-monday"
msgstr "Monday"

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-tuesday"
msgstr "Tuesday"

#: weblate/accounts/avatar.py:163
msgid "none-user"
msgstr "None"

XLIFF

XML based format created to standardize translation files, but in the end it is one of many standards in this area.

XLIFF is usually used as bilingual.

Java properties

Native Java format for translations.

Java properties are usually used as monolingual.

This format supports creating new languages. When a new languages is created, a new empty file will be added to the repository. Only keys that are defined will be written to the newly created file. The Weblate maintainer needs to make sure that this is the expected behaviour with the framework in use.

Qt Linguist .ts

Translation format used in Qt based applications.

Qt Linguist files are used as both bilingual and monolingual.

Android string resources

Android specific file format for translating applications.

Android string resources are monolingual, the Monolingual base language file file being stored in different location than others res/values/strings.xml.

Примечание

Android string-array structures are not currently supported. To work around this, you can break you string arrays apart:

<string-array name="several_strings">
    <item>First string</item>
    <item>Second string</item>
</string-array>

become:

<string-array name="several_strings">
    <item>@string/several_strings_0</item>
    <item>@string/several_strings_1</item>
</string-array>
<string name="several_strings_0">First string</string>
<string name="several_strings_1">Second string</string>

The string-array that points to the string elements should be stored in a different file, and not localized.

This script may help pre-process your existing strings.xml files and translations: https://gist.github.com/paour/11291062

Apple OS X strings

Apple specific file format for translating applications, used for both OS X and iPhone/iPad application translations.

Apple OS X strings are usually used as bilingual.

Примечание

Apple OS X strings are half broken in translate-toolkit 1.9.0 (it will generate corrupted files while saving), please use Git snapshot for handling these.

PHP strings

PHP strings can be processed directly, though currently Translate-toolkit has some problems writing them properly, so please double check that your files won’t get corrupted.

PHP translations are usually monolingual, so it is recommended to specify base file with English strings.

Sample file which should work:

<?php

$string['foo'] = 'This is foo string';

JSON files

Добавлено в версии 2.0.

JSON is format used mostly for translating applications implemented in Javascript.

JSON translations are usually monolingual, so it is recommended to specify base file with English strings.

Примечание

Weblate currently supports only simple JSON files with key value mappings, more complex formats like the ones used by Chrome extensions are currently not supported by translate-toolkit and will produce invalid results.

.Net Resource files

Добавлено в версии 2.3.

.Net Resource (.resx) file is a monolingual XML file format used in Microsoft .Net Applications.

Примечание

As of writing this documentation, you need translate-toolkit from Git to support this format.

Others

As already mentioned, all Translate-toolkit formats are supported, but they did not (yet) receive deeper testing.