Make the log message more translation-friendly

This commit is contained in:
cocoatomo
2018-02-07 01:06:31 +09:00
parent 7e5974f26c
commit 8969ae40de
2 changed files with 8 additions and 4 deletions

View File

@@ -687,8 +687,10 @@ class Sphinx(object):
"""
if typ == 'read':
attrname = 'parallel_read_safe'
gerund_typ = __("reading")
elif typ == 'write':
attrname = 'parallel_write_safe'
gerund_typ = __("writing")
else:
raise ValueError('parallel type %s is not supported' % typ)
@@ -696,9 +698,9 @@ class Sphinx(object):
allowed = getattr(ext, attrname, None)
if allowed is None:
logger.warning(__("the %s extension does not declare if it is safe "
"for parallel %sing, assuming it isn't - please "
"for parallel %s, assuming it isn't - please "
"ask the extension author to check and make it "
"explicit"), ext.name, typ)
"explicit"), ext.name, gerund_typ)
logger.warning('doing serial %s', typ)
return False
elif not allowed:

View File

@@ -106,7 +106,8 @@ def test_add_is_parallel_allowed(app, status, warning):
app.setup_extension('write_parallel')
assert app.is_parallel_allowed('read') is False
assert app.is_parallel_allowed('write') is True
assert 'the write_parallel extension does not declare' in warning.getvalue()
assert ("the write_parallel extension does not declare if it is safe "
"for parallel reading, assuming it isn't - please ") in warning.getvalue()
app.extensions.pop('write_parallel')
warning.truncate(0) # reset warnings
@@ -119,6 +120,7 @@ def test_add_is_parallel_allowed(app, status, warning):
app.setup_extension('write_serial')
assert app.is_parallel_allowed('read') is False
assert app.is_parallel_allowed('write') is False
assert 'the write_serial extension does not declare' in warning.getvalue()
assert ("the write_serial extension does not declare if it is safe "
"for parallel reading, assuming it isn't - please ") in warning.getvalue()
app.extensions.pop('write_serial')
warning.truncate(0) # reset warnings