Displaying numbers in languages

Hi,

Since Speedy Match was only in English, I displayed numbers in the English format - with commas as thousand separators. For example today it writes:

The total number of active members on the site is 12,221, of which 2,581 members entered the site in the last week.

Now, I translated Speedy Match into other languages, such as French, German, Spanish, Portuguese and Italian. In these languages I still use the same number formatting as in English:

Le nombre total de membres actifs sur le site est 12,221, dont 2,581 membres entrés sur le site au cours de la dernière semaine.
Die Gesamtzahl der aktiven Mitglieder auf der Website beträgt 12,221, von denen 2,581 Mitglieder die Website in der letzten Woche betreten haben.

Is it better to use formats.number_format and display the numbers in each language differently? Or is it OK to keep it this way? I’m specifically asking people who speak languages such as French, German, Spanish, Portuguese, Italian and Dutch. How important it is to change the thousand separators?

Yes, localization rules include also number formatting. This should happen automatically in Django if you configure properly the i18n/l10n infrastructure.

Portuguese speaker here!
We use dot . as the thousand separator and the comma , as the decimal separator.
Having this swapped can cause some confusion depending on the context.
Of course, in this example is clear that the comma is being used as a thousand separator as its not possible to have n “decimal” users on the website.

1 Like

Hi,

Thanks for your suggestion. I tried to use formats.number_format() to format my numbers, however the thousand separators disappeared in all languages:

The total number of active members on the site is 12231, of which 2567 members entered the site in the last week.

What is the correct way to display numbers with thousand separators?

This doc may help you.
Another way is to look directly at the source code for number_format and play around with the arguments.

1 Like

Thank you, I added:

USE_THOUSAND_SEPARATOR = True
NUMBER_GROUPING = 3

and it works for me now.
(NUMBER_GROUPING is not defined for all languages, and the default is 0).