Skip to content

Add XCG (Caribbean guilder) alongside ANG - #676

Merged
rochlefebvre merged 4 commits into
mainfrom
add-xcg-currency
Nov 10, 2026
Merged

rochlefebvre merged 4 commits into
mainfrom
add-xcg-currency

Conversation

@rochlefebvre

@rochlefebvre rochlefebvre commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What are you trying to accomplish?

Define the XCG (Caribbean guilder) currency. XCG replaced the Netherlands Antillean guilder (ANG) in Curaçao and Sint Maarten on 2025-03-31, at 1 ANG = 1 XCG (ISO 4217 list one: XCG, numeric 532, 2 minor units).

What approach did you choose and why?

  • ANG is kept, and it stays the default currency for CW and SX (data/regions/CW.yml, SX.yml) for now.
  • XCG is defined manually, not through a CLDR update; the CLDR update will come later. worldwide is on CLDR 41, and CLDR added XCG in version 45. The en and nl names and the root symbol Cg (CLDR 45 has Cg.) are added as rake/cldr/patch.rb patches, and the patched data is committed, so cldr:data:patch (and bin/test-cldr-rake-tasks) reproduces it. Once worldwide moves to CLDR 45 or later, these patches raise NotNeededError and can be deleted.
  • data/other/currency/mappings/digits.yml gets XCG: 2.
  • Numeric code: ISO 4217 gives XCG the numeric code 532, which ANG also has. XCG is left out of codes.yml for now (with a comment), so Currencies.alpha_code_for(532) still returns "ANG" and numeric_code_for("XCG") returns nil.

Open question for reviewers

Should XCG get a numeric code? ISO 4217 gives XCG 532, the code ANG also has. This PR leaves XCG without one, so Currencies.numeric_code_for("XCG") returns nil and Currencies.alpha_code_for(532) still returns "ANG". If XCG gets 532 as well, alpha_code_for(532) has to choose one of the two, and the "no two currencies use the same numeric code" test would need an exception for this pair. Thoughts welcome.

Testing

New tests check that XCG is recognized (code, decimals, the Cg symbol and formatting in en and nl, en and nl names) and that ANG behaves as before. bundle exec rake test, bundle exec rubocop and a full CLDR rake round trip (clean, import, patch, generate, generate_paths) pass locally with no data changes.

Checklist

  • I have added a CHANGELOG entry for this change

🤖 Generated with Claude Code

rochlefebvre and others added 2 commits November 6, 2026 13:16
Curaçao and Sint Maarten replaced the Netherlands Antillean guilder (ANG)
with the Caribbean guilder (XCG) on 2025-03-31, at 1:1. worldwide is on
CLDR 41 and CLDR only added XCG in version 45, so worldwide doesn't
recognize XCG yet.

Add XCG by hand until worldwide upgrades CLDR:

- rake/cldr/patch.rb patches add the en and nl names and the CLDR 45
  root symbol (Cg.). The patched data is committed, so cldr:data:patch
  reproduces it. Upgrading to CLDR 45 or later makes these patches raise
  NotNeededError, and they can then be deleted.
- digits.yml gets XCG: 2.
- XCG stays out of codes.yml. ISO 4217 gives it numeric code 532, the
  code ANG uses, and listing both would make alpha_code_for(532) return
  XCG instead of ANG.

ANG is unchanged and stays the default currency for CW and SX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use Cg rather than CLDR 45's "Cg." for the XCG symbol, so XCG formats
as Cg12.50 in en. Only root carries the symbol; en, nl and every other
locale inherit it. Add an nl assertion to show that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rochlefebvre
rochlefebvre marked this pull request as ready for review November 6, 2026 18:43
@rochlefebvre
rochlefebvre requested a review from a team as a code owner November 6, 2026 18:43

@IrynLoza IrynLoza left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!

@DominiqueFlaaa DominiqueFlaaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re: numeric code. I think leaving XCG without a numeric code is fine for this PR, as long as we plan the full switch soon.

ISO has already moved 532 to XCG. In the current ISO 4217 List One, 532 belongs only to XCG (Curaçao and Sint Maarten). ANG is on List Three (historic), withdrawn 2025-03. So after this PR, Currencies.alpha_code_for(532) still returns a currency ISO calls withdrawn. That's OK for a short transition, but it shouldn't stay that way.

Why leaving XCG out of codes.yml is the safer first step: NUMERIC_THREE_TO_ALPHA_THREE_DB is built with to_h, so when two entries share a key, the last one wins. If we just added XCG: "532", alpha_code_for(532) would quietly start returning "XCG" because of where XCG sits in the file, not because we chose it. Leaving it out only leaves a gap (numeric_code_for("XCG") is nil). Nothing that works today changes.

Suggested path:

  1. This PR: add XCG, keep ANG as the default for CW and SX, and give XCG no numeric code. It's additive and easy to revert.
  2. Follow-up:
    • give XCG 532
    • make alpha_code_for(532) return "XCG" through an explicit override, not hash order
    • switch the CW and SX defaults to XCG
    • replace the "no two currencies share a numeric code" test with one that allows a withdrawn currency to share its code with its successor
  3. ANG after that: keep it as a historic currency, so Worldwide.currency(code: "ANG") and numeric_code_for("ANG") == 532 keep working for existing data. It just stops being the answer for 532.

For reference, the public money gem already gives both ANG and XCG iso_numeric: '532' (it has no reverse lookup, so the overlap doesn't cause a problem there).

Comment thread data/cldr/locales/en/currencies.yml Resolved
three_digit_code: "958"
XCD:
three_digit_code: "951"
# XCG (Caribbean guilder) has ISO numeric code 532, which it shares with ANG, the currency it replaced in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking into the history of this file, I don't think it's been updated since it was first introduced. You're probably ok to leave it unchanged, and maybe consider a follow-up to remove the code that reads this and this file, I don't think anything is using it.

rochlefebvre and others added 2 commits November 9, 2026 10:40
Add XCG to es as "florín caribeño" (one) and "florines caribeños"
(other), the strings CLDR has carried in common/main/es.xml since
release 45. The data generation step fills in the "many" form from
"other", as it does for every es currency. es-419, es-MX and the other
Spanish locales inherit these names, as they do in CLDR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLA workflow run for 0aee582 ended in startup_failure and cannot be
retried, so the required cla check never reported. This empty commit
starts a fresh pull_request_target run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rochlefebvre
rochlefebvre merged commit 6956f06 into main Nov 10, 2026
6 checks passed
@rochlefebvre
rochlefebvre deleted the add-xcg-currency branch November 10, 2026 15:25
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.

4 participants