Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatNumber() ignores current language convention while formatting numbers #2951

Closed
rob006 opened this issue Jul 2, 2021 · 2 comments · Fixed by #3099
Closed

formatNumber() ignores current language convention while formatting numbers #2951

rob006 opened this issue Jul 2, 2021 · 2 comments · Fixed by #3099

Comments

@rob006
Copy link
Contributor

rob006 commented Jul 2, 2021

Polish language uses space as thousands separator, so 100000 should be formatted as 100 000. But it looks like formatNumber() has really simple implementation with hardcoded comma as separator:

https://github.com/flarum/core/blob/d4e3254395fa03a0653218a543e23ad9de76ae77/js/src/common/utils/formatNumber.ts#L9-L11

It may be a good idea to switch to something like Intl.NumberFormat or toLocaleString() instead - both new Intl.NumberFormat('pl').format(number) and number.toLocaleString('pl') returns correct format.

@wolfgang-demeter
Copy link

I second that! In Germany it should read 100.000, and not 100,000.

@askvortsov1
Copy link
Sponsor Member

If this is already included in browsers, the fix should be quite easy and shouldn't have a bundle size cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants