FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Preserve apostrophes in quoted number patterns by Boulea7 · Pull Request #1380 · python-babel/babel · GitHub

Repository navigation

Preserve apostrophes in quoted number patterns - #1380

Open
Boulea7 wants to merge 1 commit into
python-babel:masterfrom
Boulea7:fix/number-pattern-apostrophes
Open

Boulea7 wants to merge 1 commit into
python-babel:masterfrom
Boulea7:fix/number-pattern-apostrophes

Conversation

Boulea7 commented Oct 11, 2026

Copy link
Copy Markdown

Doubled apostrophes inside quoted affixes are currently lost: format_decimal(1, "0'kg''s'", locale="en_US") returns 1kgs instead of 1kg's. Unquoting the complete output also removes the ASCII grouping separators from format_decimal(1234567, "#,##0", locale="fr_CH"), producing 1234567 instead of 1'234'567.

Unquote the selected prefix and suffix separately from the generated number, preserving the existing currency-substitution order. Regression tests cover quoted positive and negative affixes, currency placeholders, and apostrophe grouping.

Validation on Python 3.11 with CLDR 48.2: numbers tests (151 passed), full suite (7851 passed, 7 skipped, 2 xfailed), Ruff, and an installed-wheel smoke test.

Decode doubled apostrophes inside quoted pattern affixes and unquote
the selected prefix and suffix separately from generated number symbols.
This preserves ASCII apostrophe grouping in locales such as fr_CH.

Keep currency substitution before unquoting, and cover quoted affixes,
grouping, and adjacent currency placeholders with regression tests.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL