Android strings.xml Parser Plugin

Plugin source location: <serge_root>/lib/Serge/Engine/Plugin/parse_android.pm

This plugin extracts strings from Android resource files (strings.xml). String names (IDs) are extracted as translation hints. Tags that bear translatable="false" attribute are skipped. Plugin handles Android-specific escaping of apostrophes and quotation marks.

Code Examples

Simple Strings

strings.xml
<string name="hint" ...>string</string>

String Arrays

To provide better context and indicate that string comes from an array, the resulting hint is constructed as hint:item.

strings.xml
<string-array name="hint" ...> <item>string</item> ... </string-array>

Plural Strings

For plural strings, hint is extracted from both parent <plurals> tag and individual quantity value; the resulting hint is constructed as parent_hint:quantity_hint.

strings.xml
<plurals name="parent_hint" ...> <item quantity="quantity_hint">string</item> ... </plurals>

Limitation: dynamic number of plurals is not supported yet; all quantity variants need to be pre-created in the original XML resource file.

Usage

example-project.serge