Documentation section

File Format - RESX

Learn how to use Localazy CLI for app and software localization with translations in RESX files.

RESX format is supported and with Localazy, it’s possible to use also plurals and arrays for more comfortable and accurate translations.

Context information 🔗

By default, Localazy extracts content from preceding XML comments and from sub-elements description, context, comment, and developer_comment and presents it to the translators to provide better context and improve translation quality.

<root>

    <!-- Context information. -->
    <data name="string_key">
        <value>The translated content</value>       
        <comment>Another way to specify context information.</comment>
    </data>

</root>

HTML entities 🔗

HTML entities are not allowed in RESX 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.

Arrays 🔗

Arrays are good but beware of changing the number of items to prevent mismatching translations. If your files contain incomplete arrays, don’t use array features at all.

Using arrays in RESX is not a standard. However, Localazy can parse the suffixed variant shown below and present it to translators in a way that keeps items together and thus improves context and translation quality.

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

<root>

    <data name="difficulty[0]">
        <value>easy</value>
    </data>

    <data name="difficulty[4]">
        <value>normal</value>
    </data>

    <data name="difficulty[7]">
        <value>hard</value>
    </data>

    <data name="difficulty[9]">
        <value>extreme</value>
    </data>

</root>

The code above will be processed as an array and additional metadata will be stored, so Localazy can restore the indexes correctly.

All valid indexes are processed where the valid index is a non-negative integer value.

Plurals 🔗

Beware that plurals may lead to different outputs for translated files due to how plurals are handled in different languages.

<root>

  <!-- English has only two plural forms: -->
  
  <data name="items[one]">
    <value>You have 1 item.</value>
  </data>

  <data name="items[other]">
    <value>You have %d items.</value>
  </data>

  <!-- Czech has three plural forms: -->
  
  <data name="items[one]">
    <value>Máte 1 položku.</value>
  </data>

  <data name="items[few]">
    <value>Máte %d položky.</value>
  </data>

  <data name="items[other]">
    <value>Máte %d položek.</value>
  </data>

</root>

Localazy knows the rules for different languages and adapts its interface to assist translators to correctly translate all mandatory forms.

Your app should be able to handle this. We are also working on SDK to help you with this task.

Allowed plurals types are: zero, one, two, few, many, other.

Suffixed with camelCase 🔗

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

Example:

<root>
  
  <data name="usersOne">
    <value>There is one user.</value>
  </data>

  <data name="usersOther">
    <value>There are $number users.</value>
  </data>

</root>

Suffixed with brackets 🔗

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

Example:

<root>
  
  <data name="users[one]">
    <value>There is one user.</value>
  </data>

  <data name="users[other]">
    <value>There are $number users.</value>
  </data>

</root>

Defined using ICU 🔗

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

<root> 
  <data name="users">
    <value>There are {COUNT, plural, one {one user} other {# users}}.</value>
  </data>
</root>

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 than two 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.

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.