Using Arabic (123) numerals in Arabic localization

Hey!

Currently, Unreal uses Eastern-Arabic numerals (٠ ١ ٢) when switching to an Arabic culture (we use `ar`, in our case).

However, in digital media, most people in Arabic-speaking countries use Arabic numerals (123...):

Western Arabic numerals (0–9): Commonly used in the Maghreb region and in modern digital contexts (phones, computers, programming). Eastern Arabic numerals (٠–٩): More commonly used in the Levant and Gulf regions in books, newspapers, and official Arabic documents.

This is also way better for readability, as there’s no confusion between commas, dots, and Eastern-Arabic zeroes.

[Image Removed]How can we stop Unreal from switching the numerals and use 123... for numbers in a specific locale, without losing any other regional/cultural formatting conventions?

Steps to Reproduce

  1. Switch the game or the editor, for that matter, to Arabic.
  2. See ٠ ١ ٢… instead of 123... for numbers

We seem to have tracked it down to a couple of places:

1. `Engine\Source\ThirdParty\ICU\icu4c-53_1\source\data\locales` → `ar.txt` → `NumberElements` → default{“arab”} — this is set to “latn” in some other ar-*** locales, where we see 123... numerals.

[Image Removed]I could change this to “latn” for the `ar` locale, but I have no idea if that’s the right place to change it and how to make this change affect the game.

2. `ICUCulture.cpp`, it even has some overrides from ICU defaults for Spanish.

`FDecimalNumberFormattingRules ExtractNumberFormattingRulesFromICUDecimalFormatter(icu::Locale& InICULocale, icu::DecimalFormat& InICUDecimalFormat)`

[Image Removed]Then again, I guess we could also override the digits in `Text.cpp` / `FText FText::AsNumberTemplate` before passing it on to the formatting function, to stay away from the guts of the internationalization code?

***

Any clarity from you guys on how to do it in the best way would be nice.

Hi,

Similar to the Spanish override there, we added a CVar for this in 5.4:

Localization.UseLocaleSpecificDigitCharactersIf you’re on an older engine version at the moment, you can grab CL# 27852750 and set that CVar to false. That should be a pretty straightforward change to cherrypick, but let us know if you run into any issues.

Best,

Cody

Thank you! That will switch them off for all locales that use them, right? For now, we’re only sure about Arabic (but not Persian, for example).

I guess we’ll just go with some manual overrides in ICUCulture for now.

Hi,

That will indeed force Western Arabic numerals for all locales, so you’d need to toggle it when switching locales if you want to support locale-specific digits for some languages.

Thank you!

For now, we ended up patching the ICUCulture with an exception for Arabic, both for numerals and group/decimal separators.

We’ll see if turning the CVar on and off when we switch to specific locales will make more sense when we upgrade to 5.4 and have that code anyway.