Watch And Earn docs
v3.1.0
Live demoConsole demo Get help
● Set up · Localization

Languages
nine built in, add your own.

The app ships in English, Spanish, Portuguese, French, German, Hindi, Indonesian, Turkish and Arabic (right-to-left). It follows the language of the user's device. Adding a language means one translated file and a rebuild.

9 languagesArabic RTLARB files

01Languages in the package

LanguageFile
English (template)app/lib/l10n/app_en.arb
Spanishapp_es.arb
Portugueseapp_pt.arb
Frenchapp_fr.arb
Germanapp_de.arb
Hindiapp_hi.arb
Indonesianapp_id.arb
Turkishapp_tr.arb
Arabic, right-to-leftapp_ar.arb

Each file has the same 454 text keys. app/test/l10n_parity_test.dart fails if one of the 9 languages is missing a key, has an extra one, or drops a placeholder such as {points}.

Plurals. Counts such as "1 day this month", the games left today and achievement goals use ICU plural messages in every language, so a count of 1 reads correctly (app/test/plurals_test.dart). In Arabic the profile tab is labelled "ملفي".

Which language a user sees: the app has no language picker. Flutter picks the device language when the app supports it, and English otherwise (supportedLocales in app/lib/app.dart). For Arabic, Flutter mirrors the layout right-to-left automatically. The lucky wheel and the scratch card stay left-to-right on purpose.

Error messages: when the server refuses an action, it sends a short reason token (details.reason, for example ad_cap or insufficient_points), and the app shows the translated text for it (app/lib/ui/widgets/common.dart). The server's English sentence is never shown when a translation exists.

02What is not translated by these files

  • Content you enter in the console, such as quiz questions, task titles, offers, sponsor copy, store item titles, events and push campaigns. It is stored once and shown as you typed it. If you serve several languages, write it in the language most of your users read, or keep it short and neutral.
  • The points notice (console → Legal): while you keep the default text, the app shows it translated into the user's language, in all 9 languages. A text you write yourself is shown as written. The same goes for Name of the points: the default points is translated, your own word is shown as written.
  • The operator console is in English.
  • Store listings are written in Play Console and App Store Connect, per language.

03Change a text

Open the ARB file of the language, change the value and keep the key. Keep every placeholder in braces exactly as it is. Flutter regenerates app_localizations*.dart on the next flutter pub get or build (generate: true in pubspec.yaml, settings in app/l10n.yaml).

cd app
flutter pub get          # regenerates lib/l10n/app_localizations*.dart
flutter test test/l10n_parity_test.dart
Keep the meaning of the points texts

In every language, points must stay a score with no cash value. Do not translate "points" as money, coins of value or a currency. app/test/no_cash_out_test.dart also scans the ARB files for words such as "paypal", "withdraw", "payout", "cash out", "redeem" and "gift card".

04Add a language

  1. Copy the English fileCopy app/lib/l10n/app_en.arb to app_<code>.arb, using the language code, e.g. app_it.arb for Italian.
  2. Set the localeChange "@@locale": "en" on line 2 to your code, e.g. "@@locale": "it".
  3. Translate the valuesTranslate every value, leave the keys and the placeholders. The @key entries are descriptions for translators. Only the English template needs them.
  4. Generate and testRun flutter pub get and flutter test test/l10n_parity_test.dart. Flutter adds the language to supportedLocales by itself.
  5. iOSAdd the language code to CFBundleLocalizations in app/ios/Runner/Info.plist and to knownRegions in project.pbxproj (see below).

05iOS: declared languages

Flutter's localization guide asks iOS apps to list their languages in Info.plist under CFBundleLocalizations. The App Store also reads this list to show which languages your app supports. The package already declares all 9 languages: CFBundleLocalizations in app/ios/Runner/Info.plist and knownRegions in app/ios/Runner.xcodeproj/project.pbxproj both list them. app/test/ios_localizations_test.dart fails if Info.plist and the ARB files disagree:

<key>CFBundleLocalizations</key>
<array>
  <string>en</string><string>es</string><string>pt</string>
  <string>fr</string><string>de</string><string>hi</string>
  <string>id</string><string>tr</string><string>ar</string>
</array>

When you add a language, add its code to both lists. If you remove a language, remove it from both as well.