diff --git a/src/calibre/library/catalogs/epub_mobi.py b/src/calibre/library/catalogs/epub_mobi.py index cea87ea2ce..251db5cf88 100644 --- a/src/calibre/library/catalogs/epub_mobi.py +++ b/src/calibre/library/catalogs/epub_mobi.py @@ -16,6 +16,7 @@ from calibre.customize.conversion import OptionRecommendation, DummyReporter from calibre.ebooks import calibre_cover from calibre.library.catalogs import AuthorSortMismatchException, EmptyCatalogException from calibre.ptempfile import PersistentTemporaryFile +from calibre.utils.localization import get_lang Option = namedtuple('Option', 'option, default, dest, action, help') @@ -202,9 +203,12 @@ class EPUB_MOBI(CatalogPlugin): build_log = [] - build_log.append(u"%s(): Generating %s %sin %s environment" % - (self.name,self.fmt,'for %s ' % opts.output_profile if opts.output_profile else '', - 'CLI' if opts.cli_environment else 'GUI')) + build_log.append(u"%s(): Generating %s %sin %s environment, locale: '%s'" % + (self.name, + self.fmt, + 'for %s ' % opts.output_profile if opts.output_profile else '', + 'CLI' if opts.cli_environment else 'GUI', + get_lang())) # If exclude_genre is blank, assume user wants all tags as genres if opts.exclude_genre.strip() == '': diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index d194ef5845..892261520b 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -569,10 +569,12 @@ class CatalogBuilder(object): prefix (str): matched a prefix_rule None: no match """ - def _log_prefix_rule_match_info(rule, record): - self.opts.log.info(" %s '%s' by %s (Prefix rule '%s')" % + def _log_prefix_rule_match_info(rule, record, field_contents): + self.opts.log.info(" %s '%s' by %s (%s: '%s' contains '%s')" % (rule['prefix'],record['title'], - record['authors'][0], rule['name'])) + record['authors'][0], rule['name'], + self.db.metadata_for_field(rule['field'])['name'], + field_contents)) # Compare the record to each rule looking for a match for rule in self.prefix_rules: @@ -592,11 +594,15 @@ class CatalogBuilder(object): field_contents = None if field_contents is not None: + if self.db.metadata_for_field(rule['field'])['datatype'] == 'bool': + # For Yes/No fields, need to translate field_contents to + # locale version + field_contents = _(repr(field_contents)) try: if re.search(rule['pattern'], unicode(field_contents), re.IGNORECASE) is not None: if self.opts.verbose: - _log_prefix_rule_match_info(rule, record) + _log_prefix_rule_match_info(rule, record, field_contents) return rule['prefix'] except: if self.opts.verbose: @@ -604,7 +610,7 @@ class CatalogBuilder(object): pass elif field_contents is None and rule['pattern'] == 'None': if self.opts.verbose: - _log_prefix_rule_match_info(rule, record) + _log_prefix_rule_match_info(rule, record, field_contents) return rule['prefix'] return None @@ -4340,7 +4346,7 @@ class CatalogBuilder(object): """ Convert opts.prefix_rules to dict. Convert opts.prefix_rules to dict format. The model for a prefix rule is - ('','','','') + ('','<#source_field_lookup>','','') Input: opts.prefix_rules (tuples): (name, field, pattern, prefix)