Skip to content

Use a comma as the fr_FR decimal separator - #378

Open
ckarnell wants to merge 1 commit into
python-humanize:mainfrom
ckarnell:fix-fr-decimal-separator
Open

Use a comma as the fr_FR decimal separator#378
ckarnell wants to merge 1 commit into
python-humanize:mainfrom
ckarnell:fix-fr-decimal-separator

Conversation

@ckarnell

Copy link
Copy Markdown

fr_FR is the only entry in _DECIMAL_SEPARATOR with a dot. Every other locale there pairs a group separator with a comma, including hu_HU and lv, which group with a space exactly like French does.

humanize.i18n.activate("fr_FR")
humanize.intcomma(1_234_567.89)   # "1 234 567.89", want "1 234 567,89"
humanize.intword(1_000)           # "1.0 mille",    want "1,0 mille"

You already worked this out in #357: the dot came from #248, and merwok said French needs the comma. That PR was closed by its author before it landed. So the value is still there.

One line of data. Plus the 26 fr_FR expectations that encoded the old output.

naturalsize is deliberately untouched, and it is the one loose end. filesize.py never reads the separator, so it still prints 42.0 Ko while intcomma now prints a comma. #357 tried to fix both together and picked up a 10% performance report on the bundle, so this leaves that half alone. Happy to send it separately if you want it, and it's a fair reason to hold this one.

Tests are 789 passing before and after, same set. Reverting just the i18n.py line fails exactly the 26 updated expectations and nothing else, so the tests are pinned to the change, not to the diff.

fr_FR was the only locale in the table pairing a group separator with a
dot decimal mark. French uses the comma, so intcomma and intword printed
1 234 567.89 instead of 1 234 567,89.

naturalsize is unchanged because filesize.py does not read the separator.
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