Call `AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags("fr"))` with AppCompat 1.6.0 or newer. Android 13+ stores the choice in the system; on older versions enable `autoStoreLocales` in the manifest. The old `Configuration` and `updateConfiguration()` hacks are deprecated.
It is lint's ExtraTranslation check. A string exists in a `values-xx` folder but not in the default `res/values` folder. Add the default string or delete the stray translation; if it is intentional, suppress it with `tools:ignore="ExtraTranslation"` on that string.
`Locale.getDefault()` returns the locale your app is running in, including a per-app language. `AppCompatDelegate.getApplicationLocales()` tells whether a per-app language is set (empty means follow the system), and on Android 13+ `LocaleManager.getSystemLocales()` gives the device language.
MissingTranslation is a lint check, not a compiler error, and a missing translation falls back to the default string at runtime. Mark strings `translatable="false"`, add `tools:ignore="MissingTranslation"` to one string or file, or disable the check in `lint.xml` or Gradle.
Put positional placeholders such as `%1$s` and `%2$d` in the string resource and pass the values as format arguments to `getString()` or Compose's `stringResource()`. For counts, use quantity strings so every language gets the right plural form.
Write `%%` when the string is formatted with arguments through `getString(id, args)` or Compose's `stringResource(id, args)`. A string that is never formatted can keep a plain `%`; add `formatted="false"` when aapt2 warns about multiple non-positional substitutions.
Use `values-<lang>` (ISO 639-1), `values-<lang>-r<REGION>` such as `values-pt-rBR`, or the BCP 47 form `values-b+<lang>+<script>+<region>` such as `values-b+sr+Latn`. For Chinese, name folders by script, `values-b+zh+Hans` and `values-b+zh+Hant`, rather than by region.
The `<xliff:g>` tag marks a part of a string that translators must not change, such as a `%1$s` placeholder, a product name or a code. Declare `xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"` on `<resources>`; aapt2 drops the tag when compiling, so it costs nothing at runtime.