mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Disambiguate ambiguous transaltable strings
This commit is contained in:
parent
ac6594b79e
commit
e17adec5e7
@ -446,7 +446,8 @@ class ITUNES(DriverBase):
|
||||
}
|
||||
|
||||
if self.report_progress is not None:
|
||||
self.report_progress((i+1)/book_count, _('%d of %d') % (i+1, book_count))
|
||||
self.report_progress((i+1)/book_count,
|
||||
_('%(num)d of %(tot)d') % dict(num=i+1, tot=book_count))
|
||||
self._purge_orphans(library_books, cached_books)
|
||||
|
||||
elif iswindows:
|
||||
@ -485,7 +486,8 @@ class ITUNES(DriverBase):
|
||||
|
||||
if self.report_progress is not None:
|
||||
self.report_progress((i+1)/book_count,
|
||||
_('%d of %d') % (i+1, book_count))
|
||||
_('%(num)d of %(tot)d') % dict(num=i+1,
|
||||
tot=book_count))
|
||||
self._purge_orphans(library_books, cached_books)
|
||||
|
||||
finally:
|
||||
@ -1075,7 +1077,8 @@ class ITUNES(DriverBase):
|
||||
|
||||
# Report progress
|
||||
if self.report_progress is not None:
|
||||
self.report_progress((i+1)/file_count, _('%d of %d') % (i+1, file_count))
|
||||
self.report_progress((i+1)/file_count,
|
||||
_('%(num)d of %(tot)d') % dict(num=i+1, tot=file_count))
|
||||
|
||||
elif iswindows:
|
||||
try:
|
||||
@ -1118,7 +1121,8 @@ class ITUNES(DriverBase):
|
||||
|
||||
# Report progress
|
||||
if self.report_progress is not None:
|
||||
self.report_progress((i+1)/file_count, _('%d of %d') % (i+1, file_count))
|
||||
self.report_progress((i+1)/file_count,
|
||||
_('%(num)d of %(tot)d') % dict(num=i+1, tot=file_count))
|
||||
finally:
|
||||
pythoncom.CoUninitialize()
|
||||
|
||||
@ -3107,7 +3111,8 @@ class ITUNES_ASYNC(ITUNES):
|
||||
}
|
||||
|
||||
if self.report_progress is not None:
|
||||
self.report_progress((i+1)/book_count, _('%d of %d') % (i+1, book_count))
|
||||
self.report_progress((i+1)/book_count,
|
||||
_('%(num)d of %(tot)d') % dict(num=i+1, tot=book_count))
|
||||
|
||||
elif iswindows:
|
||||
try:
|
||||
@ -3147,7 +3152,8 @@ class ITUNES_ASYNC(ITUNES):
|
||||
|
||||
if self.report_progress is not None:
|
||||
self.report_progress((i+1)/book_count,
|
||||
_('%d of %d') % (i+1, book_count))
|
||||
_('%(num)d of %(tot)d') % dict(num=i+1,
|
||||
tot=book_count))
|
||||
|
||||
finally:
|
||||
pythoncom.CoUninitialize()
|
||||
|
@ -67,10 +67,10 @@ class PRS505(USBMS):
|
||||
_('Comma separated list of metadata fields '
|
||||
'to turn into collections on the device. Possibilities include: ')+\
|
||||
'series, tags, authors' +\
|
||||
_('. Two special collections are available: %s:%s and %s:%s. Add '
|
||||
_('. Two special collections are available: %(abt)s:%(abtv)s and %(aba)s:%(abav)s. Add '
|
||||
'these values to the list to enable them. The collections will be '
|
||||
'given the name provided after the ":" character.')%(
|
||||
'abt', ALL_BY_TITLE, 'aba', ALL_BY_AUTHOR),
|
||||
'given the name provided after the ":" character.')%dict(
|
||||
abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR),
|
||||
_('Upload separate cover thumbnails for books (newer readers)') +
|
||||
':::'+_('Normally, the SONY readers get the cover image from the'
|
||||
' ebook file itself. With this option, calibre will send a '
|
||||
|
@ -144,9 +144,9 @@ def add_pipeline_options(parser, plumber):
|
||||
|
||||
'HEURISTIC PROCESSING' : (
|
||||
_('Modify the document text and structure using common'
|
||||
' patterns. Disabled by default. Use %s to enable. '
|
||||
' Individual actions can be disabled with the %s options.')
|
||||
% ('--enable-heuristics', '--disable-*'),
|
||||
' 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
|
||||
),
|
||||
|
||||
|
@ -17,7 +17,8 @@ class ParseError(ValueError):
|
||||
self.name = name
|
||||
self.desc = desc
|
||||
ValueError.__init__(self,
|
||||
_('Failed to parse: %s with error: %s')%(name, desc))
|
||||
_('Failed to parse: %(name)s with error: %(err)s')%dict(
|
||||
name=name, err=desc))
|
||||
|
||||
class ePubFixer(Plugin):
|
||||
|
||||
|
@ -561,7 +561,9 @@ class HTMLConverter(object):
|
||||
para = children[i]
|
||||
break
|
||||
if para is None:
|
||||
raise ConversionError(_('Failed to parse link %s %s')%(tag, children))
|
||||
raise ConversionError(
|
||||
_('Failed to parse link %(tag)s %(children)s')%dict(
|
||||
tag=tag, children=children))
|
||||
text = self.get_text(tag, 1000)
|
||||
if not text:
|
||||
text = 'Link'
|
||||
@ -954,7 +956,9 @@ class HTMLConverter(object):
|
||||
self.scaled_images[path] = pt
|
||||
return pt.name
|
||||
except (IOError, SystemError) as err: # PIL chokes on interlaced PNG images as well a some GIF images
|
||||
self.log.warning(_('Unable to process image %s. Error: %s')%(path, err))
|
||||
self.log.warning(
|
||||
_('Unable to process image %(path)s. Error: %(err)s')%dict(
|
||||
path=path, err=err))
|
||||
|
||||
if width == None or height == None:
|
||||
width, height = im.size
|
||||
@ -1014,7 +1018,7 @@ class HTMLConverter(object):
|
||||
try:
|
||||
self.images[path] = ImageStream(path, encoding=encoding)
|
||||
except LrsError as err:
|
||||
self.log.warning(_('Could not process image: %s\n%s')%(
|
||||
self.log.warning(('Could not process image: %s\n%s')%(
|
||||
original_path, err))
|
||||
return
|
||||
|
||||
|
@ -21,9 +21,9 @@ USAGE='%%prog ebook_file [' + _('options') + ']\n' + \
|
||||
_('''
|
||||
Read/Write metadata from/to ebook files.
|
||||
|
||||
Supported formats for reading metadata: %s
|
||||
Supported formats for reading metadata: %(read)s
|
||||
|
||||
Supported formats for writing metadata: %s
|
||||
Supported formats for writing metadata: %(write)s
|
||||
|
||||
Different file types support different kinds of metadata. If you try to set
|
||||
some metadata on a file type that does not support it, the metadata will be
|
||||
@ -99,7 +99,7 @@ def option_parser():
|
||||
for w in metadata_writers():
|
||||
writers = writers.union(set(w.file_types))
|
||||
ft, w = ', '.join(sorted(filetypes())), ', '.join(sorted(writers))
|
||||
return config().option_parser(USAGE%(ft, w))
|
||||
return config().option_parser(USAGE%dict(read=ft, write=w))
|
||||
|
||||
def do_set_metadata(opts, mi, stream, stream_type):
|
||||
mi = MetaInformation(mi)
|
||||
|
@ -95,9 +95,9 @@ class CoverManager(object):
|
||||
authors = [unicode(x) for x in m.creator if x.role == 'aut']
|
||||
series_string = None
|
||||
if m.series and m.series_index:
|
||||
series_string = _('Book %s of %s')%(
|
||||
fmt_sidx(m.series_index[0], use_roman=True),
|
||||
unicode(m.series[0]))
|
||||
series_string = _('Book %(sidx)s of %(series)s')%dict(
|
||||
sidx=fmt_sidx(m.series_index[0], use_roman=True),
|
||||
series=unicode(m.series[0]))
|
||||
|
||||
try:
|
||||
from calibre.ebooks import calibre_cover
|
||||
|
@ -32,8 +32,8 @@ class SplitError(ValueError):
|
||||
size = len(tostring(root))/1024.
|
||||
ValueError.__init__(self,
|
||||
_('Could not find reasonable point at which to split: '
|
||||
'%s Sub-tree size: %d KB')%
|
||||
(path, size))
|
||||
'%(path)s Sub-tree size: %(size)d KB')%dict(
|
||||
path=path, size=size))
|
||||
|
||||
class Split(object):
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# coding:utf8
|
||||
# coding:utf-8
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
@ -120,16 +120,16 @@ class FetchAnnotationsAction(InterfaceAction):
|
||||
spanTag['style'] = 'font-weight:bold'
|
||||
if bookmark.book_format == 'pdf':
|
||||
spanTag.insert(0,NavigableString(
|
||||
_("%s<br />Last Page Read: %d (%d%%)") % \
|
||||
(strftime(u'%x', timestamp.timetuple()),
|
||||
last_read_location,
|
||||
percent_read)))
|
||||
_("%(time)s<br />Last Page Read: %(loc)d (%(pr)d%%)") % \
|
||||
dict(time=strftime(u'%x', timestamp.timetuple()),
|
||||
loc=last_read_location,
|
||||
pr=percent_read)))
|
||||
else:
|
||||
spanTag.insert(0,NavigableString(
|
||||
_("%s<br />Last Page Read: Location %d (%d%%)") % \
|
||||
(strftime(u'%x', timestamp.timetuple()),
|
||||
last_read_location,
|
||||
percent_read)))
|
||||
_("%(time)s<br />Last Page Read: Location %(loc)d (%(pr)d%%)") % \
|
||||
dict(time=strftime(u'%x', timestamp.timetuple()),
|
||||
loc=last_read_location,
|
||||
pr=percent_read)))
|
||||
|
||||
divTag.insert(dtc, spanTag)
|
||||
dtc += 1
|
||||
@ -145,23 +145,23 @@ class FetchAnnotationsAction(InterfaceAction):
|
||||
for location in sorted(user_notes):
|
||||
if user_notes[location]['text']:
|
||||
annotations.append(
|
||||
_('<b>Location %d • %s</b><br />%s<br />') % \
|
||||
(user_notes[location]['displayed_location'],
|
||||
user_notes[location]['type'],
|
||||
user_notes[location]['text'] if \
|
||||
_('<b>Location %(dl)d • %(typ)s</b><br />%(text)s<br />') % \
|
||||
dict(dl=user_notes[location]['displayed_location'],
|
||||
typ=user_notes[location]['type'],
|
||||
text=(user_notes[location]['text'] if \
|
||||
user_notes[location]['type'] == 'Note' else \
|
||||
'<i>%s</i>' % user_notes[location]['text']))
|
||||
'<i>%s</i>' % user_notes[location]['text'])))
|
||||
else:
|
||||
if bookmark.book_format == 'pdf':
|
||||
annotations.append(
|
||||
_('<b>Page %d • %s</b><br />') % \
|
||||
(user_notes[location]['displayed_location'],
|
||||
user_notes[location]['type']))
|
||||
_('<b>Page %(dl)d • %(typ)s</b><br />') % \
|
||||
dict(dl=user_notes[location]['displayed_location'],
|
||||
typ=user_notes[location]['type']))
|
||||
else:
|
||||
annotations.append(
|
||||
_('<b>Location %d • %s</b><br />') % \
|
||||
(user_notes[location]['displayed_location'],
|
||||
user_notes[location]['type']))
|
||||
_('<b>Location %(dl)d • %(typ)s</b><br />') % \
|
||||
dict(dl=user_notes[location]['displayed_location'],
|
||||
typ=user_notes[location]['type']))
|
||||
|
||||
for annotation in annotations:
|
||||
divTag.insert(dtc, annotation)
|
||||
|
@ -82,7 +82,8 @@ class GenerateCatalogAction(InterfaceAction):
|
||||
self.gui.sync_catalogs()
|
||||
if job.fmt not in ['EPUB','MOBI']:
|
||||
export_dir = choose_dir(self.gui, _('Export Catalog Directory'),
|
||||
_('Select destination for %s.%s') % (job.catalog_title, job.fmt.lower()))
|
||||
_('Select destination for %(title)s.%(fmt)s') % dict(
|
||||
title=job.catalog_title, fmt=job.fmt.lower()))
|
||||
if export_dir:
|
||||
destination = os.path.join(export_dir, '%s.%s' % (job.catalog_title, job.fmt.lower()))
|
||||
shutil.copyfile(job.catalog_file_path, destination)
|
||||
|
@ -160,8 +160,9 @@ class CopyToLibraryAction(InterfaceAction):
|
||||
error_dialog(self.gui, _('Failed'), _('Could not copy books: ') + e,
|
||||
det_msg=tb, show=True)
|
||||
else:
|
||||
self.gui.status_bar.show_message(_('Copied %d books to %s') %
|
||||
(len(ids), loc), 2000)
|
||||
self.gui.status_bar.show_message(
|
||||
_('Copied %(num)d books to %(loc)s') %
|
||||
dict(num=len(ids), loc=loc), 2000)
|
||||
if delete_after and self.worker.processed:
|
||||
v = self.gui.library_view
|
||||
ci = v.currentIndex()
|
||||
|
@ -159,9 +159,9 @@ def render_data(mi, use_roman_numbers=True, all_fields=False):
|
||||
sidx = mi.get(field+'_index')
|
||||
if sidx is None:
|
||||
sidx = 1.0
|
||||
val = _('Book %s of <span class="series_name">%s</span>')%(fmt_sidx(sidx,
|
||||
use_roman=use_roman_numbers),
|
||||
prepare_string_for_xml(getattr(mi, field)))
|
||||
val = _('Book %(sidx)s of <span class="series_name">%(series)s</span>')%dict(
|
||||
sidx=fmt_sidx(sidx, use_roman=use_roman_numbers),
|
||||
series=prepare_string_for_xml(getattr(mi, field)))
|
||||
|
||||
ans.append((field, u'<td class="title">%s</td><td>%s</td>'%(name, val)))
|
||||
|
||||
@ -541,7 +541,8 @@ class BookDetails(QWidget): # {{{
|
||||
self.setToolTip(
|
||||
'<p>'+_('Double-click to open Book Details window') +
|
||||
'<br><br>' + _('Path') + ': ' + self.current_path +
|
||||
'<br><br>' + _('Cover size: %dx%d')%(sz.width(), sz.height())
|
||||
'<br><br>' + _('Cover size: %(width)d x %(height)d')%dict(
|
||||
width=sz.width(), height=sz.height())
|
||||
)
|
||||
|
||||
def reset_info(self):
|
||||
|
@ -912,8 +912,9 @@ class DeviceMixin(object): # {{{
|
||||
format_count[f] = 1
|
||||
for f in self.device_manager.device.settings().format_map:
|
||||
if f in format_count.keys():
|
||||
formats.append((f, _('%i of %i Books') % (format_count[f],
|
||||
len(rows)), True if f in aval_out_formats else False))
|
||||
formats.append((f, _('%(num)i of %(total)i Books') % dict(
|
||||
num=format_count[f], total=len(rows)),
|
||||
True if f in aval_out_formats else False))
|
||||
elif f in aval_out_formats:
|
||||
formats.append((f, _('0 of %i Books') % len(rows), True))
|
||||
d = ChooseFormatDeviceDialog(self, _('Choose format to send to device'), formats)
|
||||
|
@ -106,7 +106,8 @@ class BookInfo(QDialog, Ui_BookInfo):
|
||||
Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
||||
self.cover.set_pixmap(pixmap)
|
||||
sz = pixmap.size()
|
||||
self.cover.setToolTip(_('Cover size: %dx%d')%(sz.width(), sz.height()))
|
||||
self.cover.setToolTip(_('Cover size: %(width)d x %(height)d')%dict(
|
||||
width=sz.width(), height=sz.height()))
|
||||
|
||||
def refresh(self, row):
|
||||
if isinstance(row, QModelIndex):
|
||||
|
@ -173,10 +173,10 @@ class MyBlockingBusy(QDialog): # {{{
|
||||
mi = self.db.get_metadata(id, index_is_id=True)
|
||||
series_string = None
|
||||
if mi.series:
|
||||
series_string = _('Book %s of %s')%(
|
||||
fmt_sidx(mi.series_index,
|
||||
series_string = _('Book %(sidx)s of %(series)s')%dict(
|
||||
sidx=fmt_sidx(mi.series_index,
|
||||
use_roman=config['use_roman_numerals_for_series_number']),
|
||||
mi.series)
|
||||
series=mi.series)
|
||||
|
||||
cdata = calibre_cover(mi.title, mi.format_field('authors')[-1],
|
||||
series_string=series_string)
|
||||
|
@ -701,7 +701,9 @@ class PluginUpdaterDialog(SizePersistedDialog):
|
||||
|
||||
if DEBUG:
|
||||
prints('Locating zip file for %s: %s'% (display_plugin.name, display_plugin.forum_link))
|
||||
self.gui.status_bar.showMessage(_('Locating zip file for %s: %s') % (display_plugin.name, display_plugin.forum_link))
|
||||
self.gui.status_bar.showMessage(
|
||||
_('Locating zip file for %(name)s: %(link)s') % dict(
|
||||
name=display_plugin.name, link=display_plugin.forum_link))
|
||||
plugin_zip_url = self._read_zip_attachment_url(display_plugin.forum_link)
|
||||
if not plugin_zip_url:
|
||||
return error_dialog(self.gui, _('Install Plugin Failed'),
|
||||
|
@ -381,7 +381,9 @@ class SchedulerDialog(QDialog, Ui_Dialog):
|
||||
d = utcnow() - last_downloaded
|
||||
def hm(x): return (x-x%3600)//3600, (x%3600 - (x%3600)%60)//60
|
||||
hours, minutes = hm(d.seconds)
|
||||
tm = _('%d days, %d hours and %d minutes ago')%(d.days, hours, minutes)
|
||||
tm = _('%(days)d days, %(hours)d hours'
|
||||
' and %(mins)d minutes ago')%dict(
|
||||
days=d.days, hours=hours, mins=minutes)
|
||||
if d < timedelta(days=366):
|
||||
ld_text = tm
|
||||
else:
|
||||
|
@ -18,7 +18,8 @@ class ListWidgetItem(QListWidgetItem):
|
||||
def data(self, role):
|
||||
if role == Qt.DisplayRole:
|
||||
if self.initial_value != self.current_value:
|
||||
return _('%s (was %s)')%(self.current_value, self.initial_value)
|
||||
return _('%(curr)s (was %(initial)s)')%dict(
|
||||
curr=self.current_value, initial=self.initial_value)
|
||||
else:
|
||||
return self.current_value
|
||||
elif role == Qt.EditRole:
|
||||
|
@ -143,7 +143,9 @@ class UserProfiles(ResizableDialog, Ui_Dialog):
|
||||
pt = PersistentTemporaryFile(suffix='.recipe')
|
||||
pt.write(src.encode('utf-8'))
|
||||
pt.close()
|
||||
body = _('The attached file: %s is a recipe to download %s.')%(os.path.basename(pt.name), title)
|
||||
body = _('The attached file: %(fname)s is a '
|
||||
'recipe to download %(title)s.')%dict(
|
||||
fname=os.path.basename(pt.name), title=title)
|
||||
subject = _('Recipe for ')+title
|
||||
url = QUrl('mailto:')
|
||||
url.addQueryItem('subject', subject)
|
||||
|
@ -51,8 +51,8 @@ class DownloadDialog(QDialog): # {{{
|
||||
self.setWindowTitle(_('Download %s')%fname)
|
||||
self.l = QVBoxLayout(self)
|
||||
self.purl = urlparse(url)
|
||||
self.msg = QLabel(_('Downloading <b>%s</b> from %s')%(fname,
|
||||
self.purl.netloc))
|
||||
self.msg = QLabel(_('Downloading <b>%(fname)s</b> from %(url)s')%dict(
|
||||
fname=fname, url=self.purl.netloc))
|
||||
self.msg.setWordWrap(True)
|
||||
self.l.addWidget(self.msg)
|
||||
self.pb = QProgressBar(self)
|
||||
@ -82,9 +82,9 @@ class DownloadDialog(QDialog): # {{{
|
||||
self.exec_()
|
||||
if self.worker.err is not None:
|
||||
error_dialog(self.parent(), _('Download failed'),
|
||||
_('Failed to download from %r with error: %s')%(
|
||||
self.worker.url, self.worker.err),
|
||||
det_msg=self.worker.tb, show=True)
|
||||
_('Failed to download from %(url)r with error: %(err)s')%dict(
|
||||
url=self.worker.url, err=self.worker.err),
|
||||
det_msg=self.worker.tb, show=True)
|
||||
|
||||
def update(self):
|
||||
if self.rejected:
|
||||
|
@ -120,7 +120,7 @@ def send_mails(jobnames, callback, attachments, to_s, subjects,
|
||||
texts, attachment_names, job_manager):
|
||||
for name, attachment, to, subject, text, aname in zip(jobnames,
|
||||
attachments, to_s, subjects, texts, attachment_names):
|
||||
description = _('Email %s to %s') % (name, to)
|
||||
description = _('Email %(name)s to %(to)s') % dict(name=name, to=to)
|
||||
job = ThreadedJob('email', description, gui_sendmail, (attachment, aname, to,
|
||||
subject, text), {}, callback)
|
||||
job_manager.run_threaded_job(job)
|
||||
|
@ -878,9 +878,10 @@ class Cover(ImageView): # {{{
|
||||
series = self.dialog.series.current_val
|
||||
series_string = None
|
||||
if series:
|
||||
series_string = _('Book %s of %s')%(
|
||||
fmt_sidx(self.dialog.series_index.current_val,
|
||||
use_roman=config['use_roman_numerals_for_series_number']), series)
|
||||
series_string = _('Book %(sidx)s of %(series)s')%dict(
|
||||
sidx=fmt_sidx(self.dialog.series_index.current_val,
|
||||
use_roman=config['use_roman_numerals_for_series_number']),
|
||||
series=series)
|
||||
self.current_val = calibre_cover(title, author,
|
||||
series_string=series_string)
|
||||
|
||||
@ -921,8 +922,8 @@ class Cover(ImageView): # {{{
|
||||
self.setPixmap(pm)
|
||||
tt = _('This book has no cover')
|
||||
if self._cdata:
|
||||
tt = _('Cover size: %dx%d pixels') % \
|
||||
(pm.width(), pm.height())
|
||||
tt = _('Cover size: %(width)d x %(height)d pixels') % \
|
||||
dict(width=pm.width(), height=pm.height())
|
||||
self.setToolTip(tt)
|
||||
|
||||
return property(fget=fget, fset=fset)
|
||||
|
@ -196,7 +196,7 @@ def download(ids, db, do_identify, covers,
|
||||
ans[i] = mi
|
||||
count += 1
|
||||
notifications.put((count/len(ids),
|
||||
_('Downloaded %d of %d')%(count, len(ids))))
|
||||
_('Downloaded %(num)d of %(tot)d')%dict(num=count, tot=len(ids))))
|
||||
log('Download complete, with %d failures'%len(failed_ids))
|
||||
return (ans, failed_ids, failed_covers, title_map, all_failed)
|
||||
|
||||
|
@ -726,8 +726,8 @@ class CoversWidget(QWidget): # {{{
|
||||
if num < 2:
|
||||
txt = _('Could not find any covers for <b>%s</b>')%self.book.title
|
||||
else:
|
||||
txt = _('Found <b>%d</b> covers of %s. Pick the one you like'
|
||||
' best.')%(num-1, self.title)
|
||||
txt = _('Found <b>%(num)d</b> covers of %(title)s. Pick the one you like'
|
||||
' best.')%dict(num=num-1, title=self.title)
|
||||
self.msg.setText(txt)
|
||||
|
||||
self.finished.emit()
|
||||
|
@ -445,15 +445,15 @@ class RulesModel(QAbstractListModel): # {{{
|
||||
def rule_to_html(self, col, rule):
|
||||
if not isinstance(rule, Rule):
|
||||
return _('''
|
||||
<p>Advanced Rule for column <b>%s</b>:
|
||||
<pre>%s</pre>
|
||||
''')%(col, prepare_string_for_xml(rule))
|
||||
<p>Advanced Rule for column <b>%(col)s</b>:
|
||||
<pre>%(rule)s</pre>
|
||||
''')%dict(col=col, rule=prepare_string_for_xml(rule))
|
||||
conditions = [self.condition_to_html(c) for c in rule.conditions]
|
||||
return _('''\
|
||||
<p>Set the color of <b>%s</b> to <b>%s</b> if the following
|
||||
<p>Set the color of <b>%(col)s</b> to <b>%(color)s</b> if the following
|
||||
conditions are met:</p>
|
||||
<ul>%s</ul>
|
||||
''') % (col, rule.color, ''.join(conditions))
|
||||
<ul>%(rule)s</ul>
|
||||
''') % dict(col=col, color=rule.color, rule=''.join(conditions))
|
||||
|
||||
def condition_to_html(self, condition):
|
||||
c, a, v = condition
|
||||
@ -464,8 +464,8 @@ class RulesModel(QAbstractListModel): # {{{
|
||||
action_name = trans
|
||||
|
||||
return (
|
||||
_('<li>If the <b>%s</b> column <b>%s</b> value: <b>%s</b>') %
|
||||
(c, action_name, prepare_string_for_xml(v)))
|
||||
_('<li>If the <b>%(col)s</b> column <b>%(action)s</b> value: <b>%(val)s</b>') %
|
||||
dict(col=c, action=action_name, val=prepare_string_for_xml(v)))
|
||||
|
||||
# }}}
|
||||
|
||||
|
@ -262,8 +262,8 @@ class PluginConfig(QWidget): # {{{
|
||||
|
||||
self.l = l = QVBoxLayout()
|
||||
self.setLayout(l)
|
||||
self.c = c = QLabel(_('<b>Configure %s</b><br>%s') % (plugin.name,
|
||||
plugin.description))
|
||||
self.c = c = QLabel(_('<b>Configure %(name)s</b><br>%(desc)s') % dict(
|
||||
name=plugin.name, desc=plugin.description))
|
||||
c.setAlignment(Qt.AlignHCenter)
|
||||
l.addWidget(c)
|
||||
|
||||
|
@ -67,7 +67,9 @@ class CacheUpdateThread(Thread, QObject):
|
||||
self.total_changed.emit(len(raw_books))
|
||||
|
||||
for i, book_data in enumerate(raw_books):
|
||||
self.update_details.emit(_('%s of %s books processed.') % (i, len(raw_books)))
|
||||
self.update_details.emit(
|
||||
_('%(num)s of %(tot)s books processed.') % dict(
|
||||
num=i, tot=len(raw_books)))
|
||||
book = SearchResult()
|
||||
book.detail_item = ''.join(book_data.xpath('.//a/@href'))
|
||||
book.formats = ''.join(book_data.xpath('.//i/text()'))
|
||||
|
@ -384,8 +384,8 @@ class TagsView(QTreeView): # {{{
|
||||
action='delete_search', key=tag.name))
|
||||
if key.startswith('@') and not item.is_gst:
|
||||
self.context_menu.addAction(self.user_category_icon,
|
||||
_('Remove %s from category %s')%
|
||||
(display_name(tag), item.py_name),
|
||||
_('Remove %(item)s from category %(cat)s')%
|
||||
dict(item=display_name(tag), cat=item.py_name),
|
||||
partial(self.context_menu_handler,
|
||||
action='delete_item_from_user_category',
|
||||
key = key, index = tag_item))
|
||||
|
@ -94,8 +94,8 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{
|
||||
|
||||
msg = '%s' % '\n'.join(res)
|
||||
warning_dialog(parent, _('Could not convert some books'),
|
||||
_('Could not convert %d of %d books, because no suitable source'
|
||||
' format was found.') % (len(res), total),
|
||||
_('Could not convert %(num)d of %(tot)d books, because no suitable source'
|
||||
' format was found.') % dict(num=len(res), tot=total),
|
||||
msg).exec_()
|
||||
|
||||
return jobs, changed, bad
|
||||
@ -187,7 +187,8 @@ class QueueBulk(QProgressDialog):
|
||||
except:
|
||||
dtitle = repr(mi.title)
|
||||
self.setLabelText(_('Queueing ')+dtitle)
|
||||
desc = _('Convert book %d of %d (%s)') % (self.i, len(self.book_ids), dtitle)
|
||||
desc = _('Convert book %(num)d of %(tot)d (%(title)s)') % dict(
|
||||
num=self.i, tot=len(self.book_ids), title=dtitle)
|
||||
|
||||
args = [in_file.name, out_file.name, lrecs]
|
||||
temp_files.append(out_file)
|
||||
@ -209,8 +210,8 @@ class QueueBulk(QProgressDialog):
|
||||
|
||||
msg = '%s' % '\n'.join(res)
|
||||
warning_dialog(self.parent, _('Could not convert some books'),
|
||||
_('Could not convert %d of %d books, because no suitable '
|
||||
'source format was found.') % (len(res), len(self.book_ids)),
|
||||
_('Could not convert %(num)d of %(tot)d books, because no suitable '
|
||||
'source format was found.') % dict(num=len(res), tot=len(self.book_ids)),
|
||||
msg).exec_()
|
||||
self.parent = None
|
||||
self.jobs.reverse()
|
||||
|
@ -70,10 +70,10 @@ class UpdateNotification(QDialog):
|
||||
self.logo.setPixmap(QPixmap(I('lt.png')).scaled(100, 100,
|
||||
Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
|
||||
self.label = QLabel(('<p>'+
|
||||
_('%s has been updated to version <b>%s</b>. '
|
||||
_('%(app)s has been updated to version <b>%(ver)s</b>. '
|
||||
'See the <a href="http://calibre-ebook.com/whats-new'
|
||||
'">new features</a>.'))%(
|
||||
__appname__, calibre_version))
|
||||
'">new features</a>.'))%dict(
|
||||
app=__appname__, ver=calibre_version))
|
||||
self.label.setOpenExternalLinks(True)
|
||||
self.label.setWordWrap(True)
|
||||
self.setWindowTitle(_('Update available!'))
|
||||
|
@ -492,11 +492,11 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
self.set_page_number(frac)
|
||||
|
||||
def magnification_changed(self, val):
|
||||
tt = _('Make font size %s\nCurrent magnification: %.1f')
|
||||
tt = _('Make font size %(which)s\nCurrent magnification: %(mag).1f')
|
||||
self.action_font_size_larger.setToolTip(
|
||||
tt %(_('larger'), val))
|
||||
tt %dict(which=_('larger'), mag=val))
|
||||
self.action_font_size_smaller.setToolTip(
|
||||
tt %(_('smaller'), val))
|
||||
tt %dict(which=_('smaller'), mag=val))
|
||||
|
||||
def find(self, text, repeat=False, backwards=False):
|
||||
if not text:
|
||||
|
@ -569,9 +569,9 @@ def move_library(oldloc, newloc, parent, callback_on_complete):
|
||||
det = traceback.format_exc()
|
||||
error_dialog(parent, _('Invalid database'),
|
||||
_('<p>An invalid library already exists at '
|
||||
'%s, delete it before trying to move the '
|
||||
'existing library.<br>Error: %s')%(newloc,
|
||||
str(err)), det, show=True)
|
||||
'%(loc)s, delete it before trying to move the '
|
||||
'existing library.<br>Error: %(err)s')%dict(loc=newloc,
|
||||
err=str(err)), det, show=True)
|
||||
callback(None)
|
||||
return
|
||||
else:
|
||||
|
@ -31,9 +31,9 @@ class TestEmail(QDialog, TE_Dialog):
|
||||
if pa:
|
||||
self.to.setText(pa)
|
||||
if opts.relay_host:
|
||||
self.label.setText(_('Using: %s:%s@%s:%s and %s encryption')%
|
||||
(opts.relay_username, unhexlify(opts.relay_password),
|
||||
opts.relay_host, opts.relay_port, opts.encryption))
|
||||
self.label.setText(_('Using: %(un)s:%(pw)s@%(host)s:%(port)s and %(enc)s encryption')%
|
||||
dict(un=opts.relay_username, pw=unhexlify(opts.relay_password),
|
||||
host=opts.relay_host, port=opts.relay_port, enc=opts.encryption))
|
||||
|
||||
def test(self, *args):
|
||||
self.log.setPlainText(_('Sending...'))
|
||||
|
@ -54,12 +54,12 @@ class CSV_XML(CatalogPlugin): # {{{
|
||||
action = None,
|
||||
help = _('The fields to output when cataloging books in the '
|
||||
'database. Should be a comma-separated list of fields.\n'
|
||||
'Available fields: %s,\n'
|
||||
'Available fields: %(fields)s,\n'
|
||||
'plus user-created custom fields.\n'
|
||||
'Example: %s=title,authors,tags\n'
|
||||
'Example: %(opt)s=title,authors,tags\n'
|
||||
"Default: '%%default'\n"
|
||||
"Applies to: CSV, XML output formats")%(', '.join(FIELDS),
|
||||
'--fields')),
|
||||
"Applies to: CSV, XML output formats")%dict(
|
||||
fields=', '.join(FIELDS), opt='--fields')),
|
||||
|
||||
Option('--sort-by',
|
||||
default = 'id',
|
||||
@ -250,12 +250,12 @@ class BIBTEX(CatalogPlugin): # {{{
|
||||
action = None,
|
||||
help = _('The fields to output when cataloging books in the '
|
||||
'database. Should be a comma-separated list of fields.\n'
|
||||
'Available fields: %s.\n'
|
||||
'Available fields: %(fields)s.\n'
|
||||
'plus user-created custom fields.\n'
|
||||
'Example: %s=title,authors,tags\n'
|
||||
'Example: %(opt)s=title,authors,tags\n'
|
||||
"Default: '%%default'\n"
|
||||
"Applies to: BIBTEX output format")%(', '.join(FIELDS),
|
||||
'--fields')),
|
||||
"Applies to: BIBTEX output format")%dict(
|
||||
fields=', '.join(FIELDS), opt='--fields')),
|
||||
|
||||
Option('--sort-by',
|
||||
default = 'id',
|
||||
|
@ -62,7 +62,8 @@ class Tag(object):
|
||||
if self.avg_rating > 0:
|
||||
if tooltip:
|
||||
tooltip = tooltip + ': '
|
||||
tooltip = _('%sAverage rating is %3.1f')%(tooltip, self.avg_rating)
|
||||
tooltip = _('%(tt)sAverage rating is %(rating)3.1f')%dict(
|
||||
tt=tooltip, rating=self.avg_rating)
|
||||
self.tooltip = tooltip
|
||||
self.icon = icon
|
||||
self.category = category
|
||||
|
@ -92,16 +92,17 @@ def config(defaults=None):
|
||||
' By default all available formats are saved.'))
|
||||
x('template', default=DEFAULT_TEMPLATE,
|
||||
help=_('The template to control the filename and directory structure of the saved files. '
|
||||
'Default is "%s" which will save books into a per-author '
|
||||
'Default is "%(templ)s" which will save books into a per-author '
|
||||
'subdirectory with filenames containing title and author. '
|
||||
'Available controls are: {%s}')%(DEFAULT_TEMPLATE, ', '.join(FORMAT_ARGS)))
|
||||
'Available controls are: {%(controls)s}')%dict(
|
||||
templ=DEFAULT_TEMPLATE, controls=', '.join(FORMAT_ARGS)))
|
||||
x('send_template', default=DEFAULT_SEND_TEMPLATE,
|
||||
help=_('The template to control the filename and directory structure of files '
|
||||
'sent to the device. '
|
||||
'Default is "%s" which will save books into a per-author '
|
||||
'Default is "%(templ)s" which will save books into a per-author '
|
||||
'directory with filenames containing title and author. '
|
||||
'Available controls are: {%s}')%(DEFAULT_SEND_TEMPLATE, ', '.join(FORMAT_ARGS)))
|
||||
|
||||
'Available controls are: {%(controls)s}')%dict(
|
||||
templ=DEFAULT_SEND_TEMPLATE, controls=', '.join(FORMAT_ARGS)))
|
||||
x('asciiize', default=True,
|
||||
help=_('Normally, calibre will convert all non English characters into English equivalents '
|
||||
'for the file names. '
|
||||
|
@ -124,7 +124,8 @@ def render_rating(rating, url_prefix, container='span', prefix=None): # {{{
|
||||
added = 0
|
||||
if prefix is None:
|
||||
prefix = _('Average rating')
|
||||
rstring = xml(_('%s: %.1f stars')% (prefix, rating if rating else 0.0),
|
||||
rstring = xml(_('%(prefix)s: %(rating).1f stars')%dict(
|
||||
prefix=prefix, rating=rating if rating else 0.0),
|
||||
True)
|
||||
ans = ['<%s class="rating">' % (container)]
|
||||
for i in range(5):
|
||||
|
@ -171,9 +171,9 @@ def ACQUISITION_ENTRY(item, version, db, updated, CFM, CKEYS, prefix):
|
||||
no_tag_count=True)))
|
||||
series = item[FM['series']]
|
||||
if series:
|
||||
extra.append(_('SERIES: %s [%s]<br />')%\
|
||||
(xml(series),
|
||||
fmt_sidx(float(item[FM['series_index']]))))
|
||||
extra.append(_('SERIES: %(series)s [%(sidx)s]<br />')%\
|
||||
dict(series=xml(series),
|
||||
sidx=fmt_sidx(float(item[FM['series_index']]))))
|
||||
for key in CKEYS:
|
||||
mi = db.get_metadata(item[CFM['id']['rec_index']], index_is_id=True)
|
||||
name, val = mi.format_field(key)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@ class CustomHelpFormatter(IndentedHelpFormatter):
|
||||
|
||||
def format_usage(self, usage):
|
||||
tc = terminal_controller()
|
||||
return _("%sUsage%s: %s\n") % (tc.BLUE, tc.NORMAL, usage)
|
||||
return "%s%s%s: %s\n" % (tc.BLUE, _('Usage'), tc.NORMAL, usage)
|
||||
|
||||
def format_heading(self, heading):
|
||||
tc = terminal_controller()
|
||||
|
Loading…
x
Reference in New Issue
Block a user