● Set up · 9 languages
Localization
9 languages, one more is easy.
The app, the widgets, the push texts and the Automatic summary come in English, German, Spanish, French, Portuguese, Arabic, Hindi, Indonesian and Turkish.
01Languages and where their texts live
| Part | Files |
|---|---|
| App screens | app/lib/l10n/app_<code>.arb. English is the template, generated from app/tool/gen_en_arb.py. |
| Android widgets | app/android/app/src/main/res/values-<code>/ct_widget_strings.xml (Indonesian uses values-in) |
| iOS widgets | app/ios/CryptoTrackerWidget/<code>.lproj/ |
| iOS language list | CFBundleLocalizations in app/ios/Runner/Info.plist |
| Push texts for alerts, Automatic summary, disclaimer | firebase/functions/src/api/i18n.ts (server-side templates) |
| AI brief and reports | Generated in the requested language by the AI provider |
The app follows the phone's language, or the language chosen in Settings. Arabic is laid out right to left.
02Change a text
- EnglishEdit the entry in
app/tool/gen_en_arb.pyand runpython3 tool/gen_en_arb.pyinapp/. It rewriteslib/l10n/app_en.arb. - Other languagesEdit the same key in
lib/l10n/app_<code>.arb. - Regenerate
flutter gen-l10n(it also runs automatically onflutter pub getand on every build, becausegenerate: trueis set inpubspec.yaml). - Check
flutter test test/l10n_parity_test.dartchecks that every language has every key.
Texts that the operator controls (the disclaimer, the AI, automatic, sponsored and affiliate labels, the Pro perks, the affiliate disclosure, the Buy button) are set in the console and shown as entered.
03Add a language
- App textsCopy
app/lib/l10n/app_en.arbtoapp_<code>.arb, set"@@locale"and translate every value. Keep the placeholders in braces, like{time}. - Language pickerAdd the code to
appLanguagesinapp/lib/state/app_state.dartand its name tolanguageNamesinapp/lib/ui/screens/settings_screen.dart. - WidgetsAdd
values-<code>/ct_widget_strings.xmlon Android and<code>.lprojon iOS; add the code toCFBundleLocalizationsand toLANGUAGESinapp/ios/scripts/add_widget_extension.rb, then run the script. - BackendAdd the code to
APP_LANGSinfirebase/functions/src/api/defaults.tsand a dictionary with every key tofirebase/functions/src/api/i18n.ts, then deploy the functions. Until then the backend answers that language in English (parseLangfalls back toen). - Test
flutter testinapp/andnpm testinfirebase/functions.