DEV Community

abdellahi agha
abdellahi agha

Posted on

Shipping a Flutter app in 13 languages, 3 of them right-to-left: what actually bit us

Our app is a money ledger for people and small shops around the world, and our users write in Arabic, Persian, Urdu, Hindi, Chinese and more, often switching languages in the same sentence. Today it ships in 13 languages: Arabic, Persian and Urdu (right-to-left), plus English, French, Spanish, German, Hindi, Indonesian, Portuguese, Russian, Turkish and Chinese.

Flutter's localization tooling got us 80% of the way quickly. This post is about the other 20%: the things that looked fine in English and broke the moment a user switched to Arabic.

1. One rule that saved us: no hardcoded strings, ever

We use the standard gen-l10n setup: ARB files in lib/i18n, English as the template, a generated AppLocalizations class. The English file currently holds about 1,850 keys.

The setup is easy. The discipline is the hard part. Our rule is strict: every user-visible string goes through an ARB key, and a new key must be added to all 13 ARB files before the code that uses it is merged. A string that exists only in English is a bug, not a TODO, because the fallback hides it from every developer who works in English.

2. Fonts don't cascade the way you think

We bundle two fonts: Noto Sans for Latin and Cyrillic, and Cairo as the fallback for Arabic script. Our first attempt set fontFamily once on ThemeData and moved on.

It didn't hold. Several built-in widget themes (list tiles, for example) didn't consistently pick up the family, so Arabic text in some places rendered with a different fallback than the rest of the screen. The fix was boring but reliable: one constant for the family and its fallback list, passed explicitly to every raw TextStyle in our theme file, instead of trusting the cascade.

3. Numbers inside right-to-left text

This is the bug that users notice first. In an Arabic sentence like "you owe 1,250.00 to Ahmed", the bidirectional algorithm can move the minus sign, the currency or the separators to the wrong side, so an amount reads differently from what it is. In a finance app that's not cosmetic.

What worked for us:

  • Isolate every amount. When an amount or a count is embedded in a sentence, we wrap it in Unicode directional isolates (⁦ … ⁩, LRI/PDI) so it is laid out as its own left-to-right unit regardless of the surrounding text.
  • Force LTR where the content is inherently LTR. Amount fields, phone numbers and IDs get an explicit TextDirection.ltr. We have a few dozen of these, each one a bug report we didn't want to receive twice.

4. Digits are a user preference, not a locale fact

We first assumed Arabic UI means Arabic-Indic digits (١٢٣٤). Many of our Arabic-speaking users disagree: some use Latin digits (1234) every day, others expect Arabic-Indic, and Persian has its own digit shapes (۱۲۳۴). The interface language alone doesn't tell you which one a person reads comfortably.

So digit script is a setting with three options (Latin, Arabic-Indic, Persian). The app suggests one based on the interface language, but the user decides. Thousands separators are a separate setting, so "1,234.56" and "1234.56" are both available.

A small migration lesson here: an older version stored "Arabic digits" inside the number-format setting. When we split digit script into its own setting, we had to migrate that old value on startup, or users would have silently lost their choice after updating.

5. Fewer languages, done properly

We once shipped 16 languages, including three West African ones: Pulaar, Wolof and Soninke. They mattered to us, because they're spoken by millions of people that most apps never serve in their own language.

Then a review showed that our Wolof and Soninke files contained a lot of Pulaar text. For low-resource languages, machine translation and even well-meaning help can quietly mix closely related languages, and none of us could verify the result by reading it.

We retired those three and moved affected users to their phone's language (or English) automatically. It was a hard call. But a wrong translation in a finance app is worse than none: people make decisions based on these labels. We'd rather bring those languages back with native-speaker review than keep shipping text we can't vouch for.

6. Let users report bad translations

Translations go stale, and no team reads 13 languages. So the app has a "Language correction" entry in settings that lets users send us a fix for a string they found wrong. It's a tiny feature that turns users into reviewers.

7. Checklist we now run for every screen

  • Switch the device to Arabic and walk the screen. Look for icons that should mirror (back arrows, chevrons) and ones that shouldn't (play buttons, charts' time axis).
  • Find every number in a sentence and check it's isolated.
  • Check the longest translation (German and Russian usually) for overflow.
  • Check that dates and digits follow the user's setting, not just the locale.

Wrapping up

None of this is exotic, but each item cost us a bug report from a real user before we learned it. If you're starting a Flutter app that might ever support Arabic, Persian or Urdu, build with RTL on from day one; retrofitting it later is far more expensive.

The app is Amunta, a ledger for expenses and debts, with a separate edition that helps small shops and projects anywhere run their business from phones, built in Nouakchott, Mauritania. How do you handle numbers inside RTL text in your apps? I'd love to compare notes in the comments.

https://amunta.pixun.dev/

Top comments (1)

Collapse
 
ahmedspurs profile image
Ahmed Adil Abuzaid •

point 4 is so real, digits being a user preference and not a locale thing took me way too long to learn 😅
to answer your question: for numbers inside arabic text (ticket codes, phone numbers, amounts) we wrap the ltr part in unicode isolates U+2066…U+2069 instead of LRM/RLM, they dont leak direction into the words around them. and for receipts/tables we just put numbers in their own widget with TextDirection.ltr