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

"n" format specifier does not respect locale #14

Open
karelkral opened this issue Mar 3, 2020 · 3 comments
Open

"n" format specifier does not respect locale #14

karelkral opened this issue Mar 3, 2020 · 3 comments

Comments

@karelkral
Copy link

String.Format with "n" specifier does not respect current locale settings.
In our country, there is a thousand separator " ". In your library is hardcoded thousand separator ".".
Please use settings from the current locale.

const formatted: string = String.Format("{0:n}", 10000);
returns "10.000"
whould return "10 000" with cs-CZ locale.

@karelkral karelkral changed the title "n" format specifier does not respects locale "n" format specifier does not respect locale Mar 3, 2020
@iwt-svenulrich
Copy link
Collaborator

iwt-svenulrich commented Mar 3, 2020

Hey @karelkral, thank you for your feedback! I will take care of that asap!

@aequi42
Copy link
Collaborator

aequi42 commented Mar 5, 2020

Maybe Intl.NumberFormat would suffice as a lightweight solution.

console.log(new Intl.NumberFormat().format(123456.789))

outputs (de)

"123.456,789"

@karelkral
Copy link
Author

Yes, it is a good workaround for this simple case.

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

No branches or pull requests

3 participants