Mark various strings for translation

This commit is contained in:
Kovid Goyal 2016-03-03 22:51:38 +05:30
parent 543482ae65
commit 450ea92fe3
7 changed files with 11 additions and 8 deletions

View File

@ -0,0 +1,2 @@
[options]
----------------

View File

@ -41,9 +41,10 @@ source_suffix = '.rst'
master_doc = 'index' if tags.has('online') else 'simple_index' # noqa
# kill the warning about index/simple_index not being in a toctree
exclude_patterns = ['simple_index.rst'] if master_doc == 'index' else ['index.rst']
exclude_patterns.append('cli-options-header.rst')
if tags.has('gettext'): # noqa
# Do not exclude simple_index as its string must be translated. This will
# generate a warning about simple_index not being in a toctree, just ignore
# Do not exclude anything as the strings must be translated. This will
# generate a warning about the documents not being in a toctree, just ignore
# it.
exclude_patterns = []

View File

@ -26,7 +26,7 @@ def source_read_handler(app, docname, source):
src = re.sub(r'(\s+generated/)en/', r'\1' + app.config.language + '/', src)
# Sphinx does not call source_read_handle for the .. include directive
for m in reversed(tuple(include_pat.finditer(src))):
ss = [open(m.group(1)).read().decode('utf-8')]
ss = [open(m.group(1).lstrip('/')).read().decode('utf-8')]
source_read_handler(app, m.group(1).partition('.')[0], ss)
src = src[:m.start()] + ss[0] + src[m.end():]
source[0] = src
@ -176,7 +176,7 @@ def update_cli_doc(name, raw, app):
def render_options(cmd, groups, options_header=True, add_program=True, header_level='~'):
lines = ['']
if options_header:
lines = ['[options]', '-'*15, '']
lines = ['.. include:: /cli-options-header.rst', '']
if add_program:
lines += ['.. program:: '+cmd, '']
for title, desc, options in groups:

View File

@ -28,7 +28,7 @@ You can also use %prog to run standalone scripts. To do that use it like this:
{1}
Everything after the -- is passed to the script.
''').format('%prog [options]', '%prog myscript.py -- --option1 --option2 file1 file2 ...'))
''').format(_('%prog [options]'), '%prog myscript.py -- --option1 --option2 file1 file2 ...'))
parser.add_option('-c', '--command', help=_('Run python code.'))
parser.add_option('-e', '--exec-file', help=_('Run the python code in file.'))
parser.add_option('-f', '--subset-font', action='store_true', default=False,

View File

@ -17,7 +17,7 @@ from calibre.ebooks.lrf.meta import LRFMetaFile
from calibre import prints
from calibre.utils.date import parse_date
USAGE='%%prog ebook_file [' + _('options') + ']\n' + \
USAGE=_('%%prog ebook_file [' + _('options') + ']\n') + \
_('''
Read/Write metadata from/to ebook files.

View File

@ -263,7 +263,7 @@ def tweak_polish(container, actions, customization=None):
def option_parser():
from calibre.utils.config import OptionParser
USAGE = '%prog [options] input_file [output_file]\n\n' + re.sub(
USAGE = _('%prog [options] input_file [output_file]\n\n') + re.sub(
r'<.*?>', '', CLI_HELP['about'])
parser = OptionParser(usage=USAGE)
a = parser.add_option

View File

@ -27,7 +27,7 @@ class AbortInit(Exception):
def option_parser():
parser = _option_parser(_('''\
%prog [opts] [path_to_ebook]
%prog [options] [path_to_ebook]
Launch the main calibre Graphical User Interface and optionally add the ebook at
path_to_ebook to the database.