From 212cb56d42c99fed589cfa5bde329b7506c3d998 Mon Sep 17 00:00:00 2001 From: gryf Date: Sun, 3 May 2020 19:00:20 +0200 Subject: [PATCH] Removed gettext related functions --- ebook_converter/customize/__init__.py | 30 +- ebook_converter/customize/builtins.py | 178 ++++----- ebook_converter/customize/conversion.py | 22 +- ebook_converter/customize/profiles.py | 135 +++---- ebook_converter/customize/ui.py | 43 ++- ebook_converter/customize/zipplugin.py | 111 ------ ebook_converter/devices/interface.py | 4 +- ebook_converter/ebooks/conversion/cli.py | 98 +++-- .../ebooks/conversion/plugins/chm_input.py | 2 +- .../ebooks/conversion/plugins/comic_input.py | 71 ++-- .../ebooks/conversion/plugins/docx_input.py | 14 +- .../ebooks/conversion/plugins/docx_output.py | 38 +- .../ebooks/conversion/plugins/epub_output.py | 84 +++-- .../ebooks/conversion/plugins/fb2_input.py | 7 +- .../ebooks/conversion/plugins/fb2_output.py | 32 +- .../ebooks/conversion/plugins/html_input.py | 13 +- .../ebooks/conversion/plugins/html_output.py | 10 +- .../ebooks/conversion/plugins/htmlz_input.py | 7 +- .../ebooks/conversion/plugins/htmlz_output.py | 41 +- .../ebooks/conversion/plugins/lrf_output.py | 33 +- .../ebooks/conversion/plugins/mobi_output.py | 64 ++-- .../ebooks/conversion/plugins/pdb_input.py | 6 +- .../ebooks/conversion/plugins/pdb_output.py | 11 +- .../ebooks/conversion/plugins/pdf_input.py | 8 +- .../ebooks/conversion/plugins/pdf_output.py | 99 +++-- .../ebooks/conversion/plugins/pml_output.py | 10 +- .../ebooks/conversion/plugins/rb_output.py | 2 +- .../ebooks/conversion/plugins/recipe_input.py | 21 +- .../ebooks/conversion/plugins/rtf_input.py | 12 +- .../ebooks/conversion/plugins/snb_output.py | 43 ++- .../ebooks/conversion/plugins/tcr_output.py | 4 +- .../ebooks/conversion/plugins/txt_input.py | 120 +++--- .../ebooks/conversion/plugins/txt_output.py | 65 ++-- ebook_converter/ebooks/conversion/plumber.py | 351 ++++++++---------- ebook_converter/ebooks/covers.py | 12 +- ebook_converter/ebooks/docx/container.py | 2 +- ebook_converter/ebooks/docx/to_html.py | 9 +- ebook_converter/ebooks/docx/writer/images.py | 3 +- ebook_converter/ebooks/docx/writer/links.py | 2 +- ebook_converter/ebooks/html/to_zip.py | 27 +- ebook_converter/ebooks/htmlz/oeb2html.py | 2 +- .../ebooks/lrf/html/convert_from.py | 52 +-- ebook_converter/ebooks/metadata/__init__.py | 4 +- ebook_converter/ebooks/metadata/archive.py | 11 +- .../ebooks/metadata/book/__init__.py | 4 +- ebook_converter/ebooks/metadata/book/base.py | 76 ++-- .../ebooks/metadata/book/formatter.py | 2 +- ebook_converter/ebooks/metadata/fb2.py | 6 +- ebook_converter/ebooks/metadata/html.py | 6 +- ebook_converter/ebooks/metadata/meta.py | 10 +- ebook_converter/ebooks/metadata/opf2.py | 6 +- ebook_converter/ebooks/metadata/opf3.py | 2 +- ebook_converter/ebooks/metadata/pdf.py | 4 +- ebook_converter/ebooks/metadata/rtf.py | 6 +- ebook_converter/ebooks/metadata/txt.py | 2 +- ebook_converter/ebooks/metadata/xmp.py | 6 +- ebook_converter/ebooks/mobi/reader/headers.py | 10 +- ebook_converter/ebooks/mobi/reader/mobi6.py | 13 +- ebook_converter/ebooks/mobi/tweak.py | 46 +-- ebook_converter/ebooks/mobi/utils.py | 2 +- .../ebooks/mobi/writer2/indexer.py | 4 +- ebook_converter/ebooks/odt/input.py | 4 +- ebook_converter/ebooks/oeb/base.py | 36 +- ebook_converter/ebooks/oeb/parse_utils.py | 6 +- .../ebooks/oeb/polish/container.py | 20 +- ebook_converter/ebooks/oeb/polish/css.py | 17 +- ebook_converter/ebooks/oeb/polish/errors.py | 3 +- ebook_converter/ebooks/oeb/polish/replace.py | 4 +- ebook_converter/ebooks/oeb/polish/split.py | 7 +- ebook_converter/ebooks/oeb/polish/toc.py | 25 +- ebook_converter/ebooks/oeb/reader.py | 4 +- .../ebooks/oeb/transforms/htmltoc.py | 6 +- .../ebooks/oeb/transforms/jacket.py | 50 +-- .../ebooks/oeb/transforms/split.py | 7 +- .../ebooks/oeb/transforms/structure.py | 4 +- ebook_converter/ebooks/oeb/writer.py | 8 +- .../ebooks/pdb/ereader/reader132.py | 4 +- ebook_converter/ebooks/pdf/pdftohtml.py | 4 +- ebook_converter/ebooks/txt/processor.py | 2 +- ebook_converter/ebooks/txt/txtml.py | 2 +- ebook_converter/library/catalogs/bibtex.py | 33 +- ebook_converter/library/catalogs/csv_xml.py | 8 +- ebook_converter/library/catalogs/epub_mobi.py | 159 ++++---- ebook_converter/library/field_metadata.py | 44 +-- ebook_converter/startup.py | 13 - ebook_converter/utils/config.py | 21 +- ebook_converter/utils/config_base.py | 84 ++--- ebook_converter/utils/filenames.py | 2 +- ebook_converter/utils/formatter.py | 29 +- ebook_converter/utils/formatter_functions.py | 211 +++++------ ebook_converter/utils/html2text.py | 2 +- ebook_converter/utils/localization.py | 173 ++++----- 92 files changed, 1505 insertions(+), 1605 deletions(-) delete mode 100644 ebook_converter/customize/zipplugin.py diff --git a/ebook_converter/customize/__init__.py b/ebook_converter/customize/__init__.py index d5552cf..3c9d9c2 100644 --- a/ebook_converter/customize/__init__.py +++ b/ebook_converter/customize/__init__.py @@ -55,10 +55,10 @@ class Plugin(object): version = (1, 0, 0) #: A short string describing what this plugin does - description = _('Does absolutely nothing') + description = 'Does absolutely nothing' #: The author of this plugin - author = _('Unknown') + author = 'Unknown' #: When more than one plugin exists for a filetype, #: the plugins are run in order of decreasing priority. @@ -76,7 +76,7 @@ class Plugin(object): #: The type of this plugin. Used for categorizing plugins in the #: GUI - type = _('Base') + type = 'Base' def __init__(self, plugin_path): self.plugin_path = plugin_path @@ -264,7 +264,7 @@ class FileTypePlugin(Plugin): #: on the final file produced by the conversion output plugin. on_postprocess = False - type = _('File type') + type = 'File type' def run(self, path_to_ebook): """ @@ -335,7 +335,7 @@ class MetadataReaderPlugin(Plugin): version = numeric_version author = 'Kovid Goyal' - type = _('Metadata reader') + type = 'Metadata reader' def __init__(self, *args, **kwargs): Plugin.__init__(self, *args, **kwargs) @@ -367,7 +367,7 @@ class MetadataWriterPlugin(Plugin): version = numeric_version author = 'Kovid Goyal' - type = _('Metadata writer') + type = 'Metadata writer' def __init__(self, *args, **kwargs): Plugin.__init__(self, *args, **kwargs) @@ -398,7 +398,7 @@ class CatalogPlugin(Plugin): #: For example: 'epub' or 'xml' file_types = set() - type = _('Catalog generator') + type = 'Catalog generator' #: CLI parser options specific to this plugin, declared as namedtuple #: Option: @@ -406,8 +406,8 @@ class CatalogPlugin(Plugin): #: from collections import namedtuple #: Option = namedtuple('Option', 'option, default, dest, help') #: cli_options = [Option('--catalog-title', default = 'My Catalog', - #: dest = 'catalog_title', help = (_('Title of generated catalog. ' - #: '\nDefault:') + + #: dest = 'catalog_title', help = ('Title of generated catalog. ' + #: '\nDefault:' + #: " '" + '%default' + "'"))] #: cli_options parsed in #: ebook_converter.db.cli.cmd_catalog:option_parser() @@ -511,7 +511,7 @@ class InterfaceActionBase(Plugin): supported_platforms = ['windows', 'osx', 'linux'] author = 'Kovid Goyal' - type = _('User interface action') + type = 'User interface action' can_be_disabled = False actual_plugin = None @@ -544,7 +544,7 @@ class PreferencesPlugin(Plugin): supported_platforms = ['windows', 'osx', 'linux'] author = 'Kovid Goyal' - type = _('Preferences') + type = 'Preferences' can_be_disabled = False #: Import path to module that contains a class named ConfigWidget @@ -596,11 +596,11 @@ class StoreBase(Plugin): supported_platforms = ['windows', 'osx', 'linux'] author = 'John Schember' - type = _('Store') + type = 'Store' # Information about the store. Should be in the primary language # of the store. This should not be translatable when set by # a subclass. - description = _('An e-book store.') + description = 'An e-book store.' minimum_calibre_version = (0, 8, 0) version = (1, 0, 1) @@ -643,7 +643,7 @@ class StoreBase(Plugin): class EditBookToolPlugin(Plugin): - type = _('Edit book tool') + type = 'Edit book tool' minimum_calibre_version = (1, 46, 0) @@ -653,7 +653,7 @@ class LibraryClosedPlugin(Plugin): when the library is changed, or when a library is used in some other way. At the moment these plugins won't be called by the CLI functions. """ - type = _('Library closed') + type = 'Library closed' # minimum version 2.54 because that is when support was added minimum_calibre_version = (2, 54, 0) diff --git a/ebook_converter/customize/builtins.py b/ebook_converter/customize/builtins.py index 5c6f861..55c980a 100644 --- a/ebook_converter/customize/builtins.py +++ b/ebook_converter/customize/builtins.py @@ -19,10 +19,10 @@ plugins = [] class PML2PMLZ(FileTypePlugin): name = 'PML to PMLZ' author = 'John Schember' - description = _('Create a PMLZ archive containing the PML file ' - 'and all images in the directory pmlname_img or images. ' - 'This plugin is run every time you add ' - 'a PML file to the library.') + description = ('Create a PMLZ archive containing the PML file ' + 'and all images in the directory pmlname_img or images. ' + 'This plugin is run every time you add ' + 'a PML file to the library.') version = numeric_version file_types = {'pml'} supported_platforms = ['windows', 'osx', 'linux'] @@ -50,9 +50,10 @@ class PML2PMLZ(FileTypePlugin): class TXT2TXTZ(FileTypePlugin): name = 'TXT to TXTZ' author = 'John Schember' - description = _('Create a TXTZ archive when a TXT file is imported ' - 'containing Markdown or Textile references to images. The referenced ' - 'images as well as the TXT file are added to the archive.') + description = ('Create a TXTZ archive when a TXT file is imported ' + 'containing Markdown or Textile references to images. The ' + 'referenced images as well as the TXT file are added to ' + 'the archive.') version = numeric_version file_types = {'txt', 'text'} supported_platforms = ['windows', 'osx', 'linux'] @@ -133,7 +134,7 @@ class ComicMetadataReader(MetadataReaderPlugin): name = 'Read comic metadata' file_types = {'cbr', 'cbz'} - description = _('Extract cover from comic files') + description = 'Extract cover from comic files' def customization_help(self, gui=False): return 'Read series number from volume or issue number. Default is volume, set this to issue to use issue number instead.' @@ -174,7 +175,7 @@ class CHMMetadataReader(MetadataReaderPlugin): name = 'Read CHM metadata' file_types = {'chm'} - description = _('Read metadata from %s files') % 'CHM' + description = 'Read metadata from CHM files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.chm.metadata import get_metadata @@ -185,7 +186,7 @@ class EPUBMetadataReader(MetadataReaderPlugin): name = 'Read EPUB metadata' file_types = {'epub'} - description = _('Read metadata from %s files')%'EPUB' + description = 'Read metadata from EPUB files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.epub import get_metadata, get_quick_metadata @@ -198,7 +199,7 @@ class FB2MetadataReader(MetadataReaderPlugin): name = 'Read FB2 metadata' file_types = {'fb2', 'fbz'} - description = _('Read metadata from %s files')%'FB2' + description = 'Read metadata from FB2 files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.fb2 import get_metadata @@ -209,7 +210,7 @@ class HTMLMetadataReader(MetadataReaderPlugin): name = 'Read HTML metadata' file_types = {'html'} - description = _('Read metadata from %s files')%'HTML' + description = 'Read metadata from HTML files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.html import get_metadata @@ -220,7 +221,7 @@ class HTMLZMetadataReader(MetadataReaderPlugin): name = 'Read HTMLZ metadata' file_types = {'htmlz'} - description = _('Read metadata from %s files') % 'HTMLZ' + description = 'Read metadata from HTMLZ files' author = 'John Schember' def get_metadata(self, stream, ftype): @@ -232,7 +233,7 @@ class IMPMetadataReader(MetadataReaderPlugin): name = 'Read IMP metadata' file_types = {'imp'} - description = _('Read metadata from %s files')%'IMP' + description = 'Read metadata from IMP files' author = 'Ashish Kulkarni' def get_metadata(self, stream, ftype): @@ -244,7 +245,7 @@ class LITMetadataReader(MetadataReaderPlugin): name = 'Read LIT metadata' file_types = {'lit'} - description = _('Read metadata from %s files')%'LIT' + description = 'Read metadata from LIT files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.lit import get_metadata @@ -255,7 +256,7 @@ class LRFMetadataReader(MetadataReaderPlugin): name = 'Read LRF metadata' file_types = {'lrf'} - description = _('Read metadata from %s files')%'LRF' + description = 'Read metadata from LRF files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.lrf.meta import get_metadata @@ -266,7 +267,7 @@ class LRXMetadataReader(MetadataReaderPlugin): name = 'Read LRX metadata' file_types = {'lrx'} - description = _('Read metadata from %s files')%'LRX' + description = 'Read metadata from LRX files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.lrx import get_metadata @@ -277,7 +278,7 @@ class MOBIMetadataReader(MetadataReaderPlugin): name = 'Read MOBI metadata' file_types = {'mobi', 'prc', 'azw', 'azw3', 'azw4', 'pobi'} - description = _('Read metadata from %s files')%'MOBI' + description = 'Read metadata from MOBI files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.mobi import get_metadata @@ -288,7 +289,7 @@ class ODTMetadataReader(MetadataReaderPlugin): name = 'Read ODT metadata' file_types = {'odt'} - description = _('Read metadata from %s files')%'ODT' + description = 'Read metadata from ODT files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.odt import get_metadata @@ -299,7 +300,7 @@ class DocXMetadataReader(MetadataReaderPlugin): name = 'Read DOCX metadata' file_types = {'docx'} - description = _('Read metadata from %s files')%'DOCX' + description = 'Read metadata from DOCX files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.docx import get_metadata @@ -310,7 +311,7 @@ class OPFMetadataReader(MetadataReaderPlugin): name = 'Read OPF metadata' file_types = {'opf'} - description = _('Read metadata from %s files')%'OPF' + description = 'Read metadata from OPF files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.opf import get_metadata @@ -321,7 +322,7 @@ class PDBMetadataReader(MetadataReaderPlugin): name = 'Read PDB metadata' file_types = {'pdb', 'updb'} - description = _('Read metadata from %s files') % 'PDB' + description = 'Read metadata from PDB files' author = 'John Schember' def get_metadata(self, stream, ftype): @@ -333,7 +334,7 @@ class PDFMetadataReader(MetadataReaderPlugin): name = 'Read PDF metadata' file_types = {'pdf'} - description = _('Read metadata from %s files')%'PDF' + description = 'Read metadata from PDF files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.pdf import get_metadata, get_quick_metadata @@ -346,7 +347,7 @@ class PMLMetadataReader(MetadataReaderPlugin): name = 'Read PML metadata' file_types = {'pml', 'pmlz'} - description = _('Read metadata from %s files') % 'PML' + description = 'Read metadata from PML files' author = 'John Schember' def get_metadata(self, stream, ftype): @@ -358,7 +359,7 @@ class RARMetadataReader(MetadataReaderPlugin): name = 'Read RAR metadata' file_types = {'rar'} - description = _('Read metadata from e-books in RAR archives') + description = 'Read metadata from e-books in RAR archives' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.rar import get_metadata @@ -369,7 +370,7 @@ class RBMetadataReader(MetadataReaderPlugin): name = 'Read RB metadata' file_types = {'rb'} - description = _('Read metadata from %s files')%'RB' + description = 'Read metadata from RB files' author = 'Ashish Kulkarni' def get_metadata(self, stream, ftype): @@ -381,7 +382,7 @@ class RTFMetadataReader(MetadataReaderPlugin): name = 'Read RTF metadata' file_types = {'rtf'} - description = _('Read metadata from %s files')%'RTF' + description = 'Read metadata from RTF files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.rtf import get_metadata @@ -392,7 +393,7 @@ class SNBMetadataReader(MetadataReaderPlugin): name = 'Read SNB metadata' file_types = {'snb'} - description = _('Read metadata from %s files') % 'SNB' + description = 'Read metadata from SNB files' author = 'Li Fanxi' def get_metadata(self, stream, ftype): @@ -404,7 +405,7 @@ class TOPAZMetadataReader(MetadataReaderPlugin): name = 'Read Topaz metadata' file_types = {'tpz', 'azw1'} - description = _('Read metadata from %s files')%'MOBI' + description = 'Read metadata from MOBI files' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.topaz import get_metadata @@ -415,7 +416,7 @@ class TXTMetadataReader(MetadataReaderPlugin): name = 'Read TXT metadata' file_types = {'txt'} - description = _('Read metadata from %s files') % 'TXT' + description = 'Read metadata from TXT files' author = 'John Schember' def get_metadata(self, stream, ftype): @@ -427,7 +428,7 @@ class TXTZMetadataReader(MetadataReaderPlugin): name = 'Read TXTZ metadata' file_types = {'txtz'} - description = _('Read metadata from %s files') % 'TXTZ' + description = 'Read metadata from TXTZ files' author = 'John Schember' def get_metadata(self, stream, ftype): @@ -439,7 +440,7 @@ class ZipMetadataReader(MetadataReaderPlugin): name = 'Read ZIP metadata' file_types = {'zip', 'oebzip'} - description = _('Read metadata from e-books in ZIP archives') + description = 'Read metadata from e-books in ZIP archives' def get_metadata(self, stream, ftype): from ebook_converter.ebooks.metadata.zip import get_metadata @@ -458,7 +459,7 @@ class EPUBMetadataWriter(MetadataWriterPlugin): name = 'Set EPUB metadata' file_types = {'epub'} - description = _('Set metadata in %s files')%'EPUB' + description = 'Set metadata in EPUB files' def set_metadata(self, stream, mi, type): from ebook_converter.ebooks.metadata.epub import set_metadata @@ -469,15 +470,16 @@ class EPUBMetadataWriter(MetadataWriterPlugin): h = 'disable-add-missing-cover' if gui: h = '' + h + '' - return _('Enter {0} below to have the EPUB metadata writer plugin not' - ' add cover images to EPUB files that have no existing cover image.').format(h) + return ('Enter {0} below to have the EPUB metadata writer plugin not ' + 'add cover images to EPUB files that have no existing cover ' + 'image.'.format(h)) class FB2MetadataWriter(MetadataWriterPlugin): name = 'Set FB2 metadata' file_types = {'fb2', 'fbz'} - description = _('Set metadata in %s files')%'FB2' + description = 'Set metadata in FB2 files' def set_metadata(self, stream, mi, type): from ebook_converter.ebooks.metadata.fb2 import set_metadata @@ -488,7 +490,7 @@ class HTMLZMetadataWriter(MetadataWriterPlugin): name = 'Set HTMLZ metadata' file_types = {'htmlz'} - description = _('Set metadata from %s files') % 'HTMLZ' + description = 'Set metadata from HTMLZ files' author = 'John Schember' def set_metadata(self, stream, mi, type): @@ -500,7 +502,7 @@ class LRFMetadataWriter(MetadataWriterPlugin): name = 'Set LRF metadata' file_types = {'lrf'} - description = _('Set metadata in %s files')%'LRF' + description = 'Set metadata in LRF files' def set_metadata(self, stream, mi, type): from ebook_converter.ebooks.lrf.meta import set_metadata @@ -511,7 +513,7 @@ class MOBIMetadataWriter(MetadataWriterPlugin): name = 'Set MOBI metadata' file_types = {'mobi', 'prc', 'azw', 'azw3', 'azw4'} - description = _('Set metadata in %s files')%'MOBI' + description = 'Set metadata in MOBI files' author = 'Marshall T. Vandegrift' def set_metadata(self, stream, mi, type): @@ -523,7 +525,7 @@ class PDBMetadataWriter(MetadataWriterPlugin): name = 'Set PDB metadata' file_types = {'pdb'} - description = _('Set metadata from %s files') % 'PDB' + description = 'Set metadata from PDB files' author = 'John Schember' def set_metadata(self, stream, mi, type): @@ -535,7 +537,7 @@ class PDFMetadataWriter(MetadataWriterPlugin): name = 'Set PDF metadata' file_types = {'pdf'} - description = _('Set metadata in %s files') % 'PDF' + description = 'Set metadata in PDF files' author = 'Kovid Goyal' def set_metadata(self, stream, mi, type): @@ -547,7 +549,7 @@ class RTFMetadataWriter(MetadataWriterPlugin): name = 'Set RTF metadata' file_types = {'rtf'} - description = _('Set metadata in %s files')%'RTF' + description = 'Set metadata in RTF files' def set_metadata(self, stream, mi, type): from ebook_converter.ebooks.metadata.rtf import set_metadata @@ -558,7 +560,7 @@ class TOPAZMetadataWriter(MetadataWriterPlugin): name = 'Set TOPAZ metadata' file_types = {'tpz', 'azw1'} - description = _('Set metadata in %s files')%'TOPAZ' + description = 'Set metadata in TOPAZ files' author = 'Greg Riker' def set_metadata(self, stream, mi, type): @@ -570,7 +572,7 @@ class TXTZMetadataWriter(MetadataWriterPlugin): name = 'Set TXTZ metadata' file_types = {'txtz'} - description = _('Set metadata from %s files') % 'TXTZ' + description = 'Set metadata from TXTZ files' author = 'John Schember' def set_metadata(self, stream, mi, type): @@ -582,7 +584,7 @@ class ODTMetadataWriter(MetadataWriterPlugin): name = 'Set ODT metadata' file_types = {'odt'} - description = _('Set metadata from %s files')%'ODT' + description = 'Set metadata from ODT files' def set_metadata(self, stream, mi, type): from ebook_converter.ebooks.metadata.odt import set_metadata @@ -593,7 +595,7 @@ class DocXMetadataWriter(MetadataWriterPlugin): name = 'Set DOCX metadata' file_types = {'docx'} - description = _('Set metadata from %s files')%'DOCX' + description = 'Set metadata from DOCX files' def set_metadata(self, stream, mi, type): from ebook_converter.ebooks.metadata.docx import set_metadata @@ -828,228 +830,231 @@ plugins += input_profiles + output_profiles class ActionAdd(InterfaceActionBase): name = 'Add Books' actual_plugin = 'ebook_converter.gui2.actions.add:AddAction' - description = _('Add books to calibre or the connected device') + description = 'Add books to calibre or the connected device' class ActionFetchAnnotations(InterfaceActionBase): name = 'Fetch Annotations' actual_plugin = 'ebook_converter.gui2.actions.annotate:FetchAnnotationsAction' - description = _('Fetch annotations from a connected Kindle (experimental)') + description = 'Fetch annotations from a connected Kindle (experimental)' class ActionGenerateCatalog(InterfaceActionBase): name = 'Generate Catalog' actual_plugin = 'ebook_converter.gui2.actions.catalog:GenerateCatalogAction' - description = _('Generate a catalog of the books in your calibre library') + description = 'Generate a catalog of the books in your calibre library' class ActionConvert(InterfaceActionBase): name = 'Convert Books' actual_plugin = 'ebook_converter.gui2.actions.convert:ConvertAction' - description = _('Convert books to various e-book formats') + description = 'Convert books to various e-book formats' class ActionPolish(InterfaceActionBase): name = 'Polish Books' actual_plugin = 'ebook_converter.gui2.actions.polish:PolishAction' - description = _('Fine tune your e-books') + description = 'Fine tune your e-books' class ActionEditToC(InterfaceActionBase): name = 'Edit ToC' actual_plugin = 'ebook_converter.gui2.actions.toc_edit:ToCEditAction' - description = _('Edit the Table of Contents in your books') + description = 'Edit the Table of Contents in your books' class ActionDelete(InterfaceActionBase): name = 'Remove Books' actual_plugin = 'ebook_converter.gui2.actions.delete:DeleteAction' - description = _('Delete books from your calibre library or connected device') + description = 'Delete books from your calibre library or connected device' class ActionEmbed(InterfaceActionBase): name = 'Embed Metadata' actual_plugin = 'ebook_converter.gui2.actions.embed:EmbedAction' - description = _('Embed updated metadata into the actual book files in your calibre library') + description = ('Embed updated metadata into the actual book files in ' + 'your calibre library') class ActionEditMetadata(InterfaceActionBase): name = 'Edit Metadata' actual_plugin = 'ebook_converter.gui2.actions.edit_metadata:EditMetadataAction' - description = _('Edit the metadata of books in your calibre library') + description = 'Edit the metadata of books in your calibre library' class ActionView(InterfaceActionBase): name = 'View' actual_plugin = 'ebook_converter.gui2.actions.view:ViewAction' - description = _('Read books in your calibre library') + description = 'Read books in your calibre library' class ActionFetchNews(InterfaceActionBase): name = 'Fetch News' actual_plugin = 'ebook_converter.gui2.actions.fetch_news:FetchNewsAction' - description = _('Download news from the internet in e-book form') + description = 'Download news from the internet in e-book form' class ActionQuickview(InterfaceActionBase): name = 'Quickview' actual_plugin = 'ebook_converter.gui2.actions.show_quickview:ShowQuickviewAction' - description = _('Show a list of related books quickly') + description = 'Show a list of related books quickly' class ActionTagMapper(InterfaceActionBase): name = 'Tag Mapper' actual_plugin = 'ebook_converter.gui2.actions.tag_mapper:TagMapAction' - description = _('Filter/transform the tags for books in the library') + description = 'Filter/transform the tags for books in the library' class ActionAuthorMapper(InterfaceActionBase): name = 'Author Mapper' actual_plugin = 'ebook_converter.gui2.actions.author_mapper:AuthorMapAction' - description = _('Transform the authors for books in the library') + description = 'Transform the authors for books in the library' class ActionTemplateTester(InterfaceActionBase): name = 'Template Tester' actual_plugin = 'ebook_converter.gui2.actions.show_template_tester:ShowTemplateTesterAction' - description = _('Show an editor for testing templates') + description = 'Show an editor for testing templates' class ActionSaveToDisk(InterfaceActionBase): name = 'Save To Disk' actual_plugin = 'ebook_converter.gui2.actions.save_to_disk:SaveToDiskAction' - description = _('Export books from your calibre library to the hard disk') + description = 'Export books from your calibre library to the hard disk' class ActionShowBookDetails(InterfaceActionBase): name = 'Show Book Details' actual_plugin = 'ebook_converter.gui2.actions.show_book_details:ShowBookDetailsAction' - description = _('Show Book details in a separate popup') + description = 'Show Book details in a separate popup' class ActionRestart(InterfaceActionBase): name = 'Restart' actual_plugin = 'ebook_converter.gui2.actions.restart:RestartAction' - description = _('Restart calibre') + description = 'Restart calibre' class ActionOpenFolder(InterfaceActionBase): name = 'Open Folder' actual_plugin = 'ebook_converter.gui2.actions.open:OpenFolderAction' - description = _('Open the folder that contains the book files in your' + description = ('Open the folder that contains the book files in your' ' calibre library') class ActionSendToDevice(InterfaceActionBase): name = 'Send To Device' actual_plugin = 'ebook_converter.gui2.actions.device:SendToDeviceAction' - description = _('Send books to the connected device') + description = 'Send books to the connected device' class ActionConnectShare(InterfaceActionBase): name = 'Connect Share' actual_plugin = 'ebook_converter.gui2.actions.device:ConnectShareAction' - description = _('Send books via email or the web. Also connect to' + description = ('Send books via email or the web. Also connect to' ' folders on your computer as if they are devices') class ActionHelp(InterfaceActionBase): name = 'Help' actual_plugin = 'ebook_converter.gui2.actions.help:HelpAction' - description = _('Browse the calibre User Manual') + description = 'Browse the calibre User Manual' class ActionPreferences(InterfaceActionBase): name = 'Preferences' actual_plugin = 'ebook_converter.gui2.actions.preferences:PreferencesAction' - description = _('Customize calibre') + description = 'Customize calibre' class ActionSimilarBooks(InterfaceActionBase): name = 'Similar Books' actual_plugin = 'ebook_converter.gui2.actions.similar_books:SimilarBooksAction' - description = _('Easily find books similar to the currently selected one') + description = 'Easily find books similar to the currently selected one' class ActionChooseLibrary(InterfaceActionBase): name = 'Choose Library' actual_plugin = 'ebook_converter.gui2.actions.choose_library:ChooseLibraryAction' - description = _('Switch between different calibre libraries and perform' - ' maintenance on them') + description = ('Switch between different calibre libraries and perform ' + 'maintenance on them') class ActionAddToLibrary(InterfaceActionBase): name = 'Add To Library' actual_plugin = 'ebook_converter.gui2.actions.add_to_library:AddToLibraryAction' - description = _('Copy books from the device to your calibre library') + description = 'Copy books from the device to your calibre library' class ActionEditCollections(InterfaceActionBase): name = 'Edit Collections' actual_plugin = 'ebook_converter.gui2.actions.edit_collections:EditCollectionsAction' - description = _('Edit the collections in which books are placed on your device') + description = ('Edit the collections in which books are placed on your ' + 'device') class ActionMatchBooks(InterfaceActionBase): name = 'Match Books' actual_plugin = 'ebook_converter.gui2.actions.match_books:MatchBookAction' - description = _('Match book on the devices to books in the library') + description = 'Match book on the devices to books in the library' class ActionCopyToLibrary(InterfaceActionBase): name = 'Copy To Library' actual_plugin = 'ebook_converter.gui2.actions.copy_to_library:CopyToLibraryAction' - description = _('Copy a book from one calibre library to another') + description = 'Copy a book from one calibre library to another' class ActionTweakEpub(InterfaceActionBase): name = 'Tweak ePub' actual_plugin = 'ebook_converter.gui2.actions.tweak_epub:TweakEpubAction' - description = _('Edit e-books in the EPUB or AZW3 formats') + description = 'Edit e-books in the EPUB or AZW3 formats' class ActionUnpackBook(InterfaceActionBase): name = 'Unpack Book' actual_plugin = 'ebook_converter.gui2.actions.unpack_book:UnpackBookAction' - description = _('Make small changes to EPUB or HTMLZ files in your calibre library') + description = ('Make small changes to EPUB or HTMLZ files in your ' + 'calibre library') class ActionNextMatch(InterfaceActionBase): name = 'Next Match' actual_plugin = 'ebook_converter.gui2.actions.next_match:NextMatchAction' - description = _('Find the next or previous match when searching in ' - 'your calibre library in highlight mode') + description = ('Find the next or previous match when searching in ' + 'your calibre library in highlight mode') class ActionPickRandom(InterfaceActionBase): name = 'Pick Random Book' actual_plugin = 'ebook_converter.gui2.actions.random:PickRandomAction' - description = _('Choose a random book from your calibre library') + description = 'Choose a random book from your calibre library' class ActionSortBy(InterfaceActionBase): name = 'Sort By' actual_plugin = 'ebook_converter.gui2.actions.sort:SortByAction' - description = _('Sort the list of books') + description = 'Sort the list of books' class ActionMarkBooks(InterfaceActionBase): name = 'Mark Books' actual_plugin = 'ebook_converter.gui2.actions.mark_books:MarkBooksAction' - description = _('Temporarily mark books') + description = 'Temporarily mark books' class ActionVirtualLibrary(InterfaceActionBase): name = 'Virtual Library' actual_plugin = 'ebook_converter.gui2.actions.virtual_library:VirtualLibraryAction' - description = _('Change the current Virtual library') + description = 'Change the current Virtual library' class ActionStore(InterfaceActionBase): name = 'Store' author = 'John Schember' actual_plugin = 'ebook_converter.gui2.actions.store:StoreAction' - description = _('Search for books from different book sellers') + description = 'Search for books from different book sellers' def customization_help(self, gui=False): return 'Customize the behavior of the store search.' @@ -1066,7 +1071,8 @@ class ActionStore(InterfaceActionBase): class ActionPluginUpdater(InterfaceActionBase): name = 'Plugin Updater' author = 'Grant Drake' - description = _('Get new ebook_converter plugins or update your existing ones') + description = ('Get new ebook_converter plugins or update your existing ' + 'ones') actual_plugin = 'calibre.gui2.actions.plugin_updates:PluginUpdaterAction' diff --git a/ebook_converter/customize/conversion.py b/ebook_converter/customize/conversion.py index fe8ee8d..ba00714 100644 --- a/ebook_converter/customize/conversion.py +++ b/ebook_converter/customize/conversion.py @@ -101,7 +101,7 @@ class InputFormatPlugin(Plugin): The main action happens in :meth:`convert`. ''' - type = _('Conversion input') + type = 'Conversion input' can_be_disabled = False supported_platforms = ['windows', 'osx', 'linux'] commit_name = None # unique name under which options for this plugin are saved @@ -137,11 +137,11 @@ class InputFormatPlugin(Plugin): common_options = { OptionRecommendation(name='input_encoding', recommended_value=None, level=OptionRecommendation.LOW, - help=_('Specify the character encoding of the input document. If ' - 'set this option will override any encoding declared by the ' - 'document itself. Particularly useful for documents that ' - 'do not declare an encoding or that have erroneous ' - 'encoding declarations.') + help='Specify the character encoding of the input document. If ' + 'set this option will override any encoding declared by the ' + 'document itself. Particularly useful for documents that ' + 'do not declare an encoding or that have erroneous ' + 'encoding declarations.' )} #: Options to customize the behavior of this plugin. Every option must be an @@ -239,7 +239,7 @@ class OutputFormatPlugin(Plugin): The main action happens in :meth:`convert`. ''' - type = _('Conversion output') + type = 'Conversion output' can_be_disabled = False supported_platforms = ['windows', 'osx', 'linux'] commit_name = None # unique name under which options for this plugin are saved @@ -255,9 +255,9 @@ class OutputFormatPlugin(Plugin): common_options = { OptionRecommendation(name='pretty_print', recommended_value=False, level=OptionRecommendation.LOW, - help=_('If specified, the output plugin will try to create output ' - 'that is as human readable as possible. May not have any effect ' - 'for some output plugins.') + help='If specified, the output plugin will try to create output ' + 'that is as human readable as possible. May not have any ' + 'effect for some output plugins.' )} #: Options to customize the behavior of this plugin. Every option must be an @@ -270,7 +270,7 @@ class OutputFormatPlugin(Plugin): @property def description(self): - return _('Convert e-books to the %s format')%self.file_type + return 'Convert e-books to the %s format' % self.file_type def __init__(self, *args): Plugin.__init__(self, *args) diff --git a/ebook_converter/customize/profiles.py b/ebook_converter/customize/profiles.py index cfde21a..9d426dd 100644 --- a/ebook_converter/customize/profiles.py +++ b/ebook_converter/customize/profiles.py @@ -43,20 +43,20 @@ class InputProfile(Plugin): author = 'Kovid Goyal' supported_platforms = {'windows', 'osx', 'linux'} can_be_disabled = False - type = _('Input profile') + type = 'Input profile' name = 'Default Input Profile' short_name = 'default' # Used in the CLI so dont use spaces etc. in it - description = _('This profile tries to provide sane defaults and is useful ' - 'if you know nothing about the input document.') + description = ('This profile tries to provide sane defaults and is useful ' + 'if you know nothing about the input document.') class SonyReaderInput(InputProfile): name = 'Sony Reader' short_name = 'sony' - description = _('This profile is intended for the SONY PRS line. ' - 'The 500/505/600/700 etc.') + description = ('This profile is intended for the SONY PRS line. ' + 'The 500/505/600/700 etc.') screen_size = (584, 754) dpi = 168.451 @@ -68,7 +68,7 @@ class SonyReader300Input(SonyReaderInput): name = 'Sony Reader 300' short_name = 'sony300' - description = _('This profile is intended for the SONY PRS 300.') + description = 'This profile is intended for the SONY PRS 300.' dpi = 200 @@ -78,7 +78,7 @@ class SonyReader900Input(SonyReaderInput): author = 'John Schember' name = 'Sony Reader 900' short_name = 'sony900' - description = _('This profile is intended for the SONY PRS-900.') + description = 'This profile is intended for the SONY PRS-900.' screen_size = (584, 978) @@ -87,7 +87,7 @@ class MSReaderInput(InputProfile): name = 'Microsoft Reader' short_name = 'msreader' - description = _('This profile is intended for the Microsoft Reader.') + description = 'This profile is intended for the Microsoft Reader.' screen_size = (480, 652) dpi = 96 @@ -99,7 +99,7 @@ class MobipocketInput(InputProfile): name = 'Mobipocket Books' short_name = 'mobipocket' - description = _('This profile is intended for the Mobipocket books.') + description = 'This profile is intended for the Mobipocket books.' # Unfortunately MOBI books are not narrowly targeted, so this information is # quite likely to be spurious @@ -113,7 +113,7 @@ class HanlinV3Input(InputProfile): name = 'Hanlin V3' short_name = 'hanlinv3' - description = _('This profile is intended for the Hanlin V3 and its clones.') + description = 'This profile is intended for the Hanlin V3 and its clones.' # Screen size is a best guess screen_size = (584, 754) @@ -126,7 +126,7 @@ class HanlinV5Input(HanlinV3Input): name = 'Hanlin V5' short_name = 'hanlinv5' - description = _('This profile is intended for the Hanlin V5 and its clones.') + description = 'This profile is intended for the Hanlin V5 and its clones.' # Screen size is a best guess screen_size = (584, 754) @@ -137,7 +137,7 @@ class CybookG3Input(InputProfile): name = 'Cybook G3' short_name = 'cybookg3' - description = _('This profile is intended for the Cybook G3.') + description = 'This profile is intended for the Cybook G3.' # Screen size is a best guess screen_size = (600, 800) @@ -151,7 +151,7 @@ class CybookOpusInput(InputProfile): author = 'John Schember' name = 'Cybook Opus' short_name = 'cybook_opus' - description = _('This profile is intended for the Cybook Opus.') + description = 'This profile is intended for the Cybook Opus.' # Screen size is a best guess screen_size = (600, 800) @@ -164,7 +164,7 @@ class KindleInput(InputProfile): name = 'Kindle' short_name = 'kindle' - description = _('This profile is intended for the Amazon Kindle.') + description = 'This profile is intended for the Amazon Kindle.' # Screen size is a best guess screen_size = (525, 640) @@ -177,7 +177,7 @@ class IlliadInput(InputProfile): name = 'Illiad' short_name = 'illiad' - description = _('This profile is intended for the Irex Illiad.') + description = 'This profile is intended for the Irex Illiad.' screen_size = (760, 925) dpi = 160.0 @@ -190,7 +190,7 @@ class IRexDR1000Input(InputProfile): author = 'John Schember' name = 'IRex Digital Reader 1000' short_name = 'irexdr1000' - description = _('This profile is intended for the IRex Digital Reader 1000.') + description = 'This profile is intended for the IRex Digital Reader 1000.' # Screen size is a best guess screen_size = (1024, 1280) @@ -204,7 +204,7 @@ class IRexDR800Input(InputProfile): author = 'Eric Cronin' name = 'IRex Digital Reader 800' short_name = 'irexdr800' - description = _('This profile is intended for the IRex Digital Reader 800.') + description = 'This profile is intended for the IRex Digital Reader 800.' screen_size = (768, 1024) dpi = 160 @@ -217,7 +217,7 @@ class NookInput(InputProfile): author = 'John Schember' name = 'Nook' short_name = 'nook' - description = _('This profile is intended for the B&N Nook.') + description = 'This profile is intended for the B&N Nook.' # Screen size is a best guess screen_size = (600, 800) @@ -241,13 +241,13 @@ class OutputProfile(Plugin): author = 'Kovid Goyal' supported_platforms = {'windows', 'osx', 'linux'} can_be_disabled = False - type = _('Output profile') + type = 'Output profile' name = 'Default Output Profile' short_name = 'default' # Used in the CLI so dont use spaces etc. in it - description = _('This profile tries to provide sane defaults and is useful ' - 'if you want to produce a document intended to be read at a ' - 'computer or on a range of devices.') + description = ('This profile tries to provide sane defaults and is useful ' + 'if you want to produce a document intended to be read at ' + 'a computer or on a range of devices.') #: The image size for comics comic_screen_size = (584, 754) @@ -282,8 +282,8 @@ class iPadOutput(OutputProfile): name = 'iPad' short_name = 'ipad' - description = _('Intended for the iPad and similar devices with a ' - 'resolution of 768x1024') + description = ('Intended for the iPad and similar devices with a ' + 'resolution of 768x1024') screen_size = (768, 1024) comic_screen_size = (768, 1024) dpi = 132.0 @@ -445,14 +445,15 @@ class iPad3Output(iPadOutput): dpi = 264.0 name = 'iPad 3' short_name = 'ipad3' - description = _('Intended for the iPad 3 and similar devices with a ' - 'resolution of 1536x2048') + description = ('Intended for the iPad 3 and similar devices with a ' + 'resolution of 1536x2048') class TabletOutput(iPadOutput): name = 'Tablet' short_name = 'tablet' - description = _('Intended for generic tablet devices, does no resizing of images') + description = ('Intended for generic tablet devices, does no resizing of ' + 'images') screen_size = (10000, 10000) comic_screen_size = (10000, 10000) @@ -461,16 +462,16 @@ class TabletOutput(iPadOutput): class SamsungGalaxy(TabletOutput): name = 'Samsung Galaxy' short_name = 'galaxy' - description = _('Intended for the Samsung Galaxy and similar tablet devices with ' - 'a resolution of 600x1280') + description = ('Intended for the Samsung Galaxy and similar tablet ' + 'devices with a resolution of 600x1280') screen_size = comic_screen_size = (600, 1280) class NookHD(TabletOutput): name = 'Nook HD+' short_name = 'nook_hd_plus' - description = _('Intended for the Nook HD+ and similar tablet devices with ' - 'a resolution of 1280x1920') + description = ('Intended for the Nook HD+ and similar tablet devices with ' + 'a resolution of 1280x1920') screen_size = comic_screen_size = (1280, 1920) @@ -478,8 +479,8 @@ class SonyReaderOutput(OutputProfile): name = 'Sony Reader' short_name = 'sony' - description = _('This profile is intended for the SONY PRS line. ' - 'The 500/505/600/700 etc.') + description = ('This profile is intended for the SONY PRS line. ' + 'The 500/505/600/700 etc.') screen_size = (590, 775) dpi = 168.451 @@ -496,7 +497,7 @@ class KoboReaderOutput(OutputProfile): name = 'Kobo Reader' short_name = 'kobo' - description = _('This profile is intended for the Kobo Reader.') + description = 'This profile is intended for the Kobo Reader.' screen_size = (536, 710) comic_screen_size = (536, 710) @@ -510,7 +511,7 @@ class SonyReader300Output(SonyReaderOutput): author = 'John Schember' name = 'Sony Reader 300' short_name = 'sony300' - description = _('This profile is intended for the SONY PRS-300.') + description = 'This profile is intended for the SONY PRS-300.' dpi = 200 @@ -520,7 +521,7 @@ class SonyReader900Output(SonyReaderOutput): author = 'John Schember' name = 'Sony Reader 900' short_name = 'sony900' - description = _('This profile is intended for the SONY PRS-900.') + description = 'This profile is intended for the SONY PRS-900.' screen_size = (600, 999) comic_screen_size = screen_size @@ -531,7 +532,7 @@ class SonyReaderT3Output(SonyReaderOutput): author = 'Kovid Goyal' name = 'Sony Reader T3' short_name = 'sonyt3' - description = _('This profile is intended for the SONY PRS-T3.') + description = 'This profile is intended for the SONY PRS-T3.' screen_size = (758, 934) comic_screen_size = screen_size @@ -541,7 +542,7 @@ class GenericEink(SonyReaderOutput): name = 'Generic e-ink' short_name = 'generic_eink' - description = _('Suitable for use with any e-ink device') + description = 'Suitable for use with any e-ink device' epub_periodical_format = None @@ -549,7 +550,7 @@ class GenericEinkLarge(GenericEink): name = 'Generic e-ink large' short_name = 'generic_eink_large' - description = _('Suitable for use with any large screen e-ink device') + description = 'Suitable for use with any large screen e-ink device' screen_size = (600, 999) comic_screen_size = screen_size @@ -559,7 +560,8 @@ class GenericEinkHD(GenericEink): name = 'Generic e-ink HD' short_name = 'generic_eink_hd' - description = _('Suitable for use with any modern high resolution e-ink device') + description = ('Suitable for use with any modern high resolution e-ink ' + 'device') screen_size = (10000, 10000) comic_screen_size = (10000, 10000) @@ -569,7 +571,7 @@ class JetBook5Output(OutputProfile): name = 'JetBook 5-inch' short_name = 'jetbook5' - description = _('This profile is intended for the 5-inch JetBook.') + description = 'This profile is intended for the 5-inch JetBook.' screen_size = (480, 640) dpi = 168.451 @@ -579,9 +581,9 @@ class SonyReaderLandscapeOutput(SonyReaderOutput): name = 'Sony Reader Landscape' short_name = 'sony-landscape' - description = _('This profile is intended for the SONY PRS line. ' - 'The 500/505/700 etc, in landscape mode. Mainly useful ' - 'for comics.') + description = ('This profile is intended for the SONY PRS line. ' + 'The 500/505/700 etc, in landscape mode. Mainly useful ' + 'for comics.') screen_size = (784, 1012) comic_screen_size = (784, 1012) @@ -591,7 +593,7 @@ class MSReaderOutput(OutputProfile): name = 'Microsoft Reader' short_name = 'msreader' - description = _('This profile is intended for the Microsoft Reader.') + description = 'This profile is intended for the Microsoft Reader.' screen_size = (480, 652) dpi = 96 @@ -603,7 +605,7 @@ class MobipocketOutput(OutputProfile): name = 'Mobipocket Books' short_name = 'mobipocket' - description = _('This profile is intended for the Mobipocket books.') + description = 'This profile is intended for the Mobipocket books.' # Unfortunately MOBI books are not narrowly targeted, so this information is # quite likely to be spurious @@ -617,7 +619,7 @@ class HanlinV3Output(OutputProfile): name = 'Hanlin V3' short_name = 'hanlinv3' - description = _('This profile is intended for the Hanlin V3 and its clones.') + description = 'This profile is intended for the Hanlin V3 and its clones.' # Screen size is a best guess screen_size = (584, 754) @@ -630,7 +632,7 @@ class HanlinV5Output(HanlinV3Output): name = 'Hanlin V5' short_name = 'hanlinv5' - description = _('This profile is intended for the Hanlin V5 and its clones.') + description = 'This profile is intended for the Hanlin V5 and its clones.' dpi = 200 @@ -639,7 +641,7 @@ class CybookG3Output(OutputProfile): name = 'Cybook G3' short_name = 'cybookg3' - description = _('This profile is intended for the Cybook G3.') + description = 'This profile is intended for the Cybook G3.' # Screen size is a best guess screen_size = (600, 800) @@ -654,7 +656,7 @@ class CybookOpusOutput(SonyReaderOutput): author = 'John Schember' name = 'Cybook Opus' short_name = 'cybook_opus' - description = _('This profile is intended for the Cybook Opus.') + description = 'This profile is intended for the Cybook Opus.' # Screen size is a best guess dpi = 200 @@ -668,7 +670,7 @@ class KindleOutput(OutputProfile): name = 'Kindle' short_name = 'kindle' - description = _('This profile is intended for the Amazon Kindle.') + description = 'This profile is intended for the Amazon Kindle.' # Screen size is a best guess screen_size = (525, 640) @@ -688,7 +690,7 @@ class KindleDXOutput(OutputProfile): name = 'Kindle DX' short_name = 'kindle_dx' - description = _('This profile is intended for the Amazon Kindle DX.') + description = 'This profile is intended for the Amazon Kindle DX.' # Screen size is a best guess screen_size = (744, 1022) @@ -706,7 +708,8 @@ class KindlePaperWhiteOutput(KindleOutput): name = 'Kindle PaperWhite' short_name = 'kindle_pw' - description = _('This profile is intended for the Amazon Kindle PaperWhite 1 and 2') + description = ('This profile is intended for the Amazon Kindle ' + 'PaperWhite 1 and 2') # Screen size is a best guess screen_size = (658, 940) @@ -718,7 +721,7 @@ class KindleVoyageOutput(KindleOutput): name = 'Kindle Voyage' short_name = 'kindle_voyage' - description = _('This profile is intended for the Amazon Kindle Voyage') + description = 'This profile is intended for the Amazon Kindle Voyage' # Screen size is currently just the spec size, actual renderable area will # depend on someone with the device doing tests. @@ -731,7 +734,8 @@ class KindlePaperWhite3Output(KindleVoyageOutput): name = 'Kindle PaperWhite 3' short_name = 'kindle_pw3' - description = _('This profile is intended for the Amazon Kindle PaperWhite 3 and above') + description = ('This profile is intended for the Amazon Kindle ' + 'PaperWhite 3 and above') # Screen size is currently just the spec size, actual renderable area will # depend on someone with the device doing tests. screen_size = (1072, 1430) @@ -743,7 +747,8 @@ class KindleOasisOutput(KindlePaperWhite3Output): name = 'Kindle Oasis' short_name = 'kindle_oasis' - description = _('This profile is intended for the Amazon Kindle Oasis 2017 and above') + description = ('This profile is intended for the Amazon Kindle Oasis ' + '2017 and above') # Screen size is currently just the spec size, actual renderable area will # depend on someone with the device doing tests. screen_size = (1264, 1680) @@ -755,7 +760,7 @@ class KindleFireOutput(KindleDXOutput): name = 'Kindle Fire' short_name = 'kindle_fire' - description = _('This profile is intended for the Amazon Kindle Fire.') + description = 'This profile is intended for the Amazon Kindle Fire.' screen_size = (570, 1016) dpi = 169.0 @@ -766,7 +771,7 @@ class IlliadOutput(OutputProfile): name = 'Illiad' short_name = 'illiad' - description = _('This profile is intended for the Irex Illiad.') + description = 'This profile is intended for the Irex Illiad.' screen_size = (760, 925) comic_screen_size = (760, 925) @@ -780,7 +785,7 @@ class IRexDR1000Output(OutputProfile): author = 'John Schember' name = 'IRex Digital Reader 1000' short_name = 'irexdr1000' - description = _('This profile is intended for the IRex Digital Reader 1000.') + description = 'This profile is intended for the IRex Digital Reader 1000.' # Screen size is a best guess screen_size = (1024, 1280) @@ -795,7 +800,7 @@ class IRexDR800Output(OutputProfile): author = 'Eric Cronin' name = 'IRex Digital Reader 800' short_name = 'irexdr800' - description = _('This profile is intended for the IRex Digital Reader 800.') + description = 'This profile is intended for the IRex Digital Reader 800.' # Screen size is a best guess screen_size = (768, 1024) @@ -810,7 +815,7 @@ class NookOutput(OutputProfile): author = 'John Schember' name = 'Nook' short_name = 'nook' - description = _('This profile is intended for the B&N Nook.') + description = 'This profile is intended for the B&N Nook.' # Screen size is a best guess screen_size = (600, 730) @@ -823,7 +828,7 @@ class NookOutput(OutputProfile): class NookColorOutput(NookOutput): name = 'Nook Color' short_name = 'nook_color' - description = _('This profile is intended for the B&N Nook Color.') + description = 'This profile is intended for the B&N Nook Color.' screen_size = (600, 900) comic_screen_size = (594, 900) @@ -835,7 +840,8 @@ class PocketBook900Output(OutputProfile): author = 'Chris Lockfort' name = 'PocketBook Pro 900' short_name = 'pocketbook_900' - description = _('This profile is intended for the PocketBook Pro 900 series of devices.') + description = ('This profile is intended for the PocketBook Pro 900 ' + 'series of devices.') screen_size = (810, 1180) dpi = 150.0 @@ -847,7 +853,8 @@ class PocketBookPro912Output(OutputProfile): author = 'Daniele Pizzolli' name = 'PocketBook Pro 912' short_name = 'pocketbook_pro_912' - description = _('This profile is intended for the PocketBook Pro 912 series of devices.') + description = ('This profile is intended for the PocketBook Pro 912 ' + 'series of devices.') # According to http://download.pocketbook-int.com/user-guides/E_Ink/912/User_Guide_PocketBook_912(EN).pdf screen_size = (825, 1200) diff --git a/ebook_converter/customize/ui.py b/ebook_converter/customize/ui.py index f6b4d3e..ee44679 100644 --- a/ebook_converter/customize/ui.py +++ b/ebook_converter/customize/ui.py @@ -12,7 +12,6 @@ from ebook_converter.customize import profiles from ebook_converter.customize import builtins from ebook_converter.ebooks import metadata from ebook_converter.utils import config as cfg -from ebook_converter import constants builtin_names = frozenset(p.name for p in builtins.plugins) @@ -25,13 +24,13 @@ class NameConflict(ValueError): def _config(): c = cfg.Config('customize') - c.add_opt('plugins', default={}, help=_('Installed plugins')) + c.add_opt('plugins', default={}, help='Installed plugins') c.add_opt('filetype_mapping', default={}, - help=_('Mapping for filetype plugins')) + help='Mapping for filetype plugins') c.add_opt('plugin_customization', default={}, - help=_('Local plugin customization')) - c.add_opt('disabled_plugins', default=set(), help=_('Disabled plugins')) - c.add_opt('enabled_plugins', default=set(), help=_('Enabled plugins')) + help='Local plugin customization') + c.add_opt('disabled_plugins', default=set(), help='Disabled plugins') + c.add_opt('enabled_plugins', default=set(), help='Enabled plugins') return cfg.ConfigProxy(c) @@ -459,8 +458,8 @@ def initialize_plugin(plugin, path_to_zip_file): except Exception: print('Failed to initialize plugin:', plugin.name, plugin.version) tb = traceback.format_exc() - raise customize.InvalidPlugin((_('Initialization of plugin %s failed ' - 'with traceback:') % tb) + '\n'+tb) + raise customize.InvalidPlugin(('Initialization of plugin %s failed ' + 'with traceback:' % tb) + '\n'+tb) def has_external_plugins(): @@ -501,25 +500,29 @@ def initialized_plugins(): # CLI def option_parser(): - parser = cfg.OptionParser(usage=_('''\ + parser = cfg.OptionParser(usage='''\ %prog options Customize calibre by loading external plugins. - ''')) + ''') parser.add_option('-a', '--add-plugin', default=None, - help=_('Add a plugin by specifying the path to the ZIP file containing it.')) + help='Add a plugin by specifying the path to the ZIP ' + 'file containing it.') parser.add_option('-b', '--build-plugin', default=None, - help=_('For plugin developers: Path to the directory where you are' - ' developing the plugin. This command will automatically zip ' - 'up the plugin and update it in calibre.')) + help='For plugin developers: Path to the directory ' + 'where you are developing the plugin. This command will ' + 'automatically zip up the plugin and update it in ' + 'calibre.') parser.add_option('-r', '--remove-plugin', default=None, - help=_('Remove a custom plugin by name. Has no effect on builtin plugins')) + help='Remove a custom plugin by name. Has no effect on ' + 'builtin plugins') parser.add_option('--customize-plugin', default=None, - help=_('Customize plugin. Specify name of plugin and customization string separated by a comma.')) - parser.add_option('-l', '--list-plugins', default=False, action='store_true', - help=_('List all installed plugins')) + help='Customize plugin. Specify name of plugin and ' + 'customization string separated by a comma.') + parser.add_option('-l', '--list-plugins', default=False, + action='store_true', help='List all installed plugins') parser.add_option('--enable-plugin', default=None, - help=_('Enable the named plugin')) + help='Enable the named plugin') parser.add_option('--disable-plugin', default=None, - help=_('Disable the named plugin')) + help='Disable the named plugin') return parser diff --git a/ebook_converter/customize/zipplugin.py b/ebook_converter/customize/zipplugin.py deleted file mode 100644 index 8a542ca..0000000 --- a/ebook_converter/customize/zipplugin.py +++ /dev/null @@ -1,111 +0,0 @@ -""" -PEP 302 based plugin loading mechanism, works around the bug in zipimport in -python 2.x that prevents importing from zip files in locations whose paths -have non ASCII characters -""" -import os, zipfile, posixpath, importlib, threading, re, imp, sys -from collections import OrderedDict -from functools import partial - -from ebook_converter import as_unicode -from ebook_converter.customize import (Plugin, numeric_version, platform, - InvalidPlugin, PluginNotFound) -from ebook_converter.polyglot.builtins import reload - - -__license__ = 'GPL v3' -__copyright__ = '2011, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - - -def get_resources(zfp, name_or_list_of_names): - ''' - Load resources from the plugin zip file - - :param name_or_list_of_names: List of paths to resources in the zip file using / as - separator, or a single path - - :return: A dictionary of the form ``{name : file_contents}``. Any names - that were not found in the zip file will not be present in the - dictionary. If a single path is passed in the return value will - be just the bytes of the resource or None if it wasn't found. - ''' - names = name_or_list_of_names - if isinstance(names, (str, bytes)): - names = [names] - ans = {} - with zipfile.ZipFile(zfp) as zf: - for name in names: - try: - ans[name] = zf.read(name) - except: - import traceback - traceback.print_exc() - if len(names) == 1: - ans = ans.pop(names[0], None) - - return ans - - -def get_icons(zfp, name_or_list_of_names): - ''' - Load icons from the plugin zip file - - :param name_or_list_of_names: List of paths to resources in the zip file using / as - separator, or a single path - - :return: A dictionary of the form ``{name : QIcon}``. Any names - that were not found in the zip file will be null QIcons. - If a single path is passed in the return value will - be A QIcon. - ''' - from PyQt5.Qt import QIcon, QPixmap - names = name_or_list_of_names - ans = get_resources(zfp, names) - if isinstance(names, (str, bytes)): - names = [names] - if ans is None: - ans = {} - if isinstance(ans, (str, bytes)): - ans = dict([(names[0], ans)]) - - ians = {} - for name in names: - p = QPixmap() - raw = ans.get(name, None) - if raw: - p.loadFromData(raw) - ians[name] = QIcon(p) - if len(names) == 1: - ians = ians.pop(names[0]) - return ians - - -_translations_cache = {} - - -def load_translations(namespace, zfp): - null = object() - trans = _translations_cache.get(zfp, null) - if trans is None: - return - if trans is null: - from ebook_converter.utils.localization import get_lang - lang = get_lang() - if not lang or lang == 'en': # performance optimization - _translations_cache[zfp] = None - return - with zipfile.ZipFile(zfp) as zf: - try: - mo = zf.read('translations/%s.mo' % lang) - except KeyError: - mo = None # No translations for this language present - if mo is None: - _translations_cache[zfp] = None - return - from gettext import GNUTranslations - from io import BytesIO - trans = _translations_cache[zfp] = GNUTranslations(BytesIO(mo)) - - namespace['_'] = getattr(trans, 'gettext') - namespace['ngettext'] = getattr(trans, 'ngettext') diff --git a/ebook_converter/devices/interface.py b/ebook_converter/devices/interface.py index 52b9676..40c46bc 100644 --- a/ebook_converter/devices/interface.py +++ b/ebook_converter/devices/interface.py @@ -15,7 +15,7 @@ class DevicePlugin(Plugin): Defines the interface that should be implemented by backends that communicate with an e-book reader. """ - type = _('Device interface') + type = 'Device interface' #: Ordered list of supported formats FORMATS = ["lrf", "rtf", "pdf", "txt"] @@ -60,7 +60,7 @@ class DevicePlugin(Plugin): # Set this to None if the books on the device are files that the GUI can # access in order to add the books from the device to the library - BACKLOADING_ERROR_MESSAGE = _('Cannot get files from this device') + BACKLOADING_ERROR_MESSAGE = 'Cannot get files from this device' #: Path separator for paths to books on device path_sep = os.sep diff --git a/ebook_converter/ebooks/conversion/cli.py b/ebook_converter/ebooks/conversion/cli.py index a8286fc..b71c9e9 100644 --- a/ebook_converter/ebooks/conversion/cli.py +++ b/ebook_converter/ebooks/conversion/cli.py @@ -14,7 +14,7 @@ from ebook_converter import patheq from ebook_converter.utils.localization import localize_user_manual_link -USAGE = '%prog ' + _('''\ +USAGE = '%prog ' + '''\ input_file output_file [options] Convert an e-book from one format to another. @@ -38,7 +38,8 @@ To get help on them specify the input and output file and then use the -h \ option. For full documentation of the conversion system see -''') + localize_user_manual_link('https://manual.calibre-ebook.com/conversion.html') +https://manual.calibre-ebook.com/conversion.html +''' HEURISTIC_OPTIONS = ['markup_chapter_headings', 'italicize_common_cases', 'fix_indents', @@ -98,21 +99,20 @@ def option_recommendation_to_cli_option(add_option, rec): if opt.name == 'read_metadata_from_opf': switches.append('--from-opf') if opt.name == 'transform_css_rules': - attrs['help'] = _( - 'Path to a file containing rules to transform the CSS styles' - ' in this book. The easiest way to create such a file is to' - ' use the wizard for creating rules in the calibre GUI. Access' - ' it in the "Look & feel->Transform styles" section of the conversion' - ' dialog. Once you create the rules, you can use the "Export" button' - ' to save them to a file.' - ) + attrs['help'] = ('Path to a file containing rules to transform the ' + 'CSS styles in this book. The easiest way to create ' + 'such a file is to use the wizard for creating rules ' + 'in the calibre GUI. Access it in the "Look & ' + 'feel->Transform styles" section of the conversion ' + 'dialog. Once you create the rules, you can use the ' + '"Export" button to save them to a file.') if opt.name in DEFAULT_TRUE_OPTIONS and rec.recommended_value is True: switches = ['--disable-'+opt.long_switch] add_option(optparse.Option(*switches, **attrs)) def group_titles(): - return _('INPUT OPTIONS'), _('OUTPUT OPTIONS') + return 'INPUT OPTIONS', 'OUTPUT OPTIONS' def recipe_test(option, opt_str, value, parser): @@ -160,15 +160,17 @@ def add_input_output_options(parser, plumber): if input_options: title = group_titles()[0] - io = optparse.OptionGroup(parser, title, _('Options to control the processing' - ' of the input %s file')%plumber.input_fmt) + io = optparse.OptionGroup(parser, title, 'Options to control the ' + 'processing of the input %s file' % + plumber.input_fmt) add_options(io.add_option, input_options) parser.add_option_group(io) if output_options: title = group_titles()[1] - oo = optparse.OptionGroup(parser, title, _('Options to control the processing' - ' of the output %s')%plumber.output_fmt) + oo = optparse.OptionGroup(parser, title, 'Options to control the ' + 'processing of the output %s' % + plumber.output_fmt) add_options(oo.add_option, output_options) parser.add_option_group(oo) @@ -181,8 +183,8 @@ def add_pipeline_options(parser, plumber): 'output_profile', ] )), - (_('LOOK AND FEEL') , ( - _('Options to control the look and feel of the output'), + ('LOOK AND FEEL' , ( + 'Options to control the look and feel of the output', [ 'base_font_size', 'disable_font_rescaling', 'font_size_mapping', 'embed_font_family', @@ -200,26 +202,23 @@ def add_pipeline_options(parser, plumber): ] )), - (_('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-*'), + ('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') , ( - _('Modify the document text and structure using user defined patterns.'), - [ - 'sr1_search', 'sr1_replace', - 'sr2_search', 'sr2_replace', - 'sr3_search', 'sr3_replace', - 'search_replace', - ] + ('SEARCH AND REPLACE' , + ('Modify the document text and structure using user defined ' + 'patterns.', + ['sr1_search', 'sr1_replace', 'sr2_search', 'sr2_replace', + 'sr3_search', 'sr3_replace', 'search_replace'] )), - (_('STRUCTURE DETECTION') , ( - _('Control auto-detection of document structure.'), + ('STRUCTURE DETECTION' , ( + 'Control auto-detection of document structure.', [ 'chapter', 'chapter_mark', 'prefer_metadata_cover', 'remove_first_image', @@ -228,21 +227,20 @@ def add_pipeline_options(parser, plumber): ] )), - (_('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.'), - [ - 'level1_toc', 'level2_toc', 'level3_toc', - 'toc_threshold', 'max_toc_links', 'no_chapters_in_toc', - 'use_auto_toc', 'toc_filter', 'duplicate_links_in_toc', - ] - )), + ('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.', + ['level1_toc', 'level2_toc', 'level3_toc', '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', @@ -265,9 +263,9 @@ def add_pipeline_options(parser, plumber): def option_parser(): parser = OptionParser(usage=USAGE) parser.add_option('--list-recipes', default=False, action='store_true', - help=_('List builtin recipe names. You can create an e-book from ' - 'a builtin recipe like this: ebook-convert "Recipe Name.recipe" ' - 'output.epub')) + help='List builtin recipe names. You can create an e-book from ' + 'a builtin recipe like this: ebook-convert "Recipe ' + 'Name.recipe" output.epub') return parser @@ -393,20 +391,20 @@ def main(args=sys.argv): plumber.run() - log(_('Output saved to'), ' ', plumber.output) + log('Output saved to', ' ', plumber.output) return 0 def manual_index_strings(): - return _('''\ + return '''\ The options and default values for the options change depending on both the input and output formats, so you should always check with:: %s Below are the options that are common to all conversion, followed by the -options specific to every input and output format.''') +options specific to every input and output format.''' if __name__ == '__main__': diff --git a/ebook_converter/ebooks/conversion/plugins/chm_input.py b/ebook_converter/ebooks/conversion/plugins/chm_input.py index d6d01ff..e41b9e7 100644 --- a/ebook_converter/ebooks/conversion/plugins/chm_input.py +++ b/ebook_converter/ebooks/conversion/plugins/chm_input.py @@ -191,7 +191,7 @@ class CHMInput(InputFormatPlugin): title = param.attrib['value'] elif match_string(param.attrib['name'], 'local'): href = param.attrib['value'] - child = toc.add(title or _('Unknown'), href) + child = toc.add(title or 'Unknown', href) ancestor_map[node] = child def _process_nodes(self, root): diff --git a/ebook_converter/ebooks/conversion/plugins/comic_input.py b/ebook_converter/ebooks/conversion/plugins/comic_input.py index 382a77f..c95e02d 100644 --- a/ebook_converter/ebooks/conversion/plugins/comic_input.py +++ b/ebook_converter/ebooks/conversion/plugins/comic_input.py @@ -25,51 +25,54 @@ class ComicInput(InputFormatPlugin): options = { OptionRecommendation(name='colors', recommended_value=0, - help=_('Reduce the number of colors used in the image. This works only' - ' if you choose the PNG output format. It is useful to reduce file sizes.' - ' Set to zero to turn off. Maximum value is 256. It is off by default.')), + help='Reduce the number of colors used in the image. This works ' + 'only if you choose the PNG output format. It is useful to ' + 'reduce file sizes. Set to zero to turn off. Maximum value ' + 'is 256. It is off by default.'), OptionRecommendation(name='dont_normalize', recommended_value=False, - help=_('Disable normalize (improve contrast) color range ' - 'for pictures. Default: False')), + help='Disable normalize (improve contrast) color range ' + 'for pictures. Default: False'), OptionRecommendation(name='keep_aspect_ratio', recommended_value=False, - help=_('Maintain picture aspect ratio. Default is to fill the screen.')), + help='Maintain picture aspect ratio. Default is to fill the ' + 'screen.'), OptionRecommendation(name='dont_sharpen', recommended_value=False, - help=_('Disable sharpening.')), + help='Disable sharpening.'), OptionRecommendation(name='disable_trim', recommended_value=False, - help=_('Disable trimming of comic pages. For some comics, ' - 'trimming might remove content as well as borders.')), + help='Disable trimming of comic pages. For some comics, trimming ' + 'might remove content as well as borders.'), OptionRecommendation(name='landscape', recommended_value=False, - help=_("Don't split landscape images into two portrait images")), + help="Don't split landscape images into two portrait images"), OptionRecommendation(name='wide', recommended_value=False, - help=_("Keep aspect ratio and scale image using screen height as " - "image width for viewing in landscape mode.")), + help="Keep aspect ratio and scale image using screen height as " + "image width for viewing in landscape mode."), OptionRecommendation(name='right2left', recommended_value=False, - help=_('Used for right-to-left publications like manga. ' - 'Causes landscape pages to be split into portrait pages ' - 'from right to left.')), + help='Used for right-to-left publications like manga. ' + 'Causes landscape pages to be split into portrait pages ' + 'from right to left.'), OptionRecommendation(name='despeckle', recommended_value=False, - help=_('Enable Despeckle. Reduces speckle noise. ' - 'May greatly increase processing time.')), + help='Enable Despeckle. Reduces speckle noise. May greatly ' + 'increase processing time.'), OptionRecommendation(name='no_sort', recommended_value=False, - help=_("Don't sort the files found in the comic " - "alphabetically by name. Instead use the order they were " - "added to the comic.")), + help="Don't sort the files found in the comic " + "alphabetically by name. Instead use the order they were " + "added to the comic."), OptionRecommendation(name='output_format', choices=['png', 'jpg'], - recommended_value='png', help=_('The format that images in the created e-book ' - 'are converted to. You can experiment to see which format gives ' - 'you optimal size and look on your device.')), + recommended_value='png', + help='The format that images in the created e-book are ' + 'converted to. You can experiment to see which format ' + 'gives you optimal size and look on your device.'), OptionRecommendation(name='no_process', recommended_value=False, - help=_("Apply no processing to the image")), + help="Apply no processing to the image"), OptionRecommendation(name='dont_grayscale', recommended_value=False, - help=_('Do not convert the image to grayscale (black and white)')), + help='Do not convert the image to grayscale (black and white)'), OptionRecommendation(name='comic_image_size', recommended_value=None, - help=_('Specify the image size as widthxheight pixels. Normally,' - ' an image size is automatically calculated from the output ' - 'profile, this option overrides it.')), + help='Specify the image size as widthxheight pixels. Normally,' + ' an image size is automatically calculated from the output ' + 'profile, this option overrides it.'), OptionRecommendation(name='dont_add_comic_pages_to_toc', recommended_value=False, - help=_('When converting a CBC do not add links to each page to' - ' the TOC. Note this only applies if the TOC has more than one' - ' section')), + help='When converting a CBC do not add links to each page to' + ' the TOC. Note this only applies if the TOC has more than ' + 'one section'), } recommendations = { @@ -192,7 +195,7 @@ class ComicInput(InputFormatPlugin): raise ValueError('No comic pages found in %s'%stream.name) mi = MetaInformation(os.path.basename(stream.name).rpartition('.')[0], - [_('Unknown')]) + ['Unknown']) opf = OPFCreator(os.getcwd(), mi) entries = [] @@ -222,7 +225,7 @@ class ComicInput(InputFormatPlugin): if len(comics) == 1: wrappers = comics[0][2] for i, x in enumerate(wrappers): - toc.add_item(href(x), None, _('Page')+' %d'%(i+1), + toc.add_item(href(x), None, 'Page %d' % (i+1), play_order=i) else: po = 0 @@ -234,7 +237,7 @@ class ComicInput(InputFormatPlugin): if not opts.dont_add_comic_pages_to_toc: for i, x in enumerate(wrappers): stoc.add_item(href(x), None, - _('Page')+' %d'%(i+1), play_order=po) + 'Page %d' % (i+1), play_order=po) po += 1 opf.set_toc(toc) with open('metadata.opf', 'wb') as m, open('toc.ncx', 'wb') as n: diff --git a/ebook_converter/ebooks/conversion/plugins/docx_input.py b/ebook_converter/ebooks/conversion/plugins/docx_input.py index 5012a6e..ef48842 100644 --- a/ebook_converter/ebooks/conversion/plugins/docx_input.py +++ b/ebook_converter/ebooks/conversion/plugins/docx_input.py @@ -8,19 +8,21 @@ __copyright__ = '2013, Kovid Goyal ' class DOCXInput(InputFormatPlugin): name = 'DOCX Input' author = 'Kovid Goyal' - description = _('Convert DOCX files (.docx and .docm) to HTML') + description = 'Convert DOCX files (.docx and .docm) to HTML' file_types = {'docx', 'docm'} commit_name = 'docx_input' options = { OptionRecommendation(name='docx_no_cover', recommended_value=False, - help=_('Normally, if a large image is present at the start of the document that looks like a cover, ' - 'it will be removed from the document and used as the cover for created e-book. This option ' - 'turns off that behavior.')), + help='Normally, if a large image is present at the start of the ' + 'document that looks like a cover, it will be removed from ' + 'the document and used as the cover for created e-book. This ' + 'option turns off that behavior.'), OptionRecommendation(name='docx_no_pagebreaks_between_notes', recommended_value=False, - help=_('Do not insert a page break after every endnote.')), + help='Do not insert a page break after every endnote.'), OptionRecommendation(name='docx_inline_subsup', recommended_value=False, - help=_('Render superscripts and subscripts so that they do not affect the line height.')), + help='Render superscripts and subscripts so that they do not ' + 'affect the line height.'), } recommendations = {('page_breaks_before', '/', OptionRecommendation.MED)} diff --git a/ebook_converter/ebooks/conversion/plugins/docx_output.py b/ebook_converter/ebooks/conversion/plugins/docx_output.py index 6ea0cf2..f1ea4eb 100644 --- a/ebook_converter/ebooks/conversion/plugins/docx_output.py +++ b/ebook_converter/ebooks/conversion/plugins/docx_output.py @@ -19,52 +19,52 @@ class DOCXOutput(OutputFormatPlugin): options = { OptionRecommendation(name='docx_page_size', recommended_value='letter', level=OptionRecommendation.LOW, choices=PAGE_SIZES, - help=_('The size of the page. Default is letter. Choices ' - 'are %s') % PAGE_SIZES), + help='The size of the page. Default is letter. Choices ' + 'are %s' % PAGE_SIZES), OptionRecommendation(name='docx_custom_page_size', recommended_value=None, - help=_('Custom size of the document. Use the form widthxheight ' + help='Custom size of the document. Use the form widthxheight ' 'EG. `123x321` to specify the width and height (in pts). ' - 'This overrides any specified page-size.')), + 'This overrides any specified page-size.'), OptionRecommendation(name='docx_no_cover', recommended_value=False, - help=_('Do not insert the book cover as an image at the start of the document.' - ' If you use this option, the book cover will be discarded.')), + help='Do not insert the book cover as an image at the start of the document.' + ' If you use this option, the book cover will be discarded.'), OptionRecommendation(name='preserve_cover_aspect_ratio', recommended_value=False, - help=_('Preserve the aspect ratio of the cover image instead of stretching' - ' it out to cover the entire page.')), + help='Preserve the aspect ratio of the cover image instead of stretching' + ' it out to cover the entire page.'), OptionRecommendation(name='docx_no_toc', recommended_value=False, - help=_('Do not insert the table of contents as a page at the start of the document.')), + help='Do not insert the table of contents as a page at the start of the document.'), OptionRecommendation(name='extract_to', - help=_('Extract the contents of the generated %s file to the ' + help='Extract the contents of the generated %s file to the ' 'specified directory. The contents of the directory are first ' - 'deleted, so be careful.') % 'DOCX'), + 'deleted, so be careful.' % 'DOCX'), OptionRecommendation(name='docx_page_margin_left', recommended_value=72.0, level=OptionRecommendation.LOW, - help=_('The size of the left page margin, in pts. Default is 72pt.' - ' Overrides the common left page margin setting.') + help='The size of the left page margin, in pts. Default is 72pt.' + ' Overrides the common left page margin setting.' ), OptionRecommendation(name='docx_page_margin_top', recommended_value=72.0, level=OptionRecommendation.LOW, - help=_('The size of the top page margin, in pts. Default is 72pt.' - ' Overrides the common top page margin setting, unless set to zero.') + help='The size of the top page margin, in pts. Default is 72pt.' + ' Overrides the common top page margin setting, unless set to zero.' ), OptionRecommendation(name='docx_page_margin_right', recommended_value=72.0, level=OptionRecommendation.LOW, - help=_('The size of the right page margin, in pts. Default is 72pt.' - ' Overrides the common right page margin setting, unless set to zero.') + help='The size of the right page margin, in pts. Default is 72pt.' + ' Overrides the common right page margin setting, unless set to zero.' ), OptionRecommendation(name='docx_page_margin_bottom', recommended_value=72.0, level=OptionRecommendation.LOW, - help=_('The size of the bottom page margin, in pts. Default is 72pt.' - ' Overrides the common bottom page margin setting, unless set to zero.') + help='The size of the bottom page margin, in pts. Default is 72pt.' + ' Overrides the common bottom page margin setting, unless set to zero.' ), } diff --git a/ebook_converter/ebooks/conversion/plugins/epub_output.py b/ebook_converter/ebooks/conversion/plugins/epub_output.py index 97578ae..9f522d7 100644 --- a/ebook_converter/ebooks/conversion/plugins/epub_output.py +++ b/ebook_converter/ebooks/conversion/plugins/epub_output.py @@ -3,8 +3,9 @@ import re import shutil import urllib.parse -from ebook_converter.customize.conversion import (OutputFormatPlugin, - OptionRecommendation) +from ebook_converter.customize.conversion import OutputFormatPlugin +from ebook_converter.customize.conversion import OptionRecommendation + from ebook_converter.ptempfile import TemporaryDirectory from ebook_converter import CurrentDir from ebook_converter.polyglot.builtins import as_bytes @@ -53,78 +54,79 @@ class EPUBOutput(OutputFormatPlugin): options = { OptionRecommendation(name='extract_to', - help=_('Extract the contents of the generated %s file to the ' - 'specified directory. The contents of the directory are first ' - 'deleted, so be careful.') % 'EPUB'), + help='Extract the contents of the generated %s file to the ' + 'specified directory. The contents of the directory are ' + 'first deleted, so be careful.' % 'EPUB'), OptionRecommendation(name='dont_split_on_page_breaks', recommended_value=False, level=OptionRecommendation.LOW, - help=_('Turn off splitting at page breaks. Normally, input ' - 'files are automatically split at every page break into ' - 'two files. This gives an output e-book that can be ' - 'parsed faster and with less resources. However, ' - 'splitting is slow and if your source file contains a ' - 'very large number of page breaks, you should turn off ' - 'splitting on page breaks.' - ) + help='Turn off splitting at page breaks. Normally, input ' + 'files are automatically split at every page break into ' + 'two files. This gives an output e-book that can be ' + 'parsed faster and with less resources. However, ' + 'splitting is slow and if your source file contains a ' + 'very large number of page breaks, you should turn off ' + 'splitting on page breaks.' ), OptionRecommendation(name='flow_size', recommended_value=260, - help=_('Split all HTML files larger than this size (in KB). ' - 'This is necessary as most EPUB readers cannot handle large ' - 'file sizes. The default of %defaultKB is the size required ' - 'for Adobe Digital Editions. Set to 0 to disable size based splitting.') + help='Split all HTML files larger than this size (in KB). ' + 'This is necessary as most EPUB readers cannot handle large ' + 'file sizes. The default of %defaultKB is the size required ' + 'for Adobe Digital Editions. Set to 0 to disable size based ' + 'splitting.' ), OptionRecommendation(name='no_default_epub_cover', recommended_value=False, - help=_('Normally, if the input file has no cover and you don\'t' + help='Normally, if the input file has no cover and you don\'t' ' specify one, a default cover is generated with the title, ' - 'authors, etc. This option disables the generation of this cover.') + 'authors, etc. This option disables the generation of this cover.' ), OptionRecommendation(name='no_svg_cover', recommended_value=False, - help=_('Do not use SVG for the book cover. Use this option if ' + help='Do not use SVG for the book cover. Use this option if ' 'your EPUB is going to be used on a device that does not ' 'support SVG, like the iPhone or the JetBook Lite. ' 'Without this option, such devices will display the cover ' - 'as a blank page.') + 'as a blank page.' ), OptionRecommendation(name='preserve_cover_aspect_ratio', - recommended_value=False, help=_( - 'When using an SVG cover, this option will cause the cover to scale ' - 'to cover the available screen area, but still preserve its aspect ratio ' - '(ratio of width to height). That means there may be white borders ' - 'at the sides or top and bottom of the image, but the image will ' - 'never be distorted. Without this option the image may be slightly ' - 'distorted, but there will be no borders.' - ) + recommended_value=False, + help='When using an SVG cover, this option will cause the cover ' + 'to scale to cover the available screen area, but still ' + 'preserve its aspect ratio (ratio of width to height). That ' + 'means there may be white borders at the sides or top and ' + 'bottom of the image, but the image will never be distorted. ' + 'Without this option the image may be slightly distorted, ' + 'but there will be no borders.' ), OptionRecommendation(name='epub_flatten', recommended_value=False, - help=_('This option is needed only if you intend to use the EPUB' - ' with FBReaderJ. It will flatten the file system inside the' - ' EPUB, putting all files into the top level.') + help='This option is needed only if you intend to use the EPUB' + ' with FBReaderJ. It will flatten the file system inside the' + ' EPUB, putting all files into the top level.' ), OptionRecommendation(name='epub_inline_toc', recommended_value=False, - help=_('Insert an inline Table of Contents that will appear as part of the main book content.') + help='Insert an inline Table of Contents that will appear as part ' + 'of the main book content.' ), OptionRecommendation(name='epub_toc_at_end', recommended_value=False, - help=_('Put the inserted inline Table of Contents at the end of the book instead of the start.') + help='Put the inserted inline Table of Contents at the end of ' + 'the book instead of the start.' ), OptionRecommendation(name='toc_title', recommended_value=None, - help=_('Title for any generated in-line table of contents.') + help='Title for any generated in-line table of contents.' ), OptionRecommendation(name='epub_version', recommended_value='2', choices=ui_data['versions'], - help=_('The version of the EPUB file to generate. EPUB 2 is the' - ' most widely compatible, only use EPUB 3 if you know you' - ' actually need it.') - ), - + help='The version of the EPUB file to generate. EPUB 2 is the ' + 'most widely compatible, only use EPUB 3 if you know you ' + 'actually need it.' + ) } recommendations = {('pretty_print', True, OptionRecommendation.HIGH)} @@ -219,7 +221,7 @@ class EPUBOutput(OutputFormatPlugin): self.log.warn('This EPUB file has no Table of Contents. ' 'Creating a default TOC') first = next(iter(self.oeb.spine)) - self.oeb.toc.add(_('Start'), first.href) + self.oeb.toc.add('Start', first.href) from ebook_converter.ebooks.oeb.base import OPF identifiers = oeb.metadata['identifier'] diff --git a/ebook_converter/ebooks/conversion/plugins/fb2_input.py b/ebook_converter/ebooks/conversion/plugins/fb2_input.py index a273cff..c84ea79 100644 --- a/ebook_converter/ebooks/conversion/plugins/fb2_input.py +++ b/ebook_converter/ebooks/conversion/plugins/fb2_input.py @@ -32,8 +32,7 @@ class FB2Input(InputFormatPlugin): options = { OptionRecommendation(name='no_inline_fb2_toc', recommended_value=False, level=OptionRecommendation.LOW, - help=_('Do not insert a Table of Contents at the beginning of the book.' - ) + help='Do not insert a Table of Contents at the beginning of the book.' )} def convert(self, stream, options, file_ext, log, @@ -129,9 +128,9 @@ class FB2Input(InputFormatPlugin): stream.seek(0) mi = get_metadata(stream, 'fb2') if not mi.title: - mi.title = _('Unknown') + mi.title = 'Unknown' if not mi.authors: - mi.authors = [_('Unknown')] + mi.authors = ['Unknown'] cpath = None if mi.cover_data and mi.cover_data[1]: with open('fb2_cover_calibre_mi.jpg', 'wb') as f: diff --git a/ebook_converter/ebooks/conversion/plugins/fb2_output.py b/ebook_converter/ebooks/conversion/plugins/fb2_output.py index e1b7883..64fa9f6 100644 --- a/ebook_converter/ebooks/conversion/plugins/fb2_output.py +++ b/ebook_converter/ebooks/conversion/plugins/fb2_output.py @@ -141,31 +141,31 @@ class FB2Output(OutputFormatPlugin): 'home_sex', # Erotica & sex 'home', # Other ] - ui_data = { - 'sectionize': { - 'toc': _('Section per entry in the ToC'), - 'files': _('Section per file'), - 'nothing': _('A single section') - }, - 'genres': FB2_GENRES, - } + ui_data = {'sectionize': {'toc': 'Section per entry in the ToC', + 'files': 'Section per file', + 'nothing': 'A single section'}, + 'genres': FB2_GENRES} options = { OptionRecommendation(name='sectionize', recommended_value='files', level=OptionRecommendation.LOW, choices=list(ui_data['sectionize']), - help=_('Specify how sections are created:\n' - ' * nothing: {nothing}\n' - ' * files: {files}\n' - ' * toc: {toc}\n' - 'If ToC based generation fails, adjust the "Structure detection" and/or "Table of Contents" settings ' - '(turn on "Force use of auto-generated Table of Contents").').format(**ui_data['sectionize']) + help='Specify how sections are created:\n' + ' * nothing: {nothing}\n' + ' * files: {files}\n' + ' * toc: {toc}\n' + 'If ToC based generation fails, adjust the "Structure ' + 'detection" and/or "Table of Contents" settings (turn on ' + '"Force use of auto-generated Table of Contents")' + '.'.format(**ui_data['sectionize']) ), OptionRecommendation(name='fb2_genre', recommended_value='antique', level=OptionRecommendation.LOW, choices=FB2_GENRES, - help=(_('Genre for the book. Choices: %s\n\n See: ') % ', '.join(FB2_GENRES) - ) + 'http://www.fictionbook.org/index.php/Eng:FictionBook_2.1_genres ' + _('for a complete list with descriptions.')), + help='Genre for the book. Choices: %s\n\n See: http://www.' + 'fictionbook.org/index.php/Eng:FictionBook_2.1_genres for a ' + 'complete list with descriptions.' % ', '.join(FB2_GENRES)), + } def convert(self, oeb_book, output_path, input_plugin, opts, log): diff --git a/ebook_converter/ebooks/conversion/plugins/html_input.py b/ebook_converter/ebooks/conversion/plugins/html_input.py index 1006efb..484c9c9 100644 --- a/ebook_converter/ebooks/conversion/plugins/html_input.py +++ b/ebook_converter/ebooks/conversion/plugins/html_input.py @@ -35,27 +35,24 @@ class HTMLInput(InputFormatPlugin): options = { OptionRecommendation(name='breadth_first', recommended_value=False, level=OptionRecommendation.LOW, - help=_('Traverse links in HTML files breadth first. Normally, ' + help='Traverse links in HTML files breadth first. Normally, ' 'they are traversed depth first.' - ) ), OptionRecommendation(name='max_levels', recommended_value=5, level=OptionRecommendation.LOW, - help=_('Maximum levels of recursion when following links in ' + help='Maximum levels of recursion when following links in ' 'HTML files. Must be non-negative. 0 implies that no ' 'links in the root HTML file are followed. Default is ' '%default.' - ) ), OptionRecommendation(name='dont_package', recommended_value=False, level=OptionRecommendation.LOW, - help=_('Normally this input plugin re-arranges all the input ' + help='Normally this input plugin re-arranges all the input ' 'files into a standard folder hierarchy. Only use this option ' 'if you know what you are doing as it can result in various ' 'nasty side effects in the rest of the conversion pipeline.' - ) ), } @@ -129,12 +126,12 @@ class HTMLInput(InputFormatPlugin): a = string_to_authors(a) if not a: oeb.logger.warn('Creator not specified') - a = [self.oeb.translate(__('Unknown'))] + a = [self.oeb.translate('Unknown')] for aut in a: metadata.add('creator', aut) if not metadata.title: oeb.logger.warn('Title not specified') - metadata.add('title', self.oeb.translate(__('Unknown'))) + metadata.add('title', self.oeb.translate('Unknown')) bookid = str(uuid.uuid4()) metadata.add('identifier', bookid, id='uuid_id', scheme='uuid') for ident in metadata.identifier: diff --git a/ebook_converter/ebooks/conversion/plugins/html_output.py b/ebook_converter/ebooks/conversion/plugins/html_output.py index de72192..49fa3df 100644 --- a/ebook_converter/ebooks/conversion/plugins/html_output.py +++ b/ebook_converter/ebooks/conversion/plugins/html_output.py @@ -30,18 +30,18 @@ class HTMLOutput(OutputFormatPlugin): options = { OptionRecommendation(name='template_css', - help=_('CSS file used for the output instead of the default file')), + help='CSS file used for the output instead of the default file'), OptionRecommendation(name='template_html_index', - help=_('Template used for generation of the HTML index file instead of the default file')), + help='Template used for generation of the HTML index file instead of the default file'), OptionRecommendation(name='template_html', - help=_('Template used for the generation of the HTML contents of the book instead of the default file')), + help='Template used for the generation of the HTML contents of the book instead of the default file'), OptionRecommendation(name='extract_to', - help=_('Extract the contents of the generated ZIP file to the ' + help='Extract the contents of the generated ZIP file to the ' 'specified directory. WARNING: The contents of the directory ' - 'will be deleted.') + 'will be deleted.' ), } diff --git a/ebook_converter/ebooks/conversion/plugins/htmlz_input.py b/ebook_converter/ebooks/conversion/plugins/htmlz_input.py index 4e9112e..6b55ecf 100644 --- a/ebook_converter/ebooks/conversion/plugins/htmlz_input.py +++ b/ebook_converter/ebooks/conversion/plugins/htmlz_input.py @@ -59,16 +59,17 @@ class HTMLZInput(InputFormatPlugin): # HTMLZ archive probably won't turn out as the user expects. With # Multiple HTML files ZIP input should be used in place of HTMLZ. if multiple_html: - log.warn(_('Multiple HTML files found in the archive. Only %s will be used.') % index) + log.warn('Multiple HTML files found in the archive. Only %s will ' + 'be used.' % index) if index: with open(index, 'rb') as tf: html = tf.read() else: - raise Exception(_('No top level HTML file found.')) + raise Exception('No top level HTML file found.') if not html: - raise Exception(_('Top level HTML file %s is empty') % index) + raise Exception('Top level HTML file %s is empty' % index) # Encoding if options.input_encoding: diff --git a/ebook_converter/ebooks/conversion/plugins/htmlz_output.py b/ebook_converter/ebooks/conversion/plugins/htmlz_output.py index c9c3f24..1e3c998 100644 --- a/ebook_converter/ebooks/conversion/plugins/htmlz_output.py +++ b/ebook_converter/ebooks/conversion/plugins/htmlz_output.py @@ -17,40 +17,33 @@ class HTMLZOutput(OutputFormatPlugin): author = 'John Schember' file_type = 'htmlz' commit_name = 'htmlz_output' - ui_data = { - 'css_choices': { - 'class': _('Use CSS classes'), - 'inline': _('Use the style attribute'), - 'tag': _('Use HTML tags wherever possible') - }, - 'sheet_choices': { - 'external': _('Use an external CSS file'), - 'inline': _('Use a