mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Make info messages more translatable
This commit is contained in:
parent
90b93dda33
commit
035ebff407
@ -403,7 +403,7 @@ class Builder:
|
||||
Store all environment docnames in the canonical format (ie using SEP as
|
||||
a separator in place of os.path.sep).
|
||||
"""
|
||||
logger.info(bold('updating environment: '), nonl=True)
|
||||
logger.info(bold(__('updating environment: ')), nonl=True)
|
||||
|
||||
self.env.find_files(self.config, self)
|
||||
updated = (self.env.config_status != CONFIG_OK)
|
||||
@ -422,7 +422,7 @@ class Builder:
|
||||
if changed:
|
||||
reason = CONFIG_CHANGED_REASON.get(self.env.config_status, '')
|
||||
logger.info('[%s] ', reason, nonl=True)
|
||||
logger.info('%s added, %s changed, %s removed',
|
||||
logger.info(__('%s added, %s changed, %s removed'),
|
||||
len(added), len(changed), len(removed))
|
||||
|
||||
# clear all files no longer present
|
||||
@ -461,7 +461,7 @@ class Builder:
|
||||
|
||||
def _read_serial(self, docnames):
|
||||
# type: (List[str]) -> None
|
||||
for docname in status_iterator(docnames, 'reading sources... ', "purple",
|
||||
for docname in status_iterator(docnames, __('reading sources... '), "purple",
|
||||
len(docnames), self.app.verbosity):
|
||||
# remove all inventory entries for that file
|
||||
self.app.emit('env-purge-doc', self.env, docname)
|
||||
@ -491,12 +491,12 @@ class Builder:
|
||||
tasks = ParallelTasks(nproc)
|
||||
chunks = make_chunks(docnames, nproc)
|
||||
|
||||
for chunk in status_iterator(chunks, 'reading sources... ', "purple",
|
||||
for chunk in status_iterator(chunks, __('reading sources... '), "purple",
|
||||
len(chunks), self.app.verbosity):
|
||||
tasks.add_task(read_process, chunk, merge)
|
||||
|
||||
# make sure all threads have finished
|
||||
logger.info(bold('waiting for workers...'))
|
||||
logger.info(bold(__('waiting for workers...')))
|
||||
tasks.join()
|
||||
|
||||
def read_doc(self, docname):
|
||||
|
@ -403,7 +403,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
the format and resizing the image if necessary/possible.
|
||||
"""
|
||||
ensuredir(path.join(self.outdir, self.imagedir))
|
||||
for src in status_iterator(self.images, 'copying images... ', "brown",
|
||||
for src in status_iterator(self.images, __('copying images... '), "brown",
|
||||
len(self.images), self.app.verbosity):
|
||||
dest = self.images[src]
|
||||
try:
|
||||
|
@ -67,7 +67,7 @@ class ChangesBuilder(Builder):
|
||||
if not changesets:
|
||||
logger.info(bold(__('no changes in version %s.') % version))
|
||||
return
|
||||
logger.info(bold('writing summary file...'))
|
||||
logger.info(bold(__('writing summary file...')))
|
||||
for changeset in changesets:
|
||||
if isinstance(changeset.descname, tuple):
|
||||
descname = changeset.descname[0]
|
||||
|
@ -881,7 +881,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
elif not path.isfile(icontarget):
|
||||
copyfile(path.join(self.confdir, self.config.html_favicon),
|
||||
icontarget)
|
||||
logger.info('done')
|
||||
logger.info(__('done'))
|
||||
except OSError as err:
|
||||
logger.warning(__('cannot copy static file %r'), err)
|
||||
|
||||
|
@ -276,7 +276,7 @@ class LaTeXBuilder(Builder):
|
||||
|
||||
doctree.settings = docsettings
|
||||
docwriter.write(doctree, destination)
|
||||
logger.info("done")
|
||||
logger.info(__("done"))
|
||||
|
||||
def get_contentsname(self, indexfile):
|
||||
# type: (str) -> str
|
||||
|
@ -253,9 +253,9 @@ class Autosummary(SphinxDirective):
|
||||
docname = posixpath.normpath(posixpath.join(dirname, docname))
|
||||
if docname not in self.env.found_docs:
|
||||
if excluded(self.env.doc2path(docname, None)):
|
||||
logger.warning('toctree references excluded document %r' % docname)
|
||||
logger.warning(__('toctree references excluded document %r'), docname)
|
||||
else:
|
||||
logger.warning('toctree references unknown document %r' % docname)
|
||||
logger.warning(__('toctree references unknown document %r'), docname)
|
||||
docnames.append(docname)
|
||||
|
||||
tocnode = addnodes.toctree()
|
||||
@ -288,7 +288,7 @@ class Autosummary(SphinxDirective):
|
||||
try:
|
||||
real_name, obj, parent, modname = import_by_name(name, prefixes=prefixes)
|
||||
except ImportError:
|
||||
logger.warning('failed to import %s' % name)
|
||||
logger.warning(__('failed to import %s'), name)
|
||||
items.append((name, '', '', name))
|
||||
continue
|
||||
|
||||
@ -303,11 +303,11 @@ class Autosummary(SphinxDirective):
|
||||
doccls = get_documenter(self.env.app, obj, parent)
|
||||
documenter = doccls(self.bridge, full_name)
|
||||
if not documenter.parse_name():
|
||||
logger.warning('failed to parse name %s' % real_name)
|
||||
logger.warning(__('failed to parse name %s'), real_name)
|
||||
items.append((display_name, '', '', real_name))
|
||||
continue
|
||||
if not documenter.import_object():
|
||||
logger.warning('failed to import object %s' % real_name)
|
||||
logger.warning(__('failed to import object %s'), real_name)
|
||||
items.append((display_name, '', '', real_name))
|
||||
continue
|
||||
if documenter.options.members and not documenter.check_module():
|
||||
|
@ -179,7 +179,7 @@ def fetch_inventory(app, uri, inv):
|
||||
if hasattr(f, 'url'):
|
||||
newinv = f.url # type: ignore
|
||||
if inv != newinv:
|
||||
logger.info('intersphinx inventory has moved: %s -> %s', inv, newinv)
|
||||
logger.info(__('intersphinx inventory has moved: %s -> %s'), inv, newinv)
|
||||
|
||||
if uri in (inv, path.dirname(inv), path.dirname(inv) + '/'):
|
||||
uri = path.dirname(newinv)
|
||||
@ -214,7 +214,7 @@ def load_mappings(app):
|
||||
if '://' not in inv or uri not in inventories.cache \
|
||||
or inventories.cache[uri][1] < cache_time:
|
||||
safe_inv_url = _get_safe_url(inv)
|
||||
logger.info('loading intersphinx inventory from %s...', safe_inv_url)
|
||||
logger.info(__('loading intersphinx inventory from %s...'), safe_inv_url)
|
||||
try:
|
||||
invdata = fetch_inventory(app, uri, inv)
|
||||
except Exception as err:
|
||||
@ -229,8 +229,8 @@ def load_mappings(app):
|
||||
if failures == []:
|
||||
pass
|
||||
elif len(failures) < len(invs):
|
||||
logger.info("encountered some issues with some of the inventories,"
|
||||
" but they had working alternatives:")
|
||||
logger.info(__("encountered some issues with some of the inventories,"
|
||||
" but they had working alternatives:"))
|
||||
for fail in failures:
|
||||
logger.info(*fail)
|
||||
else:
|
||||
|
@ -16,7 +16,7 @@ from docutils import nodes
|
||||
import sphinx
|
||||
from sphinx import addnodes
|
||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
||||
from sphinx.locale import _
|
||||
from sphinx.locale import _, __
|
||||
from sphinx.pycode import ModuleAnalyzer
|
||||
from sphinx.util import get_full_modname, logging, status_iterator
|
||||
from sphinx.util.nodes import make_refnode
|
||||
@ -158,7 +158,7 @@ def collect_pages(app):
|
||||
|
||||
for modname, entry in status_iterator(
|
||||
sorted(env._viewcode_modules.items()), # type: ignore
|
||||
'highlighting module code... ', "blue",
|
||||
__('highlighting module code... '), "blue",
|
||||
len(env._viewcode_modules), # type: ignore
|
||||
app.verbosity, lambda x: x[0]):
|
||||
if not entry:
|
||||
|
@ -1137,8 +1137,8 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
if self.next_table_colspec:
|
||||
self.table.colspec = '{%s}\n' % self.next_table_colspec
|
||||
if 'colwidths-given' in node.get('classes', []):
|
||||
logger.info('both tabularcolumns and :widths: option are given. '
|
||||
':widths: is ignored.', location=node)
|
||||
logger.info(__('both tabularcolumns and :widths: option are given. '
|
||||
':widths: is ignored.'), location=node)
|
||||
self.next_table_colspec = None
|
||||
|
||||
def depart_table(self, node):
|
||||
|
Loading…
Reference in New Issue
Block a user