Localize numbers using Unicode CLDR

Localize numbers and dates using the data of Unicode CLDR.
Sorry to be nitpicky.

Right now on de_DE locale, it 1000 returns as 1 000 instead of 1.000!
image
which should be returning as:
image

and on Spanish locales, instead of this:
image
This would be better (but with Player2 and Player1 order switched):
image
To solve this problem, use the Unicode CLDR for number formatting on leaderboards.
Roblox have many advantages of using CLDR of localizing numbers:

  • CLDR is used by Google, Facebook, Microsoft, etc.
  • CLDR has names of countries, language and scripts too.
  • CLDR provides pluralisation for many locales.
    etc.

Something like this would be great:

ICU.FormatNumber(1000, 'en_US')
ICU.FormatNumber(1000, 'es_ES')
ICU.FormatNumber(10000, 'es_ES')

1,000
1000
10.000

2 Likes

I disagree on locking this to the locale. It should be a user preference (but the locale can be used to pick a good default).

See:

I would counter-argue that numbers are part of the language.
If you prefer reading from right-to-left but your country reads it from left-to-right, should choosing what reading dicrtion be an option?
What about choosing colour or colour should that be a user preference too? What if one’s country spells Japan as 日本国 but prefer to spell it as 日本國, should kanji variants be tied to a locale or be a user prefrence?
What about choosing long vs short scale numbers, should that be a user preference too?
Date formats?
Using dots in language that only uses comma as a decimal separator wouldn’t be correct and I don’t think should be displayed it that way if it isn’t considered correct even if one user don’t prefer it.
Even if a language has multiple notation preferences it’s usually by region so you could change the territory part.

  • es_419 uses . as decimal and , for grouping
  • es_ES uses , as decimal and . for grouping

I’ve clearly outlined a use case above where I am a non-English user of which the locale would normally give me comma-delimited decimals, but I want dot-delimited decimals.

If Roblox starts forcing me the wrong notation, I don’t want to have to figure out what locale I need to undo it. It should be a separate preference for UX reasons.

Numbers aren’t language, and dates aren’t language either. Both number and date formats should be preferences (with sensible defaults). The language-specific differences are part of the language, number/date formats are not as tied to the language.

1 Like