Android resources

Translate supported strings, arrays, and plurals while preserving Android resource names and locale directory rules.

Android uses resource names to connect visible text to application code. The android file handler keeps those names and translates supported strings, string-array items, and plural items inside a <resources> root. Quantity attributes and array positions continue to identify the values Android loads.

Resource selection #

A resource file can combine translated text and a fixed product name:

xml
<resources>
  <string name="checkout_title">Complete your order</string>
  <string name="brand" translatable="false">Acme</string>
  <string-array name="delivery_methods">
    <item>Standard delivery</item>
    <item>Express delivery</item>
  </string-array>
  <plurals name="items">
    <item quantity="one">%d item</item>
    <item quantity="other">%d items</item>
  </plurals>
</resources>

Resource names, array positions, and plural quantities identify the translatable values. brand is skipped because it has translatable="false". Array identities include positions, so reordering the array changes how its text matches an existing target. The current CLI does not support Android --key selection; select whole source files instead.

The handler reads character data from each item and skips items containing child elements such as <b> or <xliff:g>. Supply reviewed targets for those rich resources separately and check their coverage when the surrounding file completes. Text around an inline XML comment is joined for translation; replacing the value can remove that inline comment, whose wording is not used as a translation hint.

CDATA is parsed as text when it forms a single text value, and reconstruction retains its wrapper. Markup written inside CDATA is part of the text sent for translation, not protected child structure. Inspect those resources with the application's actual rendering code.

Locale placement #

The usual source is res/values/strings.xml; a German target belongs in res/values-de/strings.xml. Region and script qualifiers need Android spelling, such as values-pt-rBR or values-b+zh+Hans, rather than an arbitrary locale string pasted after values-.

CLI path derivation understands a bare values directory with explicit Android format. An artificial values-en symlink is unnecessary for that supported layout. The format's implied Android locale spelling and any explicit target path belong in CLI configuration. Inspect the derived path before accepting output.

Reuse and partial output #

Previous source text is compared by resource identity. The existing target supplies matching values during reconstruction. Use ordinary lingo push --wait for source changes, and preserve accepted targets before a whole-file forced refresh. Fixed text belongs in resources marked translatable="false"; CLI lockedKeys are not Android resource controls.

The handler retains the source's plural categories. It does not guarantee the complete set or correct wording for every target locale. Test quantities and formatted variables with the application's resource loader.

Configure and verify Android resources #

Set format: "android" explicitly for .xml CLI sources. XML alone cannot identify the Android resource vocabulary. The GitHub App also accepts the configured kind.

Build the retrieved resources with Android tooling, then open a screen that uses a string, an array, and a plural. Localize an Android app completes that workflow. lingo check reports a changed source or a missing target file, not missing Android resources inside a file.