From db1b00a1587cdf0075cb6e9cfa27f0c53e6e245d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Jun 2021 05:17:19 +0530 Subject: [PATCH] Fix #1930737 [[Enhancement] Warning is not translated](https://bugs.launchpad.net/calibre/+bug/1930737) --- src/pyj/read_book/paged_mode.pyj | 6 +----- src/pyj/read_book/view.pyj | 9 +++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pyj/read_book/paged_mode.pyj b/src/pyj/read_book/paged_mode.pyj index bc17069196..5438e7449a 100644 --- a/src/pyj/read_book/paged_mode.pyj +++ b/src/pyj/read_book/paged_mode.pyj @@ -25,7 +25,6 @@ from __python__ import hash_literals, bound_methods import traceback from elementmaker import E -from gettext import gettext as _ from dom import set_css from read_book.cfi import ( @@ -884,10 +883,7 @@ def resize_done(): def auto_scroll_action(action): if action is 'toggle': - get_boss().send_message('error', title=_('No auto scroll in paged mode'), msg=_( - 'Switch to flow mode (Viewer preferences->Page layout) to enable auto' - ' scrolling'), is_non_critical=True - ) + get_boss().send_message('error', errkey='no-auto-scroll-in-paged-mode', is_non_critical=True) return False diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 9e158be862..b8d117914a 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -779,10 +779,15 @@ class View: def on_iframe_error(self, data): title = data.title or _('There was an error processing the book') + msg = _('Unknown error') + if data.errkey: + if data.errkey is 'no-auto-scroll-in-paged-mode': + title = _('No auto scroll in paged mode') + msg = _('Switch to flow mode (Viewer preferences->Page layout) to enable auto scrolling') if data.is_non_critical: - warning_dialog(title, data.msg, data.details, on_close=ui_operations.focus_iframe) + warning_dialog(title, msg, data.details, on_close=ui_operations.focus_iframe) return - ui_operations.show_error(title, data.msg, data.details) + ui_operations.show_error(title, msg, data.details) def apply_color_scheme(self): self.current_color_scheme = ans = resolve_color_scheme()