diff --git a/src/pyj/iframe_comm.pyj b/src/pyj/iframe_comm.pyj index fecec59d64..280642058c 100644 --- a/src/pyj/iframe_comm.pyj +++ b/src/pyj/iframe_comm.pyj @@ -9,7 +9,7 @@ import traceback from book_list.globals import get_translations, main_js from book_list.theme import get_font_family from dom import ensure_id -from gettext import gettext as _, install +from gettext import install LOADING_DOC = ''' @@ -227,7 +227,7 @@ class IframeClient: console.log(e) details = traceback.format_exc() console.log(details) - self.send_message('error', title=_('Error in message handler'), details=details, msg=e.toString()) + self.send_message('error', title='Error in message handler', details=details, msg=e.toString()) else: print('Unknown action in message to iframe from parent: ' + data.action) diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index fcbf3249b6..ee2506d45b 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -4,7 +4,6 @@ from __python__ import bound_methods, hash_literals import traceback from fs_images import fix_fullscreen_svg_images -from gettext import gettext as _ from iframe_comm import IframeClient from range_utils import ( highlight_associated_with_selection, last_span_for_crw, reset_highlight_counter, @@ -242,7 +241,7 @@ class IframeBoss: details = traceback.format_exception(error_object).join('') if error_object else '' if details: console.log(details) - self.send_message('error', title=_('Unhandled error'), details=details, msg=msg) + self.send_message('error', errkey='unhandled-error', details=details, msg=msg) except: console.log('There was an error in the iframe unhandled exception handler') else: @@ -379,8 +378,7 @@ class IframeBoss: def change_number_of_columns(self, data): if current_layout_mode() is 'flow': - self.send_message('error', title=_('In flow mode'), msg=_( - 'Cannot change number of pages per screen in flow mode, switch to paged mode first.')) + self.send_message('error', errkey='changing-columns-in-flow-mode') return cdata = get_columns_per_screen_data() delta = int(data.delta) diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index b8d117914a..feddd39dd6 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -784,6 +784,11 @@ class View: 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') + elif data.errkey is 'changing-columns-in-flow-mode': + title=_('In flow mode') + msg=_('Cannot change number of pages per screen in flow mode, switch to paged mode first.') + elif data.errkey = 'unhandled-error': + title = _('Unhandled error') if data.is_non_critical: warning_dialog(title, msg, data.details, on_close=ui_operations.focus_iframe) return