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 unescape_tags include_tools_locale_definition |
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 (eg. 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: |
Identifier |
escape_linebreaks |
Type |
Boolean |
Upload |
No |
Download |
Yes |
Default |
false |
Description |
All line breaks will be escaped as |
Identifier |
unescape_linebreaks |
Type |
boolean |
Upload |
Yes |
Download |
No |
Default |
false |
Description |
All |
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 |
Identifier |
unescape_tags |
Type |
boolean |
Upload |
Yes |
Download |
No |
Default |
false |
Description |
All |
Identifier |
include_tools_locale_definition |
Type |
boolean |
Upload |
No |
Download |
Yes |
Default |
false |
Description |
Include |
Identifier |
preserve_cdata |
Type |
boolean |
Upload |
No |
Download |
Yes |
Default |
false |
Description |
If the translation content already contains CDATA tag, this switch prevents the content from being additionally escaped. |
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>