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

RTL not working #93

Open
robert-barahona opened this issue Jan 9, 2025 · 1 comment
Open

RTL not working #93

robert-barahona opened this issue Jan 9, 2025 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@robert-barahona
Copy link

NumberFlow version

0.5.1

Framework version

18.3.1

Describe the bug and the steps to reproduce it

Hi, I'm using NumberFlow to render the big value, as you can see in the screenshot, the currency symbol is in the wrong position, since the Arabic language is RTL, the symbol should be on the left, like the other values I am displaying in my app without NumberFlow (Left values on the screenshot)

Screenshot 2025-01-09 at 16 59 07

I tried with dir="rtl" in the NumberFlow component but didn't work

Minimal reproduction (greatly appreciated)

No response

@barvian
Copy link
Owner

barvian commented Jan 13, 2025

Hi, thanks for filing. This seems pretty complex, unfortunately. Intl.NumberFormat.formatToParts(), the API that powers NumberFlow, returns RTL entities like &rtl; instead of ordering the parts as they'd appear in RTL. I can't use these entities in the markup directly because they don't work when each part is inline-block, which is required for the animation. I could use the entities to rearrange the parts manually, aka reimplement the browser's RTL algorithm, but that gets pretty crazy when e.g. negative numbers are involved. I'm also not sure where to even start with something like that, so I noted this as a limitation on the docs for now and I'm open to suggestions if anybody has some 👋

@barvian barvian added the help wanted Extra attention is needed label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants