Add a new translatable string to all locale files (English, Italian, Spanish, Catalan, Chinese). Use when adding user-visible text to the app.
Add a new string resource to all 5 locale files.
| Locale | File |
|---|---|
| English | app/src/main/res/values/strings.xml |
| Italian | app/src/main/res/values-it/strings.xml |
| Spanish | app/src/main/res/values-es/strings.xml |
| Catalan | app/src/main/res/values-ca/strings.xml |
| Chinese | app/src/main/res/values-zh/strings.xml |
Ask the user for:
snake_case, e.g., drive_details_title)Generate translations for Italian, Spanish, Catalan, and Chinese (Simplified)
Add to all 5 files with an XML comment for context:
<!-- Context: Shown as the title of the drive details screen -->
<string name="drive_details_title">Drive Details</string>
snake_case for string names (e.g., settings_title, drive_history)%s, %d, %1$s) must be preserved in translationsone and other should be identical (Chinese does not inflect for number)For strings with parameters, use positional format specifiers:
<string name="distance_km">%1$d km away</string>
In Kotlin:
stringResource(R.string.distance_km, distance)
For quantity strings, use plurals:
<plurals name="days_count">
<item quantity="one">%d day</item>
<item quantity="other">%d days</item>
</plurals>
Remind the user to use stringResource(R.string.xxx) in Compose code:
Text(stringResource(R.string.drive_details_title))