mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Mark various strings for translation
This commit is contained in:
parent
543482ae65
commit
450ea92fe3
2
manual/cli-options-header.rst
Normal file
2
manual/cli-options-header.rst
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[options]
|
||||||
|
----------------
|
@ -41,9 +41,10 @@ source_suffix = '.rst'
|
|||||||
master_doc = 'index' if tags.has('online') else 'simple_index' # noqa
|
master_doc = 'index' if tags.has('online') else 'simple_index' # noqa
|
||||||
# kill the warning about index/simple_index not being in a toctree
|
# 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 = ['simple_index.rst'] if master_doc == 'index' else ['index.rst']
|
||||||
|
exclude_patterns.append('cli-options-header.rst')
|
||||||
if tags.has('gettext'): # noqa
|
if tags.has('gettext'): # noqa
|
||||||
# Do not exclude simple_index as its string must be translated. This will
|
# Do not exclude anything as the strings must be translated. This will
|
||||||
# generate a warning about simple_index not being in a toctree, just ignore
|
# generate a warning about the documents not being in a toctree, just ignore
|
||||||
# it.
|
# it.
|
||||||
exclude_patterns = []
|
exclude_patterns = []
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ def source_read_handler(app, docname, source):
|
|||||||
src = re.sub(r'(\s+generated/)en/', r'\1' + app.config.language + '/', src)
|
src = re.sub(r'(\s+generated/)en/', r'\1' + app.config.language + '/', src)
|
||||||
# Sphinx does not call source_read_handle for the .. include directive
|
# Sphinx does not call source_read_handle for the .. include directive
|
||||||
for m in reversed(tuple(include_pat.finditer(src))):
|
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)
|
source_read_handler(app, m.group(1).partition('.')[0], ss)
|
||||||
src = src[:m.start()] + ss[0] + src[m.end():]
|
src = src[:m.start()] + ss[0] + src[m.end():]
|
||||||
source[0] = src
|
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='~'):
|
def render_options(cmd, groups, options_header=True, add_program=True, header_level='~'):
|
||||||
lines = ['']
|
lines = ['']
|
||||||
if options_header:
|
if options_header:
|
||||||
lines = ['[options]', '-'*15, '']
|
lines = ['.. include:: /cli-options-header.rst', '']
|
||||||
if add_program:
|
if add_program:
|
||||||
lines += ['.. program:: '+cmd, '']
|
lines += ['.. program:: '+cmd, '']
|
||||||
for title, desc, options in groups:
|
for title, desc, options in groups:
|
||||||
|
@ -28,7 +28,7 @@ You can also use %prog to run standalone scripts. To do that use it like this:
|
|||||||
{1}
|
{1}
|
||||||
|
|
||||||
Everything after the -- is passed to the script.
|
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('-c', '--command', help=_('Run python code.'))
|
||||||
parser.add_option('-e', '--exec-file', help=_('Run the python code in file.'))
|
parser.add_option('-e', '--exec-file', help=_('Run the python code in file.'))
|
||||||
parser.add_option('-f', '--subset-font', action='store_true', default=False,
|
parser.add_option('-f', '--subset-font', action='store_true', default=False,
|
||||||
|
@ -17,7 +17,7 @@ from calibre.ebooks.lrf.meta import LRFMetaFile
|
|||||||
from calibre import prints
|
from calibre import prints
|
||||||
from calibre.utils.date import parse_date
|
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.
|
Read/Write metadata from/to ebook files.
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ def tweak_polish(container, actions, customization=None):
|
|||||||
|
|
||||||
def option_parser():
|
def option_parser():
|
||||||
from calibre.utils.config import OptionParser
|
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'])
|
r'<.*?>', '', CLI_HELP['about'])
|
||||||
parser = OptionParser(usage=USAGE)
|
parser = OptionParser(usage=USAGE)
|
||||||
a = parser.add_option
|
a = parser.add_option
|
||||||
|
@ -27,7 +27,7 @@ class AbortInit(Exception):
|
|||||||
|
|
||||||
def option_parser():
|
def option_parser():
|
||||||
parser = _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
|
Launch the main calibre Graphical User Interface and optionally add the ebook at
|
||||||
path_to_ebook to the database.
|
path_to_ebook to the database.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user