Localization

Translations can be written for text that appears in your UI by placing xml files in your assets directory that have a <translation> tag. Here is the translations.xml file from the localization example project:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<translation lang="en">
    <key>{{num}} apples.</key>
    <one>{{num}} apple.</one>
    <other>{{num}} apples.</other>
</translation>

<translation lang="es">
    <key>{{num}} apples.</key>
    <one>{{num}} manzana.</one>
    <other>{{num}} manzanas.</other>

    <key>Hello</key>
    <other>Hola</other>
</translation>

Note

The <key> value should match exactly what appears in Quill. For example, <key>{{num }} apples.</key> will not match the value "{{num}} apples." in a format node, due to the extra space in the variable.

The <key> xml tag specifies what text string to translate. If there is a variable with the integer type, as allowed in a Format Node, the translation will be selected based off the category form.

You can view a list of all the plural rules and their category on http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html

Here is an example Russian translation:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<translation lang="ru">
    <key>{{num}} roubles</key>
    <one>{{num}} рубль</one>
    <many>{{num}} рублей</many>
    <other>{{num}} рубля</other>
</translation>

When writing a translation for text that doesn't have any variables, use the <other> tag to specify your translation.

The default language for an ink instance is English (en). It can be changed by calling the ink_language(struct ink*, const char* code); API function.