Localization file formats

Weblate supports a wide range of translation formats. Each format is slightly different and provides a different set of capabilities.

Hint

When choosing a file format for your application, it’s better to stick some well established format in the toolkit/platform you use. This way your translators can additionally use whatever tools they are used to, and will more likely contribute to your project.

Automatisk gjenkjenning

Weblate tries to detect file format during Adding translation projects and components. The detection might be wrong for different variants of the same serialization format (JSON, YAML, properties) or file encoding, so please verify that Filformat is correct before creating the component.

Translation types capabilities

Please refer to the documentation page of each individual file format for information about which features are supported in that format.

Bilingual and monolingual formats

Both monolingual and bilingual formats are supported. Bilingual formats store two languages in single file—source and translation (typical examples are GNU gettext PO (Portable Object), XLIFF 1.1 and 1.2 or Apple iOS-strenger). On the other side, monolingual formats identify the string by ID, and each language file contains only the mapping of those to any given language (typically Android string resources). Some file formats are used in both variants, see the detailed description below.

For correct use of monolingual files, Weblate requires access to a file containing complete list of strings to translate with their source—this file is called Ettspråklig basis-språkfil within Weblate, though the naming might vary in your paradigm.

Additionally this workflow can be extended by utilizing Mellomliggende språkfil to include strings provided by developers, but not to be used as is in the final strings.

String states

Many file formats only differentiate «Untranslated» and «Translated» strings. With some formats it is possible to store more fine-grained state information, such as «Needs editing» or «Approved».

Beskrivelse av kildestreng

Source string descriptions can be used to pass additional info about the string to translate.

Several formats have native support for providing additional info to translators (for example XLIFF 1.1 and 1.2, GNU gettext PO (Portable Object), WebExtension JSON, CSV files, Excel Open XML, Qt Linguist .ts, go-i18n JSON files, gotext JSON files, ARB File, .NET resource files (RESX, RESW)). Many other formats extract closest comment as source string description.

Forklaring

The Forklaring on strings can be stored and parsed from a few file formats.

Currently supported only in TermBase eXchange format.

Plassering av kildestreng

Location of a string in source code might help proficient translators figure out how the string is used.

This information is typically available in bilingual formats where strings are extracted from the source code using tools. For example GNU gettext PO (Portable Object) and Qt Linguist .ts.

Oversettelsflagg

Translation flags allow customizing Weblate behavior. Some formats support defining those in the translation file (you can always define them in the Weblate interface, see Customizing behavior using flags).

This feature is modelled on flags in GNU gettext PO (Portable Object).

Additionally, for all XML based format, the flags are extracted from the non-standard attribute weblate-flags. Additionally max-length:N is supported through the maxwidth attribute as defined in the XLIFF standard, see Specifying translation flags.

Kontekst

Context is used to differentiate identical strings in a bilingual format used in different scopes (for example Sun can be used as an abbreviated name of the day «Sunday» or as the name of our closest star).

For monolingual formats the string identifier (often called key) can serve the same purpose and additional context is not necessary.

Pluralized strings

Plurals are necessary to properly localize strings with variable count. The rules depend on a target language and many formats follow CLDR specification for that.

Hint

Pluralizing strings need proper support from the application framework as well. Choose native format of your platform such as GNU gettext PO (Portable Object), Android string resources or Stringsdict-format.

Skrivebeskyttede strenger

Read-only strings from translation files will be included, but can not be edited in Weblate. This feature is natively supported by few formats (XLIFF 1.1 and 1.2 and Android string resources), but can be emulated in others by adding a read-only flag, see Customizing behavior using flags.

Supporting other formats

Most formats supported by translate-toolkit which support serializing can be easily supported, but they did not (yet) received any testing. In most cases, an additional thin layer is needed in Weblate to hide differences in behavior of different storages.

To add support for a new format, the preferred approach is to first implement support for it in the translate-toolkit.

File format parameters

File format parameters provide a way to configure settings related to the file format. They are configured at component level and allow you to customize how file parsing and serialization are handled.

List of file format parameters

Parameter name

File formats

Label

Help text

csv_encoding

  • csv

  • csv-multi

File encoding

Encoding used for CSV files

Available choices:

auto

Auto-detect

utf-8

UTF-8

csv_simple_encoding

  • csv-simple

File encoding

Encoding used for simple CSV files

Available choices:

auto

Auto-detect

utf-8

UTF-8

iso-8859-1

ISO-8859-1

dos_eol

All file formats

DOS-linjeavslutninger

Use DOS line endings (rn) instead of UNIX line endings (n) in strings.

