1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-20 21:21:35 +02:00

Removed gettext related functions

This commit is contained in:
2020-05-03 19:00:20 +02:00
parent 35445cb736
commit 212cb56d42
92 changed files with 1505 additions and 1605 deletions
+17 -16
View File
@@ -30,78 +30,79 @@ class BIBTEX(CatalogPlugin):
default='all',
dest='fields',
action=None,
help=_('The fields to output when cataloging books in the '
help='The fields to output when cataloging books in the '
'database. Should be a comma-separated list of fields.\n'
'Available fields: %(fields)s.\n'
'plus user-created custom fields.\n'
'Example: %(opt)s=title,authors,tags\n'
"Default: '%%default'\n"
"Applies to: BIBTEX output format")%dict(
"Applies to: BIBTEX output format" % dict(
fields=', '.join(FIELDS), opt='--fields')),
Option('--sort-by',
default='id',
dest='sort_by',
action=None,
help=_('Output field to sort on.\n'
help='Output field to sort on.\n'
'Available fields: author_sort, id, rating, size, timestamp, title.\n'
"Default: '%default'\n"
"Applies to: BIBTEX output format")),
"Applies to: BIBTEX output format"),
Option('--create-citation',
default='True',
dest='impcit',
action=None,
help=_('Create a citation for BibTeX entries.\n'
help='Create a citation for BibTeX entries.\n'
'Boolean value: True, False\n'
"Default: '%default'\n"
"Applies to: BIBTEX output format")),
"Applies to: BIBTEX output format"),
Option('--add-files-path',
default='True',
dest='addfiles',
action=None,
help=_('Create a file entry if formats is selected for BibTeX entries.\n'
help='Create a file entry if formats is selected for BibTeX entries.\n'
'Boolean value: True, False\n'
"Default: '%default'\n"
"Applies to: BIBTEX output format")),
"Applies to: BIBTEX output format"),
Option('--citation-template',
default='{authors}{id}',
dest='bib_cit',
action=None,
help=_('The template for citation creation from database fields.\n'
help='The template for citation creation from database fields.\n'
'Should be a template with {} enclosed fields.\n'
'Available fields: %s.\n'
"Default: '%%default'\n"
"Applies to: BIBTEX output format")%', '.join(TEMPLATE_ALLOWED_FIELDS)),
"Applies to: BIBTEX output format" %
', '.join(TEMPLATE_ALLOWED_FIELDS)),
Option('--choose-encoding',
default='utf8',
dest='bibfile_enc',
action=None,
help=_('BibTeX file encoding output.\n'
help='BibTeX file encoding output.\n'
'Available types: utf8, cp1252, ascii.\n'
"Default: '%default'\n"
"Applies to: BIBTEX output format")),
"Applies to: BIBTEX output format"),
Option('--choose-encoding-configuration',
default='strict',
dest='bibfile_enctag',
action=None,
help=_('BibTeX file encoding flag.\n'
help='BibTeX file encoding flag.\n'
'Available types: strict, replace, ignore, backslashreplace.\n'
"Default: '%default'\n"
"Applies to: BIBTEX output format")),
"Applies to: BIBTEX output format"),
Option('--entry-type',
default='book',
dest='bib_entry',
action=None,
help=_('Entry type for BibTeX catalog.\n'
help='Entry type for BibTeX catalog.\n'
'Available types: book, misc, mixed.\n'
"Default: '%default'\n"
"Applies to: BIBTEX output format"))]
"Applies to: BIBTEX output format")]
def run(self, path_to_output, opts, db, notification=DummyReporter()):
from ebook_converter.utils.date import isoformat
+4 -4
View File
@@ -29,23 +29,23 @@ class CSV_XML(CatalogPlugin):
default='all',
dest='fields',
action=None,
help=_('The fields to output when cataloging books in the '
help='The fields to output when cataloging books in the '
'database. Should be a comma-separated list of fields.\n'
'Available fields: %(fields)s,\n'
'plus user-created custom fields.\n'
'Example: %(opt)s=title,authors,tags\n'
"Default: '%%default'\n"
"Applies to: CSV, XML output formats") % dict(
"Applies to: CSV, XML output formats" % dict(
fields=', '.join(FIELDS), opt='--fields')),
Option('--sort-by',
default='id',
dest='sort_by',
action=None,
help=_('Output field to sort on.\n'
help='Output field to sort on.\n'
'Available fields: author_sort, id, rating, size, timestamp, title_sort\n'
"Default: '%default'\n"
"Applies to: CSV, XML output formats"))]
"Applies to: CSV, XML output formats")]
def run(self, path_to_output, opts, db, notification=DummyReporter()):
from ebook_converter.library import current_library_name
+93 -66
View File
@@ -36,154 +36,178 @@ class EPUB_MOBI(CatalogPlugin):
default='My Books',
dest='catalog_title',
action=None,
help=_('Title of generated catalog used as title in metadata.\n'
help='Title of generated catalog used as title in '
'metadata.\n'
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--cross-reference-authors',
default=False,
dest='cross_reference_authors',
action='store_true',
help=_("Create cross-references in Authors section for books with multiple authors.\n"
help="Create cross-references in Authors section "
"for books with multiple authors.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--debug-pipeline',
default=None,
dest='debug_pipeline',
action=None,
help=_("Save the output from different stages of the conversion "
"pipeline to the specified "
"directory. Useful if you are unsure at which stage "
"of the conversion process a bug is occurring.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
default=None,
dest='debug_pipeline',
action=None,
help="Save the output from different stages of the "
"conversion pipeline to the specified directory. "
"Useful if you are unsure at which stage of the "
"conversion process a bug is occurring.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--exclude-genre',
default=r'\[.+\]|^\+$',
dest='exclude_genre',
action=None,
help=_("Regex describing tags to exclude as genres.\n"
"Default: '%default' excludes bracketed tags, e.g. '[Project Gutenberg]', and '+', the default tag for read books.\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
help="Regex describing tags to exclude as genres.\n"
"Default: '%default' excludes bracketed tags, e.g. "
"'[Project Gutenberg]', and '+', the default tag "
"for read books.\n"
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--exclusion-rules',
default="(('Catalogs','Tags','Catalog'),)",
dest='exclusion_rules',
action=None,
help=_("Specifies the rules used to exclude books from the generated catalog.\n"
"The model for an exclusion rule is either\n('<rule name>','Tags','<comma-separated list of tags>') or\n"
help="Specifies the rules used to exclude books "
"from the generated catalog.\n"
"The model for an exclusion rule is either\n"
"('<rule name>','Tags','<comma-separated list of "
"tags>') or\n"
"('<rule name>','<custom column>','<pattern>').\n"
"For example:\n"
"(('Archived books','#status','Archived'),)\n"
"will exclude a book with a value of 'Archived' in the custom column 'status'.\n"
"When multiple rules are defined, all rules will be applied.\n"
"Default: \n" + '"' + '%default' + '"' + "\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"will exclude a book with a value of 'Archived' in "
"the custom column 'status'.\n"
"When multiple rules are defined, all rules will be "
"applied.\n"
"Default: \n\"%default\"\n"
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--generate-authors',
default=False,
dest='generate_authors',
action='store_true',
help=_("Include 'Authors' section in catalog.\n"
help="Include 'Authors' section in catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--generate-descriptions',
default=False,
dest='generate_descriptions',
action='store_true',
help=_("Include 'Descriptions' section in catalog.\n"
help="Include 'Descriptions' section in catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--generate-genres',
default=False,
dest='generate_genres',
action='store_true',
help=_("Include 'Genres' section in catalog.\n"
help="Include 'Genres' section in catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--generate-titles',
default=False,
dest='generate_titles',
action='store_true',
help=_("Include 'Titles' section in catalog.\n"
help="Include 'Titles' section in catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--generate-series',
default=False,
dest='generate_series',
action='store_true',
help=_("Include 'Series' section in catalog.\n"
help="Include 'Series' section in catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--generate-recently-added',
default=False,
dest='generate_recently_added',
action='store_true',
help=_("Include 'Recently Added' section in catalog.\n"
help="Include 'Recently Added' section in catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--genre-source-field',
default=_('Tags'),
default='Tags',
dest='genre_source_field',
action=None,
help=_("Source field for 'Genres' section.\n"
help="Source field for 'Genres' section.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--header-note-source-field',
default='',
dest='header_note_source_field',
action=None,
help=_("Custom field containing note text to insert in Description header.\n"
help="Custom field containing note text to insert "
"in Description header.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--merge-comments-rule',
default='::',
dest='merge_comments_rule',
action=None,
help=_("#<custom field>:[before|after]:[True|False] specifying:\n"
" <custom field> Custom field containing notes to merge with Comments\n"
" [before|after] Placement of notes with respect to Comments\n"
" [True|False] - A horizontal rule is inserted between notes and Comments\n"
help="#<custom field>:[before|after]:[True|False] "
"specifying:\n"
" <custom field> Custom field containing notes to "
"merge with Comments\n"
" [before|after] Placement of notes with respect "
"to Comments\n"
" [True|False] - A horizontal rule is inserted "
"between notes and Comments\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--output-profile',
default=None,
dest='output_profile',
action=None,
help=_("Specifies the output profile. In some cases, an output profile is required to optimize"
" the catalog for the device. For example, 'kindle' or 'kindle_dx' creates a structured"
" Table of Contents with Sections and Articles.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
help="Specifies the output profile. In some cases, "
"an output profile is required to optimize the "
"catalog for the device. For example, 'kindle' or "
"'kindle_dx' creates a structured Table of Contents "
"with Sections and Articles.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--prefix-rules',
default="(('Read books','tags','+','\u2713'),('Wishlist item','tags','Wishlist','\u00d7'))",
default="(('Read books','tags','+','\u2713'),"
"('Wishlist item','tags','Wishlist','\u00d7'))",
dest='prefix_rules',
action=None,
help=_("Specifies the rules used to include prefixes indicating read books, wishlist items and other user-specified prefixes.\n"
"The model for a prefix rule is ('<rule name>','<source field>','<pattern>','<prefix>').\n"
"When multiple rules are defined, the first matching rule will be used.\n"
help="Specifies the rules used to include prefixes "
"indicating read books, wishlist items and other "
"user-specified prefixes.\n"
"The model for a prefix rule is ('<rule name>',"
"'<source field>','<pattern>','<prefix>').\n"
"When multiple rules are defined, the first "
"matching rule will be used.\n"
"Default:\n" + '"' + '%default' + '"' + "\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--preset',
default=None,
dest='preset',
action=None,
help=_("Use a named preset created with the GUI catalog builder.\n"
"A preset specifies all settings for building a catalog.\n"
help="Use a named preset created with the GUI "
"catalog builder.\n"
"A preset specifies all settings for building a "
"catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--use-existing-cover',
default=False,
dest='use_existing_cover',
action='store_true',
help=_("Replace existing cover when generating the catalog.\n"
help="Replace existing cover when generating the "
"catalog.\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
"Applies to: AZW3, EPUB, MOBI output formats"),
Option('--thumb-width',
default='1.0',
dest='thumb_width',
action=None,
help=_("Size hint (in inches) for book covers in catalog.\n"
help="Size hint (in inches) for book covers in "
"catalog.\n"
"Range: 1.0 - 2.0\n"
"Default: '%default'\n"
"Applies to: AZW3, EPUB, MOBI output formats")),
]
"Applies to: AZW3, EPUB, MOBI output formats")]
# }}}
def run(self, path_to_output, opts, db, notification=DummyReporter()):
@@ -196,10 +220,12 @@ class EPUB_MOBI(CatalogPlugin):
available_presets = JSONConfig("catalog_presets")
if opts.preset not in available_presets:
if available_presets:
print(_('Error: Preset "%s" not found.' % opts.preset))
print(_('Stored presets: %s' % ', '.join([p for p in sorted(available_presets.keys())])))
print('Error: Preset "%s" not found.' % opts.preset)
print('Stored presets: %s' %
', '.join([p for p in
sorted(available_presets.keys())]))
else:
print(_('Error: No stored presets.'))
print('Error: No stored presets.')
return 1
# Copy the relevant preset values to the opts object
@@ -329,7 +355,8 @@ class EPUB_MOBI(CatalogPlugin):
opts.log.warn('\n*** No enabled Sections, terminating catalog generation ***')
return ["No Included Sections", "No enabled Sections.\nCheck E-book options tab\n'Included sections'\n"]
if opts.fmt == 'mobi' and sections_list == ['Descriptions']:
warning = _("\n*** Adding 'By authors' section required for MOBI output ***")
warning = ("\n*** Adding 'By authors' section required for MOBI "
"output ***")
opts.log.warn(warning)
sections_list.insert(0, 'Authors')
opts.generate_authors = True