Skip to content

Use currency-specific decimal separators - #1361

Open
yuefdev wants to merge 1 commit into
python-babel:masterfrom
yuefdev:fix-currency-decimal
Open

yuefdev wants to merge 1 commit into
python-babel:masterfrom
yuefdev:fix-currency-decimal

Conversation

@yuefdev

@yuefdev yuefdev commented Oct 3, 2026

Copy link
Copy Markdown

Fixes #586.

French (Switzerland) defines currencyDecimal = '.', but currency formatting currently uses its ordinary decimal separator, ','. For example, USD 12345.678 renders as 12'345,68 $US instead of 12'345.68 $US.

Use the currency-specific symbol when a currency is supplied to NumberPattern.apply, passing it through fractional formatting. This covers standard, accounting and long-name currency formats, as well as scientific and significant-digit custom patterns. Ordinary decimal formatting keeps the locale's decimal symbol.

Six new regression cases fail before the fix.

Validation:

  • python -m pytest tests/test_numbers.py -q --tb=short --show-capture=no: 137 passed.
  • Ruff lint and the repository's configured pre-commit hooks passed for both changed files.

AI assistance: Codex prepared the fix and tests and ran the automated checks above. No independent human review is claimed.

This branch has not been deployed

No deployments
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.

Support for currencyDecimal

1 participant