Skip to content

Add Caribbean Guilder (XCG)#1123

Merged
cade merged 4 commits intoRubyMoney:mainfrom
MathijsK93:caribbean-guilder
Apr 29, 2025
Merged

Add Caribbean Guilder (XCG)#1123
cade merged 4 commits intoRubyMoney:mainfrom
MathijsK93:caribbean-guilder

Conversation

@MathijsK93
Copy link
Contributor

@MathijsK93 MathijsK93 commented Mar 19, 2025

In this PR we're adding the Caribbean Guilder currency

https://en.wikipedia.org/wiki/Caribbean_guilder

@MathijsK93 MathijsK93 changed the title Add Caribbean Guilder (XGG) Add Caribbean Guilder (XCG) Mar 19, 2025
@kocasp
Copy link

kocasp commented Mar 20, 2025

This is becoming quite urgent

@MathijsK93
Copy link
Contributor Author

This is becoming quite urgent

In the meantime you can add an initializer:

# frozen_string_literal: true

require "money"

caribbean_guilder = {
  priority:              100,
  iso_code:              "XCG",
  name:                  "Caribbean Guilder",
  symbol:                "Cg",
  alternate_symbols:     [],
  subunit:               "Cent",
  subunit_to_unit:       100,
  symbol_first:          true,
  html_entity:           "",
  decimal_mark:          ",",
  thousands_separator:   ".",
  iso_numeric:           "532",
  smallest_denomination: 1

}
Money::Currency.register(caribbean_guilder)

"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR has , for decimal and . for thousands, but this PR has the opposite. I don't see anything on the linked wikipedia article or a cursory web search to clearly support either of these. Can you explain the formatting choice here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's indeed not a lot documentation available. I have chosen to re-use it from ANG:

"ang": {
"priority": 100,
"iso_code": "ANG",
"name": "Netherlands Antillean Gulden",
"symbol": "ƒ",
"alternate_symbols": ["NAƒ", "NAf", "f"],
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "ƒ",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "532",
"smallest_denomination": 1
},

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, makes sense. Thanks for clarifying!

Copy link
Contributor

Choose a reason for hiding this comment

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

The Caribbean guilder is a special case because it's the official currency for two countries: Sint Maarten and Curaçao. In Sint Maarten they default to English style formatting (e.g. Cg 1,000.00) and in Curaçao they default to European style formatting (e.g. Cg 1.000,00).

An example of localised Cg formatting with Carrefour in Sint Maarten (left) and Curaçao (right):

Carrefour prices in Sint Maarten Carrefour prices in Curaçao

It's probably fine to keep the configuration as is. Out of curiosity I've reached out to their Central Bank to see what they recommend as a default. While the Money (AFAIK) gem doesn't have something out of the box like Intl.NumberFormat that gives the correct format given a locale, one can still configure the formatting for this special currency programatically when working with locales.

Copy link
Contributor

@cade cade left a comment

Choose a reason for hiding this comment

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

Thank you!

@cade cade merged commit f32ecde into RubyMoney:main Apr 29, 2025
5 checks passed
@pereira-sidnei-tp
Copy link

Hi!

I would like to know whether this patch will be released anytime soon? 😃

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.

7 participants