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-array. 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 Lokalise editor. Android supports 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 Lokalise editor. Keep in mind, that if a key is marked as translatable="false", it will be exported only for the base language. 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 following tasks:

  • automatic text wrapping in CDATA if HTML tags are present with exception of <a>, <b>, <i>, <u>, <font> and <xliff> tags
  • automatic conversion of line breaks to \n
  • automatic escaping of single/double quotes and other symbols
  • automatic setting of formatted="false" attribute if there are more that one non-positional placeholder present
Did this answer your question?