Come tradurre¶
This is the guide for adding a language to the watch app. "Come tradurre" is Italian for "how to translate".
What you translate¶
The English source is android/wear/src/main/res/values/strings.xml. It has 200 translatable <string> entries and 4 <plurals>, plus 6 entries marked translatable="false" (app_name, model_3, model_y, channel_ble, channel_cloud, temperature) that stay as they are.
Do not edit values/, values-it/ or values-es/. Spanish landed in #45 and is a good shape to look at.
Steps¶
- Copy
values/strings.xmltovalues-xx/strings.xml, wherexxis the Android language code (pt,nl,nb,pl, ...). - Translate every
<string>and<plurals>that is nottranslatable="false". - Keep each
name, every placeholder and the plural quantities exactly as in English. The placeholders in use are%1$s,%1$d,%1$.1f,%1$.2f,%1$.0f,%2$.0f,%2$s,%3$s,%4$sand%d. A wrong placeholder crashes the formatted text at runtime. -
Check it from
android/:./gradlew :wear:lintPublicReleaseIn
android/wear/build.gradle.kts,MissingTranslation,ExtraTranslation,StringFormatMatchesandStringFormatInvalidare errors.HardcodedStringsTestonly compares English with Italian, so lint is what covers a new language. 5. On a watch or emulator set to your language, walk through onboarding, the home screen, hold to confirm and Settings, and add screenshots to the pull request.
Languages that need a volunteer¶
| Language | Issue |
|---|---|
German (values-de) |
#23 |
French (values-fr) |
#24 |
Portuguese (values-pt) |
#46 |
Dutch (values-nl) |
#47 |
Norwegian Bokmål (values-nb) |
#48 |
Polish (values-pl) |
#49 |
Another language? Open an issue first, or just send the pull request.
More¶
- CONTRIBUTING.md, the full rules for pull requests.
- All good first issues.
- The Contributors page.