Repository navigation
Fix the en currency data - #3335
Merged
Merged
Conversation
Three kinds of problem in lib/locales/en/currency.yml, all from the ISO
4217 table it was taken from years ago.
Rows where a country uses two currencies were read as one entry, so the
second currency lost its code and its name was glued onto the first:
INR "Indian Rupee Ngultrum" BTN was dropped
ZAR "Rand Loti" LSL was dropped
ZAR "Rand Namibia Dollar" NAD was dropped
HTG "Gourde US Dollar"
PAB "Balboa US Dollar"
SVC "El Salvador Colon US Dollar"
BOB "Boliviano Mvdol"
CLP "Chilean Peso Unidades de fomento"
COP "Colombian Peso Unidad de Valor Real"
CUP "Cuban Peso Peso Convertible"
MXN "Mexican Peso Mexican Unidad de Inversion (UDI)"
UYU "Peso Uruguayo Uruguay Peso en Unidades Indexadas"
Faker::Currency.name could therefore return "Rand Namibia Dollar", which
is not a currency, and ZAR and INR were drawn two and three times as
often as any other code. Each name now holds one currency, and BTN, LSL
and NAD are listed in their own right; the fund and index units that
shared the other rows stay out, as they are not currencies anyone holds.
Eight codes have a successor:
ANG -> XCG 2025-03-31 SLL -> SLE 2022-04-01
BYR -> BYN 2016-07-01 STD -> STN 2018-01-01
MRO -> MRU 2018-01-01 VEF -> VES 2018-08-20
ZMK -> ZMW 2013-01-01 ZWL -> ZWG 2024-04-05
and six were withdrawn without one: BGN, EEK, HRK, LTL and LVL when those
countries adopted the euro, and XFU when the UIC franc was discontinued
in 2013. SSP, in circulation since 2011, was never listed.
Spelling drift against the current ISO names (AWG "Aruban Guilder" for
"Aruban Florin", PEN "Nuevo Sol" for "Sol", and nineteen more) is left
alone here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jremes-foss
approved these changes
Oct 13, 2026
jremes-foss
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Thank you for your contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclosure: prepared with AI assistance (Claude Opus 5 via Claude Code) — the diff against the ISO 4217 list, the patch, the tests and this description.
What is wrong
lib/locales/en/currency.ymlwas taken from the ISO 4217 table some years ago and has three kinds of problem.Rows listing two currencies were read as one entry. The second currency lost its code and its name was glued onto the first:
INRIndian Rupee NgultrumBTNZARRand LotiLSLZARRand Namibia DollarNADHTGGourde US DollarUSDalready listed)PABBalboa US DollarSVCEl Salvador Colon US DollarBOBBoliviano MvdolCLPChilean Peso Unidades de fomentoCOPColombian Peso Unidad de Valor RealCUPCuban Peso Peso ConvertibleMXNMexican Peso Mexican Unidad de Inversion (UDI)UYUPeso Uruguayo Uruguay Peso en Unidades IndexadasSo
Faker::Currency.namecan return"Rand Namibia Dollar", which is not a currency, and becauseZARandINRappear three and two times,Faker::Currency.codereturns them that much more often than any other code.Each name now holds one currency, and
BTN,LSLandNADare listed in their own right. The fund and index units that shared the other rows (BOV,CLF,COU,MXV,UYI, andCUC, withdrawn in 2021) stay out — the list has never held them, and they are not currencies anyone holds.Eight codes have a successor:
ANG→XCGSLL→SLEBYR→BYNSTD→STNMRO→MRUVEF→VESZMK→ZMWZWL→ZWGSix were withdrawn without one:
BGN,EEK,HRK,LTL,LVLwhen those countries adopted the euro (2026, 2011, 2023, 2015, 2014), andXFUwhen the UIC franc was discontinued in 2013.SSP, in circulation since 2011, was never listed.169 entries become 164.
Out of scope
Spelling drift against the current ISO names —
AWGisAruban Guilderwhere ISO now saysAruban Florin,PENisNuevo Solwhere ISO saysSol, and nineteen more. Those are readable as they are, so I left them; happy to follow up if you want them aligned.Tests
Two new cases in
test_faker_currency.rb: codes must be unique, and no name may be another name followed by a second one. They fail onmainwithduplicated currency codes: INR, ZARandnames holding two currencies: Indian Rupee Ngultrum, Rand Loti, Rand Namibia Dollar, and pass here.Full suite:
2181 tests, 281843 assertions, 0 failures, 0 errors.rubocopclean on the changed test file.