mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Make the group title for ebook-convert translatable
This commit is contained in:
parent
8deade288f
commit
b498743bc1
@ -9,6 +9,7 @@ Command line interface to conversion sub-system
|
|||||||
|
|
||||||
import sys, os
|
import sys, os
|
||||||
from optparse import OptionGroup, Option
|
from optparse import OptionGroup, Option
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
from calibre.utils.config import OptionParser
|
from calibre.utils.config import OptionParser
|
||||||
from calibre.utils.logging import Log
|
from calibre.utils.logging import Log
|
||||||
@ -126,14 +127,14 @@ def add_input_output_options(parser, plumber):
|
|||||||
parser.add_option_group(oo)
|
parser.add_option_group(oo)
|
||||||
|
|
||||||
def add_pipeline_options(parser, plumber):
|
def add_pipeline_options(parser, plumber):
|
||||||
groups = {
|
groups = OrderedDict((
|
||||||
'' : ('',
|
('' , ('',
|
||||||
[
|
[
|
||||||
'input_profile',
|
'input_profile',
|
||||||
'output_profile',
|
'output_profile',
|
||||||
]
|
]
|
||||||
),
|
)),
|
||||||
'LOOK AND FEEL' : (
|
(_('LOOK AND FEEL') , (
|
||||||
_('Options to control the look and feel of the output'),
|
_('Options to control the look and feel of the output'),
|
||||||
[
|
[
|
||||||
'base_font_size', 'disable_font_rescaling',
|
'base_font_size', 'disable_font_rescaling',
|
||||||
@ -150,17 +151,17 @@ def add_pipeline_options(parser, plumber):
|
|||||||
'remove_paragraph_spacing_indent_size',
|
'remove_paragraph_spacing_indent_size',
|
||||||
'asciiize', 'keep_ligatures',
|
'asciiize', 'keep_ligatures',
|
||||||
]
|
]
|
||||||
),
|
)),
|
||||||
|
|
||||||
'HEURISTIC PROCESSING' : (
|
(_('HEURISTIC PROCESSING') , (
|
||||||
_('Modify the document text and structure using common'
|
_('Modify the document text and structure using common'
|
||||||
' patterns. Disabled by default. Use %(en)s to enable. '
|
' patterns. Disabled by default. Use %(en)s to enable. '
|
||||||
' Individual actions can be disabled with the %(dis)s options.')
|
' Individual actions can be disabled with the %(dis)s options.')
|
||||||
% dict(en='--enable-heuristics', dis='--disable-*'),
|
% dict(en='--enable-heuristics', dis='--disable-*'),
|
||||||
['enable_heuristics'] + HEURISTIC_OPTIONS
|
['enable_heuristics'] + HEURISTIC_OPTIONS
|
||||||
),
|
)),
|
||||||
|
|
||||||
'SEARCH AND REPLACE' : (
|
(_('SEARCH AND REPLACE') , (
|
||||||
_('Modify the document text and structure using user defined patterns.'),
|
_('Modify the document text and structure using user defined patterns.'),
|
||||||
[
|
[
|
||||||
'sr1_search', 'sr1_replace',
|
'sr1_search', 'sr1_replace',
|
||||||
@ -168,9 +169,9 @@ def add_pipeline_options(parser, plumber):
|
|||||||
'sr3_search', 'sr3_replace',
|
'sr3_search', 'sr3_replace',
|
||||||
'search_replace',
|
'search_replace',
|
||||||
]
|
]
|
||||||
),
|
)),
|
||||||
|
|
||||||
'STRUCTURE DETECTION' : (
|
(_('STRUCTURE DETECTION') , (
|
||||||
_('Control auto-detection of document structure.'),
|
_('Control auto-detection of document structure.'),
|
||||||
[
|
[
|
||||||
'chapter', 'chapter_mark',
|
'chapter', 'chapter_mark',
|
||||||
@ -178,9 +179,9 @@ def add_pipeline_options(parser, plumber):
|
|||||||
'insert_metadata', 'page_breaks_before',
|
'insert_metadata', 'page_breaks_before',
|
||||||
'remove_fake_margins', 'start_reading_at',
|
'remove_fake_margins', 'start_reading_at',
|
||||||
]
|
]
|
||||||
),
|
)),
|
||||||
|
|
||||||
'TABLE OF CONTENTS' : (
|
(_('TABLE OF CONTENTS') , (
|
||||||
_('Control the automatic generation of a Table of Contents. By '
|
_('Control the automatic generation of a Table of Contents. By '
|
||||||
'default, if the source file has a Table of Contents, it will '
|
'default, if the source file has a Table of Contents, it will '
|
||||||
'be used in preference to the automatically generated one.'),
|
'be used in preference to the automatically generated one.'),
|
||||||
@ -189,26 +190,20 @@ def add_pipeline_options(parser, plumber):
|
|||||||
'toc_threshold', 'max_toc_links', 'no_chapters_in_toc',
|
'toc_threshold', 'max_toc_links', 'no_chapters_in_toc',
|
||||||
'use_auto_toc', 'toc_filter', 'duplicate_links_in_toc',
|
'use_auto_toc', 'toc_filter', 'duplicate_links_in_toc',
|
||||||
]
|
]
|
||||||
),
|
)),
|
||||||
|
|
||||||
'METADATA' : (_('Options to set metadata in the output'),
|
(_('METADATA') , (_('Options to set metadata in the output'),
|
||||||
plumber.metadata_option_names + ['read_metadata_from_opf'],
|
plumber.metadata_option_names + ['read_metadata_from_opf'],
|
||||||
),
|
)),
|
||||||
'DEBUG': (_('Options to help with debugging the conversion'),
|
(_('DEBUG'), (_('Options to help with debugging the conversion'),
|
||||||
[
|
[
|
||||||
'verbose',
|
'verbose',
|
||||||
'debug_pipeline',
|
'debug_pipeline',
|
||||||
]),
|
])),
|
||||||
|
|
||||||
|
))
|
||||||
|
|
||||||
}
|
for group, (desc, options) in groups.iteritems():
|
||||||
|
|
||||||
group_order = ['', 'LOOK AND FEEL', 'HEURISTIC PROCESSING',
|
|
||||||
'SEARCH AND REPLACE', 'STRUCTURE DETECTION',
|
|
||||||
'TABLE OF CONTENTS', 'METADATA', 'DEBUG']
|
|
||||||
|
|
||||||
for group in group_order:
|
|
||||||
desc, options = groups[group]
|
|
||||||
if group:
|
if group:
|
||||||
group = OptionGroup(parser, group, desc)
|
group = OptionGroup(parser, group, desc)
|
||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user