Repository navigation
Ignore strings inside subscripts when extracting messages - #1367
Kayvan-Zahiri wants to merge 1 commit into
Conversation
pgettext(context, dictionary["key"]) treated the subscript key as the message. Strings inside brackets or braces are not arguments. Co-authored-by: Cursor <cursoragent@cursor.com>
|
There is an extraction-abort case when an invalid message immediately follows a translator comment: # Translators: note
_(["ignored"])
_("kept")With The base completes extraction. At the recorded #1396 head, the public wrapper skips the invalid message and yields Credit to denyshon, Kayvan-Zahiri and Cherith1222 for the report and existing work. Codex-assisted recorded checks used Python 3.12.14, base |
Fixes #1335.
pgettext(context, dictionary["key"])extracted"key". A dict literal in the same position was extracted too ({"msgid": "value"}becamemsgidvalue). Those strings are not arguments of the call.Strings inside
[]or{}are skipped. A nestedgettext()call is still extracted, andpgettext("navigation", "Guide")is unchanged.Tests:
PYTHONPATH=. python -m pytest --noconftest -o addopts= tests/messages/test_extract.py -q→ 12 passed. Before the fix, the new test extractedkeyandmsgidvalue.Made with Cursor