Skip to content

Fix Spanish large number translations to use long scale#302

Merged
hugovk merged 2 commits intopython-humanize:mainfrom
sedat4ras:fix/es-large-number-translations
Mar 24, 2026
Merged

Fix Spanish large number translations to use long scale#302
hugovk merged 2 commits intopython-humanize:mainfrom
sedat4ras:fix/es-large-number-translations

Conversation

@sedat4ras
Copy link
Copy Markdown
Contributor

Fixes #101

Problem

Spanish uses the long scale numbering system, where billón = 10^12 (not 10^9). The previous translations were phonetic mappings from English short scale names, producing incorrect output for Spanish speakers:

humanize.intword(12_345_591_313)
# Before: '12.3 billones'  ← wrong (billones = 10^12 in Spanish)
# After:  '12.3 miles de millones'  ← correct

Correct mappings (English short scale → Spanish long scale)

English Value Before After
billion 10^9 billón / billones mil millones / miles de millones
trillion 10^12 trillón / trillones billón / billones
quadrillion 10^15 quatrillón / quatrillones mil billones / miles de billones
quintillion 10^18 quintillón / quintillones trillón / trillones
sextillion 10^21 sextillón / sextillones mil trillones / miles de trillones
septillion 10^24 septillón / septillones cuatrillón / cuatrillones
octillion 10^27 octillón / octillones mil cuatrillones / miles de cuatrillones
nonillion 10^30 nonillón / nonillones quintillón / quintillones
decillion 10^33 decillón / decillones mil quintillones / miles de quintillones

Changes

  • src/humanize/locale/es_ES/LC_MESSAGES/humanize.po

Spanish uses the long scale numbering system, where 'billón' means
10^12 (not 10^9 as in English). The previous translations were direct
phonetic mappings from English short scale names, which are incorrect
for Spanish speakers.

Correct mappings (English short scale → Spanish long scale):
- billion  (10^9)  → mil millones / miles de millones
- trillion (10^12) → billón / billones
- quadrillion (10^15) → mil billones / miles de billones
- quintillion (10^18) → trillón / trillones
- sextillion (10^21) → mil trillones / miles de trillones
- septillion (10^24) → cuatrillón / cuatrillones
- octillion (10^27) → mil cuatrillones / miles de cuatrillones
- nonillion (10^30) → quintillón / quintillones
- decillion (10^33) → mil quintillones / miles de quintillones

Fixes python-humanize#101
@hugovk hugovk added the changelog: Fixed For any bug fixes label Mar 23, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.53%. Comparing base (85bb7e7) to head (dcde67a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #302   +/-   ##
=======================================
  Coverage   99.53%   99.53%           
=======================================
  Files          11       11           
  Lines         868      868           
=======================================
  Hits          864      864           
  Misses          4        4           
Flag Coverage Δ
macos-latest 97.46% <ø> (ø)
ubuntu-latest 97.46% <ø> (ø)
windows-latest 95.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hugovk hugovk changed the title fix(i18n): correct Spanish large number translations to use long scale Fix Spanish large number translations to use long scale Mar 23, 2026
@hugovk
Copy link
Copy Markdown
Member

hugovk commented Mar 23, 2026

Thanks for the PR!

Please could you fix the tests?

Update test expectations to match new long scale translations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hugovk hugovk merged commit ad74ae2 into python-humanize:main Mar 24, 2026
43 checks passed
@hugovk
Copy link
Copy Markdown
Member

hugovk commented Mar 24, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Fixed For any bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The translation for billion (and others) is wrong in Spanish

2 participants