From b498743bc16a32fc433538fa0cbf0d7bf56cd618 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Oct 2013 13:45:42 +0530 Subject: [PATCH] Make the group title for ebook-convert translatable --- src/calibre/ebooks/conversion/cli.py | 45 +++++++++++++--------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index 5fbd0c6acf..3d079b9181 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -9,6 +9,7 @@ Command line interface to conversion sub-system import sys, os from optparse import OptionGroup, Option +from collections import OrderedDict from calibre.utils.config import OptionParser from calibre.utils.logging import Log @@ -126,14 +127,14 @@ def add_input_output_options(parser, plumber): parser.add_option_group(oo) def add_pipeline_options(parser, plumber): - groups = { - '' : ('', + groups = OrderedDict(( + ('' , ('', [ 'input_profile', 'output_profile', ] - ), - 'LOOK AND FEEL' : ( + )), + (_('LOOK AND FEEL') , ( _('Options to control the look and feel of the output'), [ 'base_font_size', 'disable_font_rescaling', @@ -150,17 +151,17 @@ def add_pipeline_options(parser, plumber): 'remove_paragraph_spacing_indent_size', 'asciiize', 'keep_ligatures', ] - ), + )), - 'HEURISTIC PROCESSING' : ( + (_('HEURISTIC PROCESSING') , ( _('Modify the document text and structure using common' ' patterns. Disabled by default. Use %(en)s to enable. ' ' Individual actions can be disabled with the %(dis)s options.') % dict(en='--enable-heuristics', dis='--disable-*'), ['enable_heuristics'] + HEURISTIC_OPTIONS - ), + )), - 'SEARCH AND REPLACE' : ( + (_('SEARCH AND REPLACE') , ( _('Modify the document text and structure using user defined patterns.'), [ 'sr1_search', 'sr1_replace', @@ -168,9 +169,9 @@ def add_pipeline_options(parser, plumber): 'sr3_search', 'sr3_replace', 'search_replace', ] - ), + )), - 'STRUCTURE DETECTION' : ( + (_('STRUCTURE DETECTION') , ( _('Control auto-detection of document structure.'), [ 'chapter', 'chapter_mark', @@ -178,9 +179,9 @@ def add_pipeline_options(parser, plumber): 'insert_metadata', 'page_breaks_before', 'remove_fake_margins', 'start_reading_at', ] - ), + )), - 'TABLE OF CONTENTS' : ( + (_('TABLE OF CONTENTS') , ( _('Control the automatic generation of a Table of Contents. By ' 'default, if the source file has a Table of Contents, it will ' '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', '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'], - ), - 'DEBUG': (_('Options to help with debugging the conversion'), + )), + (_('DEBUG'), (_('Options to help with debugging the conversion'), [ 'verbose', 'debug_pipeline', - ]), + ])), + )) - } - - 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] + for group, (desc, options) in groups.iteritems(): if group: group = OptionGroup(parser, group, desc) parser.add_option_group(group)