format translatable strings in one go. This enables translation tools like msgfmt to verify that an incorrect translation cannot crash sphinx-build. This will fix current crashes for Hungarian and Greek (Spanish was fixed in #8941)

This commit is contained in:
Ask Hjorth Larsen 2021-03-03 19:52:49 +01:00
parent 99d97c65d5
commit cf85d3afd1

View File

@ -168,14 +168,13 @@ class ReferencesResolver(SphinxPostTransform):
if self.app.emit_firstresult('warn-missing-reference', domain, node):
return
elif domain and typ in domain.dangling_warnings:
msg = domain.dangling_warnings[typ]
msg = domain.dangling_warnings[typ] % {'target': target}
elif node.get('refdomain', 'std') not in ('', 'std'):
msg = (__('%s:%s reference target not found: %%(target)s') %
(node['refdomain'], typ))
msg = (__('%s:%s reference target not found: %s') %
(node['refdomain'], typ, target))
else:
msg = __('%r reference target not found: %%(target)s') % typ
logger.warning(msg % {'target': target},
location=node, type='ref', subtype=typ)
msg = __('%r reference target not found: %s') % (typ, target)
logger.warning(msg, location=node, type='ref', subtype=typ)
class OnlyNodeTransform(SphinxPostTransform):