Android string resources provide text data for your application with optional styling and formatting. There can be three types of string resources: string, string-array, plurals.  Here is an example of how Android resource file should look:

    <string name="simple_string">Hello world!</string>
    <string name="string_with_placeholders">Hello %s!</string>
    <string name="string_w" formatted="false">%s jobs in %s days</string>
    <string name="string_with_html_formatting">Hello <b>world</b>!</string>
    <string name="string_with_other_html"><![CDATA[<h1>Hello world!</h1>]]></string>
    <plurals name="plural_string">
        <item quantity="one">%s cat</item>
        <item quantity="other">%s cats</item>
    <string-array name="array_of_strings">
        <item>When possible</item>

String arrays

All keys with square brackets and indexes are converted to string-arrays. In the example above the keys are array_of_strings[0], array_of_strings[1] and array_of_strings[2].


Plurals are created by defining a key as plural in the Lokalise editor. Android supports the following plural forms: zero, one, two, few, many, other.

Custom key attributes

If you want to mark a key as translatable="false"  or force it to be exported as CDATA, you can do so via custom attributes in the Lokalise editor. Keep in mind, that if a key is marked as translatable="false",  it will only be exported for the base language. The following custom attributes are available for Android keys:

    "translatable": "false",
    "force-cdata": true

You can read more about custom key attributes for other formats in the Custom attributes section. 

Exporting resources

When exporting Android string resources from Lokalise, our exporter automatically performs the following tasks:

  • Automatic text wrapping in CDATA if HTML tags are present with the exception of <a>, <b>, <i>, <u>, <font>, and <xliff> tags.

    • However, please note that the above exceptions is not applied in cases when you have any tag with placeholders. For example: Welcome, <b>%s</b> or %s, <b>welcome</b>. In these cases the text will be wrapped in CDATA.

  • Automatic conversion of line breaks to \n.

  • Automatic escaping of single/double quotes and other symbols. Please note that all special characters (#, &, /, \, ', " etc) will be escaped. The only exceptions are . and _. Dash - will be converted to _ automatically.

  • Automatic setting of the formatted="false" attribute if there is more than one non-positional placeholder present.

Did this answer your question?