Supported File Types (Strings)

.XML - Android (Strings)

Content is machine translated from English by Phrase Language AI.

File Extensions

.xml

API Extension

xml

Import

Yes

Export

Yes

Plural forms support

Yes

Description support

Yes

Format options

convert_placeholder

escape_linebreaks

unescape_linebreaks

enclose_in_cdata

indent_size

indent_style

Android XML is an Android-specific XML variation that can be used to load translated content into Android Apps. Its root element is a <resources> with numerous <string> elements nested under it that store strings pending translation. You may use Android Studio to generate these resource files and use Phrase to manage the translation.

Android Studio uses the property translatable to indicate whether the content needs to be translated. In Phrase, this property is ignored. There is no need to push these strings to Phrase. If a string should not be translated, define it in a separate resource file with all non-translatable strings (ie. donottranslate.xml.

Format Options

Identifier

convert_placeholder

Type

boolean

Upload

No

Download

Yes

Default

false

Description

Placeholder will be converted to match format specific requirements. Example: $s' =&gt; '$@

Identifier

escape_linebreaks

Type

boolena

Upload

No

Download

yes

Default

false

Description

All line breaks will be escaped as \n

Identifier

unescape_linebreaks

Type

boolean

Upload

Yes

Download

No

Default

false

Description

All \n will be imported as true newlines

Identifier

enclose_in_cdata

Type

boolean

Upload

No

Download

Yes

Default

false

Description

Encloses translations containing HTML tags in CDATA

Identifier

indent_size

Type

integer

Upload

No

Download

Yes

Default

4

Description

Specifies number of indentation characters

Identifier

indent_style

Type

string

Upload

No

Download

Yes

Default

space

Description

Specifies indentation character. Allowed values are space  and tab.

Code Sample

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="boolean_key">--- true
</string>
    <string name="empty_string_translation"/>
    <!-- This is the beautiful description for this key! -->
    <string name="key_with_description">Check it out! This key has a description! (At least in some formats)</string>
    <string name="key_with_line-break">This translations contains
a line-break.</string>
    <string name="nested.deeply.key">Hey, this key is nested even deeper.</string>
    <string name="nested.key">This key is nested inside a namespace.</string>
    <string name="null_translation"/>
    <plurals name="pluralized_key">
        <item quantity="one">Only one plural forms found.</item>
        <item quantity="other">Hey, you have %s pluralizations!</item>        
    </plurals>
    <string-array name="sample_collection">
        <item>first item</item>
        <item>second item</item>
        <item>third item</item>
    </string-array>
    <string name="simple_key">Just a  key with a message.</string>
    <string name="unverified_key">This translation is not yet verified and waits for it. (In some formats we also export this status)</string>
</resources>

Plurals for Android XML files

For plural values assign a special <plurals> tag like this:

<plurals name="messages">
        <item quantity="one">One message received.</item>
        <item quantity="other">%s messages received.</item>        
</plurals>
Was this article helpful?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.