diff --git a/manual/custom.py b/manual/custom.py index e9d10ed09e..984302eee8 100644 --- a/manual/custom.py +++ b/manual/custom.py @@ -72,6 +72,12 @@ CLI_PREAMBLE='''\ {usage} ''' +def titlecase(app, x): + if x and app.config.language == 'en': + from calibre.utils.titlecase import titlecase as tc + x = tc(x) + return x + def generate_calibredb_help(preamble, app): from calibre.library.cli import COMMANDS, get_parser import calibre.library.cli as cli @@ -86,7 +92,7 @@ def generate_calibredb_help(preamble, app): global_parser = get_parser('') groups = [] for grp in global_parser.option_groups: - groups.append((grp.title, grp.description, grp.option_list)) + groups.append((titlecase(app, grp.title), grp.description, grp.option_list)) global_options = '\n'.join(render_options('calibredb', groups, False, False)) @@ -114,7 +120,7 @@ def generate_calibredb_help(preamble, app): for group in parser.option_groups: if not getattr(group, 'is_global_options', False): lines.extend(render_options( - 'calibredb_' + cmd, [[group.title, group.description, group.option_list]], False, False, header_level='^')) + 'calibredb_' + cmd, [[titlecase(app, group.title), group.description, group.option_list]], False, False, header_level='^')) lines += [''] raw = preamble + '\n\n'+'.. contents::\n :local:'+ '\n\n' + global_options+'\n\n'+'\n'.join(lines) @@ -132,7 +138,7 @@ def generate_ebook_convert_help(preamble, app): groups = [(None, None, parser.option_list)] for grp in parser.option_groups: if grp.title not in {'INPUT OPTIONS', 'OUTPUT OPTIONS'}: - groups.append((grp.title.title(), grp.description, grp.option_list)) + groups.append((titlecase(app, grp.title), grp.description, grp.option_list)) options = '\n'.join(render_options('ebook-convert', groups, False)) raw += '\n\n.. contents::\n :local:'