Skip to content

Testing localized apps

FlutterProbe tests are written once and have to survive translation. This page is the playbook, in the order of what to reach for first.

#key selectors (a ValueKey, a Semantics(identifier:)) and widget types do not change with the language:

test "save"
tap #save_button
see #saved_banner

Use visible text only when you really want to check what the user reads.

Text selectors are a case-sensitive substring by default. Run with --match-loose (or defaults.match: loose in probe.yaml) to compare after folding case, accents and other diacritics, typographic apostrophes and dashes, full-width forms, invisible characters and whitespace, on both sides:

Script says Screen shows Match
anderungen SPEICHERN Änderungen speichern yes (loose)
don't allow Don’t Allow yes (loose)
cafe creme Café Crème yes (loose)
Save save yes (loose), no (exact)

Marks that carry meaning (Indic vowel signs, Thai tone marks) are kept, so words in those scripts are not merged. #key selectors are never folded.

When the label differs per language, list them: see any of "Save", "Speichern", "Guardar", wait until any of "Welcome", "Willkommen". For exact text use see "0 ml" matching "^0 ml$".

4. System dialogs in the device’s language

Section titled “4. System dialogs in the device’s language”

Permission alerts are drawn in the device language. Their buttons are resolved by role (allow, deny, allow once, allow while using), so the script you write in English works on a German or Japanese device. On iOS that covers the 55 locales of the iOS 26.5 runtime; on Android the stock permission controller’s resource ids work in any language (OEM permission screens without those ids are not covered). OK, cancel, not now, open and close are known only in English, so use the exact label for them there. deny permission "notifications" answers the notification alert by its Allow and Don’t Allow labels; it has not been run against a real notification alert in every language:

tap "Don't Allow" in system dialog # finds "Nicht erlauben", "許可しない", ...
deny permission "notifications"
dismiss system dialog # declines a permission or tracking alert, in the device's language

On Android the roles come from the language-independent resource ids of the stock permission controller (OEM permission screens without those ids are not covered); on iOS from a table of labels for the 55 locales of the iOS 26.5 runtime, read from the system’s own localization strings (allow, deny including the App Tracking Transparency decline, allow once, allow while using). Measured on real simulators for allow, deny, allow once and allow while using in 27 of those languages: English, German, French, Spanish, Italian, Portuguese (BR), Dutch, Swedish, Danish, Norwegian (Bokmål), Finnish, Polish, Czech, Turkish, Russian, Ukrainian, Greek, Hebrew, Arabic, Hindi, Thai, Vietnamese, Indonesian, Japanese, Korean, Chinese (Simplified and Traditional). The other 28 locales come from the runtime strings only and are not measured on a device. The App Tracking Transparency decline was checked live on a simulator in English, German, French, Japanese and Arabic. The ok, cancel, not now, open and close roles are known only in English: in another language, use the exact label. dismiss system dialog declines a permission or tracking alert in the 55 iOS locales, because its decline is a deny button, but it does not know other cancel buttons in other languages. An exact label of the device always wins over a role.

set language "de" # relaunch the app in German
see "Einstellungen"
set language "ar" # right-to-left: the layout flips with the locale
set language "system" # remove the override again

or for a whole run:

Terminal window
probe test tests/ --locale de-DE # one language
probe test tests/ --locales de,ja,ar -o reports/r.json # the suite once per language

--locales starts one probe test per language (fresh app launch and agent connection each), prints a pass/fail table and writes reports/r.de.json, reports/r.ja.json, … — each report records its language. A failing language fails the command.

How it works: Android 13+ (API 33) uses per-app locales (cmd locale set-app-locales); an iOS simulator gets -AppleLanguages/-AppleLocale launch arguments on every launch of the app. Only the app language changes: the device language stays, so system dialogs keep their labels — which is why dialog buttons are matched by role. Physical iOS devices are not supported (change the language in Settings > Apps > your app).

Instead of writing “Speichern” in every language, point probe at the ARB files Flutter’s gen_l10n already uses and name the key:

probe.yaml
l10n:
dir: lib/l10n # app_en.arb, app_de.arb, app_pt_BR.arb, ...
default: en # fallback language and the language before any set language
test "settings in every language"
see l10n "title"
tap l10n "saveButton"
set language "de"
wait until l10n "title" appears # waits for "Einstellungen"

l10n "key" works wherever a quoted string does (tap, see, wait until, in "container", relational anchors). The language is the one the run or the last set language selected; a region falls back to its base language (de-AT -> de) and then to l10n.default. A language of an ARB file comes from its @@locale entry or its name (app_pt_BR.arb).

Before anything touches a device, probe checks that every key used in the files resolves for the run language, the languages of every set language "x", and l10n.default — a typo or a key missing from a translation fails the run up front, naming the key and language. Messages with ICU placeholders (Hello {name}) or plurals are rejected, since the text on screen differs from the template: use the literal text there.

See the plan in docs/proposals/i18n-multi-language.md: testing against backend responses, and ARB messages with placeholders/plurals are on the roadmap.