Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions babel/messages/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def python_format(catalog: Catalog | None, message: Message) -> None:
if msgstrs[0]:
_validate_format(msgids[0], msgstrs[0])
if message.pluralizable:
if msgstrs[0] and len(msgstrs) == 1:
_validate_format(msgids[1], msgstrs[0])
for msgstr in msgstrs[1:]:
if msgstr:
_validate_format(msgids[1], msgstr)
Expand Down
2 changes: 1 addition & 1 deletion tests/messages/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ class TestPythonFormat:
(('foo %s', 'bar'), ('foo')),
(('foo %s', 'bar %d'), ('foo %s', 'bar %d', 'baz')),
(('foo %s', 'bar %d'), ('foo %s', 'bar %d', 'baz %d', 'qux')),
(('foo', 'bar %s'), ('foo')),
])
def test_python_format_invalid(self, msgid, msgstr):
msg = Message(msgid, msgstr)
Expand All @@ -351,7 +352,6 @@ def test_python_format_invalid(self, msgid, msgstr):
('foo %s', ''),
(('foo %s', 'bar %d'), ('foo %s', 'bar %d')),
(('foo %s', 'bar %d'), ('foo %s', 'bar %d', 'baz %d')),
(('foo', 'bar %s'), ('foo')),
(('foo', 'bar %s'), ('', '')),
(('foo', 'bar %s'), ('foo', '')),
(('foo %s', 'bar %d'), ('foo %s', '')),
Expand Down
Loading