1313from sphinx import addnodes
1414from sphinx .domains .std import make_glossary_term , split_term_classifiers
1515from sphinx .errors import ConfigError
16- from sphinx .locale import __
16+ from sphinx .locale import safe_format
1717from sphinx .locale import init as init_locale
1818from sphinx .transforms import SphinxTransform
1919from sphinx .util import get_filetype , logging
@@ -153,7 +153,7 @@ def compare_references(
153153 old_ref_rawsources = [ref .rawsource for ref in old_refs ]
154154 new_ref_rawsources = [ref .rawsource for ref in new_refs ]
155155 logger .warning (
156- warning_msg . format ( old_ref_rawsources , new_ref_rawsources ),
156+ safe_format ( warning_msg , old_ref_rawsources , new_ref_rawsources ),
157157 location = self .node ,
158158 type = 'i18n' ,
159159 subtype = 'inconsistent_references' ,
@@ -240,10 +240,8 @@ def list_replace_or_append[N: nodes.Node](lst: list[N], old: N, new: N) -> None:
240240 self .compare_references (
241241 old_foot_refs ,
242242 new_foot_refs ,
243- __ (
244- 'inconsistent footnote references in translated message.'
245- ' original: {0}, translated: {1}'
246- ),
243+ 'inconsistent footnote references in translated message.'
244+ ' original: {0}, translated: {1}' ,
247245 )
248246 old_foot_namerefs : dict [str , list [nodes .footnote_reference ]] = {}
249247 for r in old_foot_refs :
@@ -285,10 +283,8 @@ def update_refnamed_references(self) -> None:
285283 self .compare_references (
286284 old_refs ,
287285 new_refs ,
288- __ (
289- 'inconsistent references in translated message.'
290- ' original: {0}, translated: {1}'
291- ),
286+ 'inconsistent references in translated message.'
287+ ' original: {0}, translated: {1}' ,
292288 )
293289 old_ref_names = [r ['refname' ] for r in old_refs ]
294290 new_ref_names = [r ['refname' ] for r in new_refs ]
@@ -315,10 +311,8 @@ def update_refnamed_footnote_references(self) -> None:
315311 self .compare_references (
316312 old_foot_refs ,
317313 new_foot_refs ,
318- __ (
319- 'inconsistent footnote references in translated message.'
320- ' original: {0}, translated: {1}'
321- ),
314+ 'inconsistent footnote references in translated message.'
315+ ' original: {0}, translated: {1}' ,
322316 )
323317 for oldf in old_foot_refs :
324318 refname_ids_map .setdefault (oldf ['refname' ], []).append (oldf ['ids' ])
@@ -335,10 +329,8 @@ def update_citation_references(self) -> None:
335329 self .compare_references (
336330 old_cite_refs ,
337331 new_cite_refs ,
338- __ (
339- 'inconsistent citation references in translated message.'
340- ' original: {0}, translated: {1}'
341- ),
332+ 'inconsistent citation references in translated message.'
333+ ' original: {0}, translated: {1}' ,
342334 )
343335 refname_ids_map : dict [str , list [str ]] = {}
344336 for oldc in old_cite_refs :
@@ -357,10 +349,8 @@ def update_pending_xrefs(self) -> None:
357349 self .compare_references (
358350 old_xrefs ,
359351 new_xrefs ,
360- __ (
361- 'inconsistent term references in translated message.'
362- ' original: {0}, translated: {1}'
363- ),
352+ 'inconsistent term references in translated message.'
353+ ' original: {0}, translated: {1}' ,
364354 # Compare by reftarget only, allowing translated display text.
365355 key_func = lambda ref : ref .get ('reftarget' ),
366356 )
0 commit comments