From f97cc09c21da3f2cdc2a4c8aeb8f8b7b96c5599d Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Wed, 26 Nov 2014 14:16:35 +0530
Subject: [PATCH] Localize links to the User Manual
---
src/calibre/ebooks/conversion/cli.py | 3 ++-
src/calibre/gui2/actions/help.py | 3 ++-
src/calibre/gui2/catalog/catalog_epub_mobi.py | 3 ++-
src/calibre/gui2/convert/font_key.py | 6 ++++++
src/calibre/gui2/convert/font_key.ui | 4 ++--
src/calibre/gui2/convert/heuristics.py | 8 +++++++-
src/calibre/gui2/convert/heuristics.ui | 4 ++--
src/calibre/gui2/convert/pdf_output.py | 6 ++++++
src/calibre/gui2/convert/pdf_output.ui | 4 ++--
src/calibre/gui2/convert/search_and_replace.py | 11 +++++++++--
src/calibre/gui2/convert/search_and_replace.ui | 4 ++--
src/calibre/gui2/convert/toc.py | 6 ++++++
src/calibre/gui2/convert/toc.ui | 4 ++--
src/calibre/gui2/convert/xpath_wizard.py | 6 ++++++
src/calibre/gui2/convert/xpath_wizard.ui | 4 ++--
src/calibre/gui2/dialogs/custom_recipes.py | 3 ++-
src/calibre/gui2/dialogs/search.py | 2 ++
src/calibre/gui2/dialogs/search.ui | 4 ++--
src/calibre/gui2/dialogs/template_dialog.py | 9 +++++----
src/calibre/gui2/filename_pattern.ui | 4 ++--
src/calibre/gui2/search_restriction_mixin.py | 5 +++--
.../store/config/chooser/adv_search_builder.py | 12 +++++++++---
.../store/config/chooser/adv_search_builder.ui | 4 ++--
.../gui2/store/search/adv_search_builder.py | 16 +++++++++++-----
.../gui2/store/search/adv_search_builder.ui | 4 ++--
src/calibre/gui2/tweak_book/function_replace.py | 3 ++-
src/calibre/gui2/tweak_book/ui.py | 4 +++-
src/calibre/gui2/widgets.py | 6 ++++++
src/calibre/gui2/wizard/__init__.py | 11 +++++++++++
src/calibre/gui2/wizard/finish.ui | 4 ++--
src/calibre/gui2/wizard/stanza.ui | 2 +-
31 files changed, 123 insertions(+), 46 deletions(-)
diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py
index 4358fb4c23..88dedc0640 100644
--- a/src/calibre/ebooks/conversion/cli.py
+++ b/src/calibre/ebooks/conversion/cli.py
@@ -16,6 +16,7 @@ from calibre.utils.logging import Log
from calibre.customize.conversion import OptionRecommendation
from calibre import patheq
from calibre.ebooks.conversion import ConversionUserFeedBack
+from calibre.utils.localization import localize_user_manual_link
USAGE = '%prog ' + _('''\
input_file output_file [options]
@@ -41,7 +42,7 @@ 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
-''') + 'http://manual.calibre-ebook.com/conversion.html'
+''') + localize_user_manual_link('http://manual.calibre-ebook.com/conversion.html')
HEURISTIC_OPTIONS = ['markup_chapter_headings',
'italicize_common_cases', 'fix_indents',
diff --git a/src/calibre/gui2/actions/help.py b/src/calibre/gui2/actions/help.py
index 945ad19423..7f7cb2610f 100644
--- a/src/calibre/gui2/actions/help.py
+++ b/src/calibre/gui2/actions/help.py
@@ -9,6 +9,7 @@ from PyQt5.Qt import QUrl
from calibre.gui2 import open_url
from calibre.gui2.actions import InterfaceAction
+from calibre.utils.localization import localize_user_manual_link
class HelpAction(InterfaceAction):
@@ -19,7 +20,7 @@ class HelpAction(InterfaceAction):
self.qaction.triggered.connect(self.show_help)
def show_help(self, *args):
- open_url(QUrl('http://manual.calibre-ebook.com'))
+ open_url(QUrl(localize_user_manual_link('http://manual.calibre-ebook.com')))
diff --git a/src/calibre/gui2/catalog/catalog_epub_mobi.py b/src/calibre/gui2/catalog/catalog_epub_mobi.py
index f8c2cd7f7b..066388cf38 100644
--- a/src/calibre/gui2/catalog/catalog_epub_mobi.py
+++ b/src/calibre/gui2/catalog/catalog_epub_mobi.py
@@ -14,6 +14,7 @@ from calibre.ebooks.conversion.config import load_defaults
from calibre.gui2 import gprefs, open_url, question_dialog, error_dialog
from calibre.utils.config import JSONConfig
from calibre.utils.icu import sort_key
+from calibre.utils.localization import localize_user_manual_link
from catalog_epub_mobi_ui import Ui_Form
from PyQt5.Qt import (Qt, QAbstractItemView, QCheckBox, QComboBox,
@@ -814,7 +815,7 @@ class PluginWidget(QWidget,Ui_Form):
'''
Display help file
'''
- open_url(QUrl('http://manual.calibre-ebook.com/catalogs.html'))
+ open_url(QUrl(localize_user_manual_link('http://manual.calibre-ebook.com/catalogs.html')))
class CheckableTableWidgetItem(QTableWidgetItem):
diff --git a/src/calibre/gui2/convert/font_key.py b/src/calibre/gui2/convert/font_key.py
index f389cbf895..4b1655b944 100644
--- a/src/calibre/gui2/convert/font_key.py
+++ b/src/calibre/gui2/convert/font_key.py
@@ -9,12 +9,18 @@ __docformat__ = 'restructuredtext en'
from PyQt5.Qt import QDialog
from calibre.gui2.convert.font_key_ui import Ui_Dialog
+from calibre.utils.localization import localize_user_manual_link
class FontKeyChooser(QDialog, Ui_Dialog):
def __init__(self, parent=None, base_font_size=0.0, font_key=None):
QDialog.__init__(self, parent)
self.setupUi(self)
+ try:
+ self.wh_label.setText(self.wh_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/conversion.html#font-size-rescaling'))
+ except TypeError:
+ pass # link already localized
self.default_font_key = font_key
self.default_base_font_size = base_font_size
diff --git a/src/calibre/gui2/convert/font_key.ui b/src/calibre/gui2/convert/font_key.ui
index 07e0cb0f11..e22aee17ea 100644
--- a/src/calibre/gui2/convert/font_key.ui
+++ b/src/calibre/gui2/convert/font_key.ui
@@ -29,11 +29,11 @@
-
-
+
<p>This wizard will help you choose an appropriate font size key for your needs. Just enter the base font size of the input document and then enter an input font size. The wizard will display what font size it will be mapped to, by the font rescaling algorithm. You can adjust the algorithm by adjusting the output base font size and font key below. When you find values suitable for you, click OK.</p>
<p>By default, if the output base font size is zero and/or no font size key is specified, calibre will use the values from the current Output Profile. </p>
-<p>See the <a href="http://manual.calibre-ebook.com/conversion.html#font-size-rescaling">User Manual</a> for a discussion of how font size rescaling works.</p>
+<p>See the <a href="%s">User Manual</a> for a discussion of how font size rescaling works.</p>
true
diff --git a/src/calibre/gui2/convert/heuristics.py b/src/calibre/gui2/convert/heuristics.py
index e1db613afc..646a8dbc2b 100644
--- a/src/calibre/gui2/convert/heuristics.py
+++ b/src/calibre/gui2/convert/heuristics.py
@@ -9,6 +9,7 @@ from PyQt5.Qt import Qt
from calibre.gui2 import gprefs
from calibre.gui2.convert.heuristics_ui import Ui_Form
from calibre.gui2.convert import Widget
+from calibre.utils.localization import localize_user_manual_link
class HeuristicsWidget(Widget, Ui_Form):
@@ -37,6 +38,11 @@ class HeuristicsWidget(Widget, Ui_Form):
self.opt_unwrap_lines.stateChanged.connect(self.enable_unwrap)
self.enable_heuristics(self.opt_enable_heuristics.checkState())
+ try:
+ self.help_label.setText(self.help_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/conversion.html#heuristic-processing'))
+ except TypeError:
+ pass # link already localized
def restore_defaults(self, get_option):
Widget.restore_defaults(self, get_option)
@@ -73,7 +79,7 @@ class HeuristicsWidget(Widget, Ui_Form):
def load_histories(self):
val = unicode(self.opt_replace_scene_breaks.currentText())
-
+
self.opt_replace_scene_breaks.clear()
self.opt_replace_scene_breaks.lineEdit().setText('')
diff --git a/src/calibre/gui2/convert/heuristics.ui b/src/calibre/gui2/convert/heuristics.ui
index 403321494a..818e559bba 100644
--- a/src/calibre/gui2/convert/heuristics.ui
+++ b/src/calibre/gui2/convert/heuristics.ui
@@ -15,9 +15,9 @@
-
-
+
- <b>Heuristic processing</b> means that calibre will scan your book for common patterns and fix them. As the name implies, this involves guesswork, which means that it could end up worsening the result of a conversion, if calibre guesses wrong. Therefore, it is disabled by default. Often, if a conversion does not turn out as you expect, turning on heuristics can improve matters. Read more about the various heuristic processing options in the <a href="http://manual.calibre-ebook.com/conversion.html#heuristic-processing">User Manual</a>.
+ <b>Heuristic processing</b> means that calibre will scan your book for common patterns and fix them. As the name implies, this involves guesswork, which means that it could end up worsening the result of a conversion, if calibre guesses wrong. Therefore, it is disabled by default. Often, if a conversion does not turn out as you expect, turning on heuristics can improve matters. Read more about the various heuristic processing options in the <a href="%s">User Manual</a>.
true
diff --git a/src/calibre/gui2/convert/pdf_output.py b/src/calibre/gui2/convert/pdf_output.py
index 54047321ee..988564b6fc 100644
--- a/src/calibre/gui2/convert/pdf_output.py
+++ b/src/calibre/gui2/convert/pdf_output.py
@@ -6,6 +6,7 @@ __docformat__ = 'restructuredtext en'
from calibre.gui2.convert.pdf_output_ui import Ui_Form
from calibre.gui2.convert import Widget
+from calibre.utils.localization import localize_user_manual_link
paper_size_model = None
orientation_model = None
@@ -26,6 +27,11 @@ class PluginWidget(Widget, Ui_Form):
'pdf_footer_template', 'pdf_header_template', 'pdf_add_toc', 'toc_title',
])
self.db, self.book_id = db, book_id
+ try:
+ self.hf_label.setText(self.hf_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/conversion.html#converting-to-pdf'))
+ except TypeError:
+ pass # link already localized
for x in get_option('paper_size').option.choices:
self.opt_paper_size.addItem(x)
diff --git a/src/calibre/gui2/convert/pdf_output.ui b/src/calibre/gui2/convert/pdf_output.ui
index 8c084ded53..9140301946 100644
--- a/src/calibre/gui2/convert/pdf_output.ui
+++ b/src/calibre/gui2/convert/pdf_output.ui
@@ -184,9 +184,9 @@
-
-
+
- You can insert headers and footers into every page of the produced PDF file by using header and footer templates. For examples, see the <a href="http://manual.calibre-ebook.com/conversion.html#converting-to-pdf">documentation</a>.
+ You can insert headers and footers into every page of the produced PDF file by using header and footer templates. For examples, see the <a href="%s">documentation</a>.
true
diff --git a/src/calibre/gui2/convert/search_and_replace.py b/src/calibre/gui2/convert/search_and_replace.py
index 976fef7aa1..1fd6ad2ac5 100644
--- a/src/calibre/gui2/convert/search_and_replace.py
+++ b/src/calibre/gui2/convert/search_and_replace.py
@@ -13,6 +13,7 @@ from calibre.gui2.convert import Widget
from calibre.gui2 import (error_dialog, question_dialog, choose_files,
choose_save_file)
from calibre import as_unicode
+from calibre.utils.localization import localize_user_manual_link
class SearchAndReplaceWidget(Widget, Ui_Form):
@@ -66,6 +67,12 @@ class SearchAndReplaceWidget(Widget, Ui_Form):
self.initialize_options(get_option, get_help, db, book_id)
+ try:
+ self.rh_label.setText(self.rh_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/regexp.html'))
+ except TypeError:
+ pass # link already localized
+
def sr_add_clicked(self):
if self.sr_search.regex:
row = self.sr_add_row(self.sr_search.regex, self.sr_replace.text())
@@ -128,7 +135,7 @@ class SearchAndReplaceWidget(Widget, Ui_Form):
def sr_up_clicked(self):
self.cell_rearrange(-1)
-
+
def sr_down_clicked(self):
self.cell_rearrange(1)
@@ -141,7 +148,7 @@ class SearchAndReplaceWidget(Widget, Ui_Form):
item1.setText(item2.text())
item2.setText(value)
self.search_replace.setCurrentCell(row+i, 0)
-
+
def sr_currentCellChanged(self, row, column, previousRow, previousColumn) :
if row >= 0:
self.sr_change.setEnabled(True)
diff --git a/src/calibre/gui2/convert/search_and_replace.ui b/src/calibre/gui2/convert/search_and_replace.ui
index 5a70773fea..150f9919cd 100644
--- a/src/calibre/gui2/convert/search_and_replace.ui
+++ b/src/calibre/gui2/convert/search_and_replace.ui
@@ -236,9 +236,9 @@
-
-
+
- <p>Search and replace uses <i>regular expressions</i>. See the <a href="http://manual.calibre-ebook.com/regexp.html">regular expressions tutorial</a> to get started with regular expressions. Also clicking the wizard button below will allow you to test your regular expression against the current input document. When you are happy with an expression, click the Add button to add it to the list of expressions.
+ <p>Search and replace uses <i>regular expressions</i>. See the <a href="%s">regular expressions tutorial</a> to get started with regular expressions. Also clicking the wizard button below will allow you to test your regular expression against the current input document. When you are happy with an expression, click the Add button to add it to the list of expressions.
true
diff --git a/src/calibre/gui2/convert/toc.py b/src/calibre/gui2/convert/toc.py
index dab7559f1b..c52c893ab7 100644
--- a/src/calibre/gui2/convert/toc.py
+++ b/src/calibre/gui2/convert/toc.py
@@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en'
from calibre.gui2.convert.toc_ui import Ui_Form
from calibre.gui2.convert import Widget
from calibre.gui2 import error_dialog
+from calibre.utils.localization import localize_user_manual_link
class TOCWidget(Widget, Ui_Form):
@@ -30,6 +31,11 @@ class TOCWidget(Widget, Ui_Form):
self.opt_level1_toc.set_msg(_('Level &1 TOC (XPath expression):'))
self.opt_level2_toc.set_msg(_('Level &2 TOC (XPath expression):'))
self.opt_level3_toc.set_msg(_('Level &3 TOC (XPath expression):'))
+ try:
+ self.help_label.setText(self.help_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/conversion.html#table-of-contents'))
+ except TypeError:
+ pass # link already localized
def pre_commit_check(self):
diff --git a/src/calibre/gui2/convert/toc.ui b/src/calibre/gui2/convert/toc.ui
index e22acdfbd7..29fc2ec1ca 100644
--- a/src/calibre/gui2/convert/toc.ui
+++ b/src/calibre/gui2/convert/toc.ui
@@ -105,9 +105,9 @@
-
-
+
- <a href="http://manual.calibre-ebook.com/conversion.html#table-of-contents">Help with using these options to generate a Table of Contents</a>
+ <a href="%s">Help with using these options to generate a Table of Contents</a>
true
diff --git a/src/calibre/gui2/convert/xpath_wizard.py b/src/calibre/gui2/convert/xpath_wizard.py
index 76c9c64015..3c252a834d 100644
--- a/src/calibre/gui2/convert/xpath_wizard.py
+++ b/src/calibre/gui2/convert/xpath_wizard.py
@@ -10,6 +10,7 @@ from PyQt5.Qt import QDialog, QWidget, Qt, QDialogButtonBox, QVBoxLayout
from calibre.gui2.convert.xpath_wizard_ui import Ui_Form
from calibre.gui2.convert.xexp_edit_ui import Ui_Form as Ui_Edit
+from calibre.utils.localization import localize_user_manual_link
class WizardWidget(QWidget, Ui_Form):
@@ -17,6 +18,11 @@ class WizardWidget(QWidget, Ui_Form):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setupUi(self)
+ try:
+ self.example_label.setText(self.example_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/xpath.html'))
+ except TypeError:
+ pass
@property
def xpath(self):
diff --git a/src/calibre/gui2/convert/xpath_wizard.ui b/src/calibre/gui2/convert/xpath_wizard.ui
index 5e112e1fcd..c9cf00498d 100644
--- a/src/calibre/gui2/convert/xpath_wizard.ui
+++ b/src/calibre/gui2/convert/xpath_wizard.ui
@@ -125,9 +125,9 @@
-
-
+
- <p>For example, to match all h2 tags that have class="chapter", set tag to <i>h2</i>, attribute to <i>class</i> and value to <i>chapter</i>.</p><p>Leaving attribute blank will match any attribute and leaving value blank will match any value. Setting tag to * will match any tag.</p><p>To learn more advanced usage of XPath see the <a href="http://manual.calibre-ebook.com/xpath.html">XPath Tutorial</a>.
+ <p>For example, to match all h2 tags that have class="chapter", set tag to <i>h2</i>, attribute to <i>class</i> and value to <i>chapter</i>.</p><p>Leaving attribute blank will match any attribute and leaving value blank will match any value. Setting tag to * will match any tag.</p><p>To learn more advanced usage of XPath see the <a href="%s">XPath Tutorial</a>.
true
diff --git a/src/calibre/gui2/dialogs/custom_recipes.py b/src/calibre/gui2/dialogs/custom_recipes.py
index 23686473b0..d64cd6c693 100644
--- a/src/calibre/gui2/dialogs/custom_recipes.py
+++ b/src/calibre/gui2/dialogs/custom_recipes.py
@@ -20,6 +20,7 @@ from calibre.web.feeds.recipes import custom_recipes, compile_recipe
from calibre.gui2.tweak_book.editor.text import TextEdit
from calibre.utils.icu import sort_key
from calibre.web.feeds.recipes.collection import get_builtin_recipe_collection, get_builtin_recipe_by_id
+from calibre.utils.localization import localize_user_manual_link
def is_basic_recipe(src):
return re.search(r'^class BasicUserRecipe', src, flags=re.MULTILINE) is not None
@@ -406,7 +407,7 @@ class AdvancedRecipe(QWidget): # {{{
self.la = la = QLabel(_(
'For help with writing advanced news recipes, see the User Manual'
- ) % 'http://manual.calibre-ebook.com/news.html')
+ ) % localize_user_manual_link('http://manual.calibre-ebook.com/news.html'))
l.addWidget(la)
self.editor = TextEdit(self)
diff --git a/src/calibre/gui2/dialogs/search.py b/src/calibre/gui2/dialogs/search.py
index 0adcda2939..b4f629fa2a 100644
--- a/src/calibre/gui2/dialogs/search.py
+++ b/src/calibre/gui2/dialogs/search.py
@@ -12,6 +12,7 @@ from calibre.gui2 import gprefs
from calibre.utils.icu import sort_key
from calibre.utils.config import tweaks
from calibre.utils.date import now
+from calibre.utils.localization import localize_user_manual_link
box_values = {}
last_matchkind = CONTAINS_MATCH
@@ -34,6 +35,7 @@ class SearchDialog(QDialog, Ui_Dialog):
def __init__(self, parent, db):
QDialog.__init__(self, parent)
self.setupUi(self)
+ self.um_label.setText(self.um_label.text() % localize_user_manual_link('http://manual.calibre-ebook.com/gui.html#the-search-interface'))
for val, text in [(0, '')] + [(i, date(2010, i, 1).strftime('%B')) for i in xrange(1, 13)]:
self.date_month.addItem(text, val)
for val, text in [('today', _('Today')), ('yesterday', _('Yesterday')), ('thismonth', _('This month'))]:
diff --git a/src/calibre/gui2/dialogs/search.ui b/src/calibre/gui2/dialogs/search.ui
index 3ecf5f035b..79d95ee52f 100644
--- a/src/calibre/gui2/dialogs/search.ui
+++ b/src/calibre/gui2/dialogs/search.ui
@@ -28,7 +28,7 @@
-
-
+
150
@@ -36,7 +36,7 @@
- <p>You can also perform other kinds of advanced searches, for example checking for books that have no covers, combining multiple search expression using Boolean operators and so on. See the <a href="http://manual.calibre-ebook.com/gui.html#the-search-interface">The Search Interface</a> for more information.
+ <p>You can also perform other kinds of advanced searches, for example checking for books that have no covers, combining multiple search expression using Boolean operators and so on. See the <a href="%s">The Search Interface</a> for more information.
true
diff --git a/src/calibre/gui2/dialogs/template_dialog.py b/src/calibre/gui2/dialogs/template_dialog.py
index 6b5cf2170a..a067f74a88 100644
--- a/src/calibre/gui2/dialogs/template_dialog.py
+++ b/src/calibre/gui2/dialogs/template_dialog.py
@@ -19,6 +19,7 @@ from calibre.ebooks.metadata.book.base import Metadata
from calibre.ebooks.metadata.book.formatter import SafeFormat
from calibre.library.coloring import (displayable_columns, color_row_key)
from calibre.gui2 import error_dialog, choose_files, pixmap_to_data
+from calibre.utils.localization import localize_user_manual_link
class ParenPosition:
@@ -330,12 +331,12 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
tt = _('Template language tutorial')
self.template_tutorial.setText(
- ''
- '%s'%tt)
+ '%s' % (
+ localize_user_manual_link('http://manual.calibre-ebook.com/template_lang.html'), tt))
tt = _('Template function reference')
self.template_func_reference.setText(
- ''
- '%s'%tt)
+ '%s' % (
+ localize_user_manual_link('http://manual.calibre-ebook.com/template_ref.html'), tt))
self.font_size_box.setValue(gprefs['gpm_template_editor_font_size'])
self.font_size_box.valueChanged.connect(self.font_size_changed)
diff --git a/src/calibre/gui2/filename_pattern.ui b/src/calibre/gui2/filename_pattern.ui
index 48cc109f84..ba11ce7b0a 100644
--- a/src/calibre/gui2/filename_pattern.ui
+++ b/src/calibre/gui2/filename_pattern.ui
@@ -15,11 +15,11 @@
-
-
+
<div style="font-size:10pt;">
<p>Set a regular expression pattern to use when trying to guess ebook metadata from filenames. </p>
-<p>A <a href="http://manual.calibre-ebook.com/regexp.html">tutorial</a> on using regular expressions is available.</p>
+<p>A <a href="%s">tutorial</a> on using regular expressions is available.</p>
<p>Use the <b>Test</b> functionality below to test your regular expression on a few sample filenames (remember to include the file extension). The group names for the various metadata entries are documented in tooltips.</p></div>
diff --git a/src/calibre/gui2/search_restriction_mixin.py b/src/calibre/gui2/search_restriction_mixin.py
index 7d9efbbdcb..91bdd69136 100644
--- a/src/calibre/gui2/search_restriction_mixin.py
+++ b/src/calibre/gui2/search_restriction_mixin.py
@@ -18,6 +18,7 @@ from calibre.gui2.widgets import ComboBoxWithHelp
from calibre.utils.config_base import tweaks
from calibre.utils.icu import sort_key
from calibre.utils.search_query_parser import ParseException
+from calibre.utils.localization import localize_user_manual_link
class SelectNames(QDialog): # {{{
@@ -150,8 +151,8 @@ class CreateVirtualLibrary(QDialog): # {{{
or only books by "My Favorite Author" or only books in a particular series.
More information and examples are available in the
- User Manual.
- '''))
+ User Manual.
+ ''') % localize_user_manual_link('http://manual.calibre-ebook.com/virtual_libraries.html'))
hl.setWordWrap(True)
hl.setOpenExternalLinks(True)
hl.setFrameStyle(hl.StyledPanel)
diff --git a/src/calibre/gui2/store/config/chooser/adv_search_builder.py b/src/calibre/gui2/store/config/chooser/adv_search_builder.py
index 2d4a2d798c..6519a070b2 100644
--- a/src/calibre/gui2/store/config/chooser/adv_search_builder.py
+++ b/src/calibre/gui2/store/config/chooser/adv_search_builder.py
@@ -12,24 +12,30 @@ from PyQt5.Qt import (QDialog, QDialogButtonBox)
from calibre.gui2.store.config.chooser.adv_search_builder_ui import Ui_Dialog
from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH
+from calibre.utils.localization import localize_user_manual_link
class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)
-
+ try:
+ self.sh_label.setText(self.sh_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/gui.html#the-search-interface'))
+ except TypeError:
+ pass # link already localized
+
self.buttonBox.accepted.connect(self.advanced_search_button_pushed)
self.tab_2_button_box.accepted.connect(self.accept)
self.tab_2_button_box.rejected.connect(self.reject)
self.clear_button.clicked.connect(self.clear_button_pushed)
self.adv_search_used = False
self.mc = ''
-
+
self.tabWidget.setCurrentIndex(0)
self.tabWidget.currentChanged[int].connect(self.tab_changed)
self.tab_changed(0)
-
+
def tab_changed(self, idx):
if idx == 1:
self.tab_2_button_box.button(QDialogButtonBox.Ok).setDefault(True)
diff --git a/src/calibre/gui2/store/config/chooser/adv_search_builder.ui b/src/calibre/gui2/store/config/chooser/adv_search_builder.ui
index 6833a2072e..e2d36c4e15 100644
--- a/src/calibre/gui2/store/config/chooser/adv_search_builder.ui
+++ b/src/calibre/gui2/store/config/chooser/adv_search_builder.ui
@@ -141,7 +141,7 @@
-
-
+
16777215
@@ -149,7 +149,7 @@
- See the <a href="http://manual.calibre-ebook.com/gui.html#the-search-interface">User Manual</a> for more help
+ See the <a href="%s">User Manual</a> for more help
true
diff --git a/src/calibre/gui2/store/search/adv_search_builder.py b/src/calibre/gui2/store/search/adv_search_builder.py
index 4abba13433..68934d6fa0 100644
--- a/src/calibre/gui2/store/search/adv_search_builder.py
+++ b/src/calibre/gui2/store/search/adv_search_builder.py
@@ -12,24 +12,30 @@ from PyQt5.Qt import (QDialog, QDialogButtonBox)
from calibre.gui2.store.search.adv_search_builder_ui import Ui_Dialog
from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH
+from calibre.utils.localization import localize_user_manual_link
class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)
-
+ try:
+ self.sh_label.setText(self.sh_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/gui.html#the-search-interface'))
+ except TypeError:
+ pass # link already localized
+
self.buttonBox.accepted.connect(self.advanced_search_button_pushed)
self.tab_2_button_box.accepted.connect(self.accept)
self.tab_2_button_box.rejected.connect(self.reject)
self.clear_button.clicked.connect(self.clear_button_pushed)
self.adv_search_used = False
self.mc = ''
-
+
self.tabWidget.setCurrentIndex(0)
self.tabWidget.currentChanged[int].connect(self.tab_changed)
self.tab_changed(0)
-
+
def tab_changed(self, idx):
if idx == 1:
self.tab_2_button_box.button(QDialogButtonBox.Ok).setDefault(True)
@@ -121,7 +127,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
format = unicode(self.format_box.text()).strip()
if format:
ans.append('format:"' + self.mc + format + '"')
- drm = '' if self.drm_combo.currentIndex() == 0 else 'true' if self.drm_combo.currentIndex() == 1 else 'false'
+ drm = '' if self.drm_combo.currentIndex() == 0 else 'true' if self.drm_combo.currentIndex() == 1 else 'false'
if drm:
ans.append('drm:' + drm)
download = '' if self.download_combo.currentIndex() == 0 else 'true' if self.download_combo.currentIndex() == 1 else 'false'
@@ -129,7 +135,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
ans.append('download:' + download)
affiliate = '' if self.affiliate_combo.currentIndex() == 0 else 'true' if self.affiliate_combo.currentIndex() == 1 else 'false'
if affiliate:
- ans.append('affiliate:' + affiliate)
+ ans.append('affiliate:' + affiliate)
if ans:
return ' and '.join(ans)
return ''
diff --git a/src/calibre/gui2/store/search/adv_search_builder.ui b/src/calibre/gui2/store/search/adv_search_builder.ui
index d0a589b2a0..0e7d5edf73 100644
--- a/src/calibre/gui2/store/search/adv_search_builder.ui
+++ b/src/calibre/gui2/store/search/adv_search_builder.ui
@@ -141,7 +141,7 @@
-
-
+
16777215
@@ -149,7 +149,7 @@
- See the <a href="http://manual.calibre-ebook.com/gui.html#the-search-interface">User Manual</a> for more help
+ See the <a href="%s">User Manual</a> for more help
true
diff --git a/src/calibre/gui2/tweak_book/function_replace.py b/src/calibre/gui2/tweak_book/function_replace.py
index f03812dae1..be1368c4c7 100644
--- a/src/calibre/gui2/tweak_book/function_replace.py
+++ b/src/calibre/gui2/tweak_book/function_replace.py
@@ -22,6 +22,7 @@ from calibre.gui2.tweak_book.editor.text import TextEdit
from calibre.utils.config import JSONConfig
from calibre.utils.icu import capitalize, upper, lower, swapcase
from calibre.utils.titlecase import titlecase
+from calibre.utils.localization import localize_user_manual_link
user_functions = JSONConfig('editor-search-replace-functions')
@@ -232,7 +233,7 @@ class FunctionEditor(Dialog):
self.la2 = la = QLabel(_(
'For help with creating functions, see the User Manual') %
- 'http://manual.calibre-ebook.com/function_mode.html')
+ localize_user_manual_link('http://manual.calibre-ebook.com/function_mode.html'))
la.setOpenExternalLinks(True)
l.addWidget(la)
diff --git a/src/calibre/gui2/tweak_book/ui.py b/src/calibre/gui2/tweak_book/ui.py
index d2ab26b1aa..ec0f27679c 100644
--- a/src/calibre/gui2/tweak_book/ui.py
+++ b/src/calibre/gui2/tweak_book/ui.py
@@ -43,6 +43,7 @@ from calibre.gui2.tweak_book.function_replace import DebugOutput
from calibre.gui2.tweak_book.editor.widget import register_text_editor_actions
from calibre.gui2.tweak_book.editor.insert_resource import InsertImage
from calibre.utils.icu import character_name, sort_key
+from calibre.utils.localization import localize_user_manual_link
def open_donate():
open_url(QUrl('http://calibre-ebook.com/donate'))
@@ -448,7 +449,8 @@ class Main(MainWindow):
'edit-clear.png', _('&Close other tabs'), self.central.close_all_but_current_editor, 'close-all-but-current-tab', 'Ctrl+Alt+W', _(
'Close all tabs except the current tab'))
self.action_help = treg(
- 'help.png', _('User &Manual'), lambda : open_url(QUrl('http://manual.calibre-ebook.com/edit.html')), 'user-manual', 'F1', _(
+ 'help.png', _('User &Manual'), lambda : open_url(localize_user_manual_link(QUrl(
+ 'http://manual.calibre-ebook.com/edit.html'))), 'user-manual', 'F1', _(
'Show User Manual'))
self.action_browse_images = treg(
'view-image.png', _('&Browse images in book'), self.boss.browse_images, 'browse-images', (), _(
diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py
index fa0f3d4653..733bc9b244 100644
--- a/src/calibre/gui2/widgets.py
+++ b/src/calibre/gui2/widgets.py
@@ -21,6 +21,7 @@ from calibre.utils.config import prefs, XMLConfig
from calibre.gui2.progress_indicator import ProgressIndicator as _ProgressIndicator
from calibre.gui2.dnd import (dnd_has_image, dnd_get_image, dnd_get_files,
IMAGE_EXTENSIONS, dnd_has_extension, DownloadDialog)
+from calibre.utils.localization import localize_user_manual_link
history = XMLConfig('history')
@@ -64,6 +65,11 @@ class FilenamePattern(QWidget, Ui_Form): # {{{
def __init__(self, parent):
QWidget.__init__(self, parent)
self.setupUi(self)
+ try:
+ self.help_label.setText(self.help_label.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/regexp.html'))
+ except TypeError:
+ pass # link already localized
self.test_button.clicked.connect(self.do_test)
self.re.lineEdit().returnPressed[()].connect(self.do_test)
diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py
index 2a0794e75c..eaa6183f68 100644
--- a/src/calibre/gui2/wizard/__init__.py
+++ b/src/calibre/gui2/wizard/__init__.py
@@ -24,6 +24,7 @@ from calibre.gui2.wizard.finish_ui import Ui_WizardPage as FinishUI
from calibre.gui2.wizard.kindle_ui import Ui_WizardPage as KindleUI
from calibre.gui2.wizard.stanza_ui import Ui_WizardPage as StanzaUI
from calibre.gui2 import min_available_height, available_width
+from calibre.utils.localization import localize_user_manual_link
from calibre.utils.config import dynamic, prefs
from calibre.gui2 import choose_dir, error_dialog
@@ -484,6 +485,12 @@ class StanzaPage(QWizardPage, StanzaUI):
def __init__(self):
QWizardPage.__init__(self)
self.setupUi(self)
+ try:
+ self.instructions.setText(self.instructions.text() % localize_user_manual_link(
+ 'http://manual.calibre-ebook.com/faq.html#how-do-i-use-calibre-with-my-ipad-iphone-ipod-touch'))
+ except TypeError:
+ pass # user manual link was already replaced
+ self.instructions.setOpenExternalLinks(True)
self.content_server.stateChanged[(int)].connect(self.set_port)
def initializePage(self):
@@ -852,6 +859,10 @@ class FinishPage(QWizardPage, FinishUI):
def __init__(self):
QWizardPage.__init__(self)
self.setupUi(self)
+ try:
+ self.um_label.setText(self.um_label.text() % localize_user_manual_link('http://manual.calibre-ebook.com'))
+ except TypeError:
+ pass # link already localized
def nextId(self):
return -1
diff --git a/src/calibre/gui2/wizard/finish.ui b/src/calibre/gui2/wizard/finish.ui
index 28972d864e..635eacd9d5 100644
--- a/src/calibre/gui2/wizard/finish.ui
+++ b/src/calibre/gui2/wizard/finish.ui
@@ -60,9 +60,9 @@
-
-
+
- <h2>User Manual</h2>A User Manual is also available <a href="http://manual.calibre-ebook.com">online</a>.
+ <h2>User Manual</h2>A User Manual is also available <a href="%s">online</a>.
true
diff --git a/src/calibre/gui2/wizard/stanza.ui b/src/calibre/gui2/wizard/stanza.ui
index 3801ba8222..859adcc481 100644
--- a/src/calibre/gui2/wizard/stanza.ui
+++ b/src/calibre/gui2/wizard/stanza.ui
@@ -70,7 +70,7 @@
<p>Remember to leave calibre running as the server only runs as long as calibre is running.
-<p>The reader app should see your calibre collection automatically. If not, try adding the URL http://myhostname:8080 as a new catalog in the reader on your iDevice. Here myhostname should be the fully qualified hostname or the IP address of the computer calibre is running on. See <a href="http://manual.calibre-ebook.com/faq.html#how-do-i-use-app-with-my-ipad-iphone-ipod-touch">the User Manual</a> for more information.
+<p>The reader app should see your calibre collection automatically. If not, try adding the URL http://myhostname:8080 as a new catalog in the reader on your iDevice. Here myhostname should be the fully qualified hostname or the IP address of the computer calibre is running on. See <a href="%s">the User Manual</a> for more information.
true