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

Allow changing separator of n-number-animation component #2181

Closed
ilyosjon09 opened this issue Jan 14, 2022 · 4 comments · Fixed by #2182
Closed

Allow changing separator of n-number-animation component #2181

ilyosjon09 opened this issue Jan 14, 2022 · 4 comments · Fixed by #2182
Labels
feature request New feature or request

Comments

@ilyosjon09
Copy link

This function solves the problem (这个功能解决的问题)

Currently we can format large numbers with a separator for improving readability. However default separator may look odd for people from Russia or Central Asia since the default number separator in these countries' regional format is a single space. Numbers after comma represents fraction of the number.

So allowing to add custom separator or locale would be beneficial to solve this problem.

Expected API (期望的 API)

<n-number-animation separator=" " />
or
<n-number-animation separator-locale="uz-uz" />
or
<n-number-animation respect-locale-format="true" />

@github-actions github-actions bot added the feature request New feature or request label Jan 14, 2022
@Sepush
Copy link
Collaborator

Sepush commented Jan 14, 2022

make sence,I will give a PR later.You can use it in Next Version.

@07akioni
Copy link
Collaborator

07akioni commented Jan 14, 2022

make sence,I will give a PR later.You can use it in Next Version.

I'm not sure browser can give a reasonable format, if it does that's great. If not we should expose the render method.

@Sepush
Copy link
Collaborator

Sepush commented Jan 14, 2022

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts

new Intl.NumberFormat().formatToParts()

looks great for this
/cc @07akioni

@07akioni
Copy link
Collaborator

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts

new Intl.NumberFormat().formatToParts()

looks great for this /cc @07akioni

Not bad, make sure to notify users compitability.

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

Successfully merging a pull request may close this issue.

3 participants