Skip to content

Improve Serbian Dinar formatting #1124

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

s-mage
Copy link

@s-mage s-mage commented Mar 22, 2025

Hey, thanks for the gem!

I noticed that you want to move to the formatting based on locale by default, and it's a good thing. You still want to support formatting based on the currency, so I thought I'd fix that for RSD.

So, basically the currency formatting is number formatting, currency symbol, and if we want to put the symbol before or after the currency.

Number formatting guidelines are easy to find. Two from the first page of google:

This gives us decimal mark , and separator . (though space is a valid separator as well).

The internet agrees that the symbol should be placed after the number:

Screenshot 2025-03-22 at 14 05 15

As for the symbol, I couldn't be sure and had to find an authority. Found two, Unicode CLDR (that ECMA 402 spec for internationalization API mentions) and my Serbian teacher Borislava who is also a philologist. I also wrote an email to the Institute or Serbian Language, but it's protesting at the moment and won't reply. What's better, Borislava and Unicode agree that your best bet on the symbol is RSD. If the rest of the text is in Serbian and is cyrillic, you will probably be better off using РСД but RSD is still fine since it's also the ISO code, while РСД in latin is wrong.

There is also the amount of digits after the decimal mark. It's correct here and incorrect in the Unicode repo. I wrote to People's bank of Serbia to be sure, they replied (for a change) and yes, there are no coins for Para but they are still used for cashless operations.

All in all, RSD currency-based formatting should be

12.345,42 RSD

This PR changes the currency_iso dataset to make it so.

> Money.locale_backend = :currency
=> :currency
> Money.from_amount(12345.42, "RSD").format
=> "12.345,42 RSD"

Thanks!

Copy link

@mooncitydev mooncitydev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSD stands for

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

Successfully merging this pull request may close these issues.

2 participants