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
7 changes: 3 additions & 4 deletions sphinx/transforms/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,9 @@ def compare_references(
warning_msg: str,
) -> None:
"""Warn about mismatches between references in original and translated content."""
# FIXME: could use a smarter strategy than len(old_refs) == len(new_refs)
if not self.noqa and len(old_refs) != len(new_refs):
old_ref_rawsources = [ref.rawsource for ref in old_refs]
new_ref_rawsources = [ref.rawsource for ref in new_refs]
old_ref_rawsources = [ref.rawsource for ref in old_refs]
new_ref_rawsources = [ref.rawsource for ref in new_refs]
if not self.noqa and old_ref_rawsources != new_ref_rawsources:
logger.warning(
warning_msg.format(old_ref_rawsources, new_ref_rawsources),
location=self.node,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_intl/test_intl.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ def test_text_inconsistency_warnings(app):
'translated': '\\[\\]',
}
+ warning_fmt
% {
'reftype': 'citation references',
'original': "\\['\\[ref2\\]_'\\]",
'translated': "\\['\\[ref3\\]_'\\]",
}
+ warning_fmt
% {
'reftype': 'references',
'original': "\\['reference_'\\]",
Expand Down
Loading