flatxml_key_name

  • flatxml

FlatXML key name

flatxml_root_name

  • flatxml

FlatXML Root name

flatxml_value_name

  • flatxml

FlatXML value name

gwt_encoding

  • gwt

File encoding

Encoding used for GWT Properties files

Available choices:

utf-8

UTF-8

iso-8859-1

ISO-8859-1

json_indent

  • json

  • json-nested

  • webextension

  • i18next

  • i18nextv4

  • arb

  • go-i18n-json

  • go-i18n-json-v2

  • formatjs

  • gotext

JSON-innrykk

json_indent_style

  • json

  • json-nested

  • webextension

  • i18next

  • i18nextv4

  • arb

  • go-i18n-json

  • go-i18n-json-v2

  • formatjs

  • gotext

JSON-innrykksstil

Available choices:

spaces

Mellomrom

tabs

Tabulatorinnrykk

json_sort_keys

  • json

  • json-nested

  • webextension

  • i18next

  • i18nextv4

  • arb

  • go-i18n-json

  • go-i18n-json-v2

  • formatjs

  • gotext

Sorter JSON-nøkler

json_use_compact_separators

  • json

  • json-nested

  • webextension

  • i18next

  • i18nextv4

  • arb

  • go-i18n-json

  • go-i18n-json-v2

  • formatjs

  • gotext

Avoid spaces after separators

line_max_length

  • markdown

  • mdx

Maximum line length

The maximum number of characters for each line in the output file.

md_extract_code_blocks

  • markdown

  • mdx

Extract code blocks

Whether to extract translatable content from code blocks in Markdown and MDX files.

md_extract_frontmatter

  • markdown

  • mdx

Extract front matter

Whether to extract and translate YAML front matter blocks in Markdown and MDX files.

md_no_placeholders

  • markdown

  • mdx

Disable placeholders

Disables detection and processing of placeholders in Markdown and MDX files.

merge_duplicates

  • markdown

  • mdx

  • html

  • txt

  • dokuwiki

  • mediawiki

  • asciidoc

Deduplicate identical strings

Consolidates identical source strings into a single translation unit. Prevents translation loss during file restructuring or table reordering by removing position-dependent context.

po_fuzzy_matching

  • po

Bruk fuzzy jamføring

po_keep_previous

  • po

Behold tidligere msgid-er for oversatte strenger

po_line_wrap

  • po

  • po-mono

Linjebrying av lange linjer

By default, gettext wraps lines at 77 characters and at newlines. With the --no-wrap parameter, wrapping is only done at newlines.

Available choices:

77

Linjebryt på 77 tegn og ved nylinjer (xgettext-forvalg)

65535

Only wrap lines at newlines (like xgettext --no-wrap)

-1

Ingen linjebryting

po_no_location

  • po

Do not include location information in the file

po_report_msgid_bugs_to

  • po

  • po-mono

Report msgid bugs to

Lets Weblate update the «Report-Msgid-Bugs-To» file header if Source string bug reporting address is set.

po_set_language_team

  • po

  • po-mono

Update language team header

Lets Weblate update the «Language-Team» file header.

po_set_last_translator

  • po

  • po-mono

Update last translator header

Lets Weblate update the «Last-Translator» file header.

po_set_x_generator

  • po

  • po-mono

Update X-Generator header

Lets Weblate update the «X-Generator» file header.

properties_encoding

  • properties

File encoding

Encoding used for Java Properties files

Available choices:

iso-8859-1

ISO-8859-1

utf-8

UTF-8

utf-16

UTF-16

strings_encoding

  • strings

File encoding

Encoding used for iOS strings files

Available choices:

utf-8

UTF-8

utf-16

UTF-16

xml_closing_tags

  • ts

  • plainxliff

  • xliff

  • xliff2

  • xliff2-placeables

  • poxliff

  • apple-xliff

  • resx

  • aresource

  • moko-resource

  • cmp-resource

  • tbx

Include closing tag for blank XML tags

yaml_indent

  • yaml

  • ruby-yaml

YAML-innrykk

yaml_line_break

  • yaml

  • ruby-yaml

Linjeskift

Available choices:

dos

DOS (\r\n)

unix

UNIX (\n)

mac

MAC (\r)

yaml_line_wrap

  • yaml

  • ruby-yaml

Linjebrying av lange linjer

Available choices:

80

Linjebryt ved 80 tegn

100

Linjebryt ved 100 tegn

120

Linjebryt ved 120 tegn

180

Linjebryt ved 180 tegn

65535

Ingen linjebryting