Android Resource file (xml)
Android string resources are stored in XML files under the res/values/ directory. The default file at res/values/strings.xml contains base-language strings. Language overrides go in language-qualified directories: res/values-fr/strings.xml for French, res/values-de/strings.xml for German. Android's resource manager selects the correct file at runtime based on device locale and falls back to the default if a specific translation is missing.
Each string resource is an XML element inside the resources root. Simple strings use the string element with a name attribute. Format specifiers for interpolated values follow printf conventions: percent-s for strings, percent-d for integers, and positional percent-1-dollar-s for reorderable arguments. String arrays use the string-array element with item children. Quantity strings — for grammatically correct plural forms — use the plurals element with quantity attribute children covering the plural categories required by each target language.
Best practice: use lowercase snake_case for all resource names prefixed by feature area to prevent collisions. Avoid hardcoded strings in layout XML — use resource references. Run Android Lint's MissingTranslation and ExtraTranslation checks in CI. Provide all plural categories required by your target languages, not just one and other. Arabic requires six categories, Polish requires four. Language Monster detects strings.xml files across all res/values-* directories and handles plurals elements and string-array elements correctly.
