Repository navigation
Fix compatibility checks for scientific float placeholders - #1446
Open
liugedragon wants to merge 1 commit into
Open
liugedragon wants to merge 1 commit into
liugedragon wants to merge 1 commit into
Conversation
chrikrah
approved these changes
Nov 9, 2026
chrikrah
left a comment
Contributor
There was a problem hiding this comment.
@liugedragon %e and %E join the float group, nothing else moves. Fine to merge from my side.
# git archive a3c5b31 (base a18709c), Python 3.12, CLDR imported, babel.__file__ from the export
$ python -m pytest -q tests
6922 passed, 1219 skipped, 1 xfailed
# python_format(None, Message("v %.2e", "w %.3f")) at a18709c
TranslationError: incompatible format for placeholder 1: 'e' and 'f' are not compatible
# t.po: one python-format entry, msgid "v %.2e", msgstr "w %.3f"
$ msgfmt --version | head -1
msgfmt (GNU gettext-tools) 1.0
$ msgfmt --check-format -o /dev/null t.po; echo exit=$?
exit=0
GNU msgfmt already accepts %e against %f.
This branch has not been deployed
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
python_format()rejects valid translations such as%e→%Eand%f→%e. The placeholder parser recognizes both scientific conversions, but the float compatibility group only containsf/F/g/G.Include
e/Ein that group, matching Python's floating-point percent conversions. Integer, hexadecimal and string conversion groups remain unchanged.Tests cover all six float conversions in positional and named messages, non-float rejection controls, and a plural catalog. Each positive case also formats the same actual float with both strings. Before the fix, 37 of the 85 new cases fail; after it, all pass.
Validation on Windows / Python 3.13.4 after importing the repository's CLDR 49 data:
tests/messages: 555 passed.