Repository navigation
Add XCG (Caribbean guilder) alongside ANG - #676
Conversation
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>
DominiqueFlaaa
left a comment
There was a problem hiding this comment.
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:
- 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.
- 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
- give XCG
- ANG after that: keep it as a historic currency, so
Worldwide.currency(code: "ANG")andnumeric_code_for("ANG") == 532keep working for existing data. It just stops being the answer for532.
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).
| 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 |
There was a problem hiding this comment.
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.
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>
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?
data/regions/CW.yml,SX.yml) for now.Cg(CLDR 45 hasCg.) are added asrake/cldr/patch.rbpatches, and the patched data is committed, socldr:data:patch(andbin/test-cldr-rake-tasks) reproduces it. Once worldwide moves to CLDR 45 or later, these patches raiseNotNeededErrorand can be deleted.data/other/currency/mappings/digits.ymlgetsXCG: 2.codes.ymlfor now (with a comment), soCurrencies.alpha_code_for(532)still returns"ANG"andnumeric_code_for("XCG")returnsnil.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")returnsnilandCurrencies.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
Cgsymbol and formatting in en and nl, en and nl names) and that ANG behaves as before.bundle exec rake test,bundle exec rubocopand a full CLDR rake round trip (clean, import, patch, generate, generate_paths) pass locally with no data changes.Checklist
🤖 Generated with Claude Code