Android String Resources format (.xml)
The Android String Resources format reads res/values/strings.xml
files with full localization awareness, rather than as generic XML. It
extracts <string>, <string-array> items, and <plurals> items
(by CLDR quantity) as translatable blocks.
Android l10n semantics are honored: entries marked translatable="false"
and bare resource references (@string/foo, ?attr/bar) are skipped;
positional/printf arguments (%1$s, %d, %%), <xliff:g> do-not-translate
spans, inline styling tags, and <![CDATA[…]]> sections are protected as
inline codes; and a comment immediately preceding an entry becomes a
translator note. Detection is content-based (a <resources> root with at
least one string/array/plurals element) so generic XML still routes to the
XML format. Output is a byte-faithful splice of the original — only changed
values are rewritten, preserving prolog, comments, whitespace, attribute
order, entities, and Android backslash escapes.
How kapi reads it
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
extractComments | boolean | true | Surface an XML comment immediately preceding an entry as a translator note on the emitted block. Comments always round-trip verbatim regardless of this setting. |
skipNonTranslatable | boolean | true | Exclude <string>/<string-array>/<plurals> entries marked translatable="false" from extraction. Such resources are developer-owned and round-trip verbatim. |
skipResourceReferences | boolean | true | Exclude <string> values that are a bare resource reference (e.g. @string/foo, ?attr/bar). A reference is an alias, not translatable UI text. |
Configure these parameters interactively and copy the YAML on the Format Reference.
Examples
Keep non-translatable entries in scope
Extract even entries marked translatable="false".
skipNonTranslatable: false
Processing notes
<string>,<string-array>items, and<plurals>items become translatable blocks; plural items are keyed by CLDR quantity.Positional/printf args,
<xliff:g>, inline styling, and CDATA are protected as inline codes; Android backslash escapes round-trip verbatim.Detection is Sniff-based so plain XML documents are not claimed.
← Back to the Format Reference