Skip to content

Support locale-defined scales in intword - #433

Open
SAY-5 wants to merge 1 commit into
python-humanize:mainfrom
SAY-5:fix-intword-locale-scales-20261002
Open

SAY-5 wants to merge 1 commit into
python-humanize:mainfrom
SAY-5:fix-intword-locale-scales-20261002

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 2, 2026

Copy link
Copy Markdown

Fixes #181

Changes proposed in this pull request:

  • Let translation catalogs define their own named powers of ten and pluralized number/unit patterns. Match each pattern table to its exact scale vector so an incomplete regional catalog cannot silently inherit labels for different powers.
  • Use the Japanese four-digit scale, so 234909023 becomes 2.3億 and 2349090 becomes 234.9万. Preserve the existing formatting path for catalogs that do not opt in.
  • Document the catalog entries and test real compiled translations, rounding, negative values, regional fallbacks, malformed profiles, locale isolation, and the translation update pipeline.

Validation: 873 ordinary tests passed on Python 3.13; Ruff 0.16.5, Black 26.5.1, Prettier 3.9.6, and mypy passed. The 15 benchmark tests were not run because their plugins were unavailable. A separate bounded timing check measured about 0.16 microseconds of additional overhead for English intword calls.

This uses new opt-in catalog entries and leaves existing unit message IDs in place, keeping the change separate from the placeholder migration in #403. The existing French plural-selection rule and the English decillion/googol gap are unchanged.

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.

intword uses English units regardless of the active localization

1 participant