Fintech Apps and the Positive Currency Formatter

RTL, what’s up with that

Even thou there are (roughly) only 450 million people (1, 2) use RTL scripts (out of 7,8 billion people in the world) = 5%, it is important to properly support it.

Xcode Scheme Editor
iOS Setting app on iPhone 8 simulator
Sheldon Cooper: I’m glad you asked
TBBT
  • U+00A0: NO-BREAK SPACE (a \u{00a0} in Swift)
  • U+200E: LEFT-TO-RIGHT MARK
  • U+200F: RIGHT-TO-LEFT MARK
  • U+061C: ARABIC LETTER MARK

[NS]NumberFormatter

Even thou [NS]NumberFormatter doesn’t support currency format with a positive prefix sign, here’s the first latest & greatest solution on how to have this format: for a positive amount just negate it, then let the NumberFormatter to format it and then replace a minus sign with a plus.

nl_NL

For the Netherlands a positive and negative amount of 123,45 Euro would be properly formatted in this way:

"€\(nbsp)−123,45"
"€\(nbsp)+123,45"
"$\(nbsp)−123,65"
"$\(nbsp)+123,65"

en_US

For the US — amount of 123,45 US dollars would be like:

"−$123.45"
"+$123.45"
-₪123.45
+₪123.45

ru_RU

For Russia — amount of 123,45 Russian rubles:

"−123,45\(nbsp)₽"
"+123,45\(nbsp)₽"
"−123,45\(nbsp)$"
"+123,45\(nbsp)$"

The UI

What that mean for app UI? If you’re developing a bank app for EU customers, most probably you’ll only format currencies in the nl_NL or similar way. For US — in the en_US way. For Russia — ru_RU. There’s no need of different format if everyone use your default locale as well.

he_IL

A 123,45 USD but fromatted for the Israeli UI:

"\(rtlMark)\(ltrMark)−123.45\(nbsp)$" // -123.65 $
"\(rtlMark)\(ltrMark)+123.45\(nbsp)$" // +123.65 $
"\(rtlMark)\(ltrMark)−123.45\(nbsp)\(ILS)" // -123.65 ₪
"\(rtlMark)\(ltrMark)+123.45\(nbsp)\(ILS)" // +123.65 ₪

ar_AE

A 123,45 USD but fromatted for the Arabic UAE user interface:

"\(ltrMark)−$\(nbsp)123.45" // -$ 123
"\(ltrMark)+$\(nbsp)123.45" // +$ 123
"\(ltrMark)−\(AED)\(rtlMark)\(nbsp)123.45" // -123.45 \aed
"\(ltrMark)+\(AED)\(rtlMark)\(nbsp)123.45" // +123.45 \aed

ar_QA

A 123,45 USD for Arabic UI in Qatar:

"\(u061c)−\(arabic_123_45)\(nbsp)US$") // ١٢٣٫٦٥- US$
"\(u061c)+\(arabic_123_45)\(nbsp)US$") // ١٢٣٫٦٥+ US$
"\(u061c)—\(arabic_123_45)\(nbsp)\qar"
"\(u061c)+\(arabic_123_45)\(nbsp)\qar"

Conclusion

With all that said, as a senior iOS engineer, I may suggest you never use this kind of number formatter in the wild. Seriously. It is so much better to re-design your app UI and UX to avoid this kind of things which you never know would be turned on into what.

What Proper Bank App UI Looks Like for LRT and RTL locales

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store