Fix a few more untranslated errors in the iframe

This commit is contained in:
Kovid Goyal 2021-06-04 05:25:44 +05:30
parent db1b00a158
commit 652943c31d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 6 deletions

View File

@ -9,7 +9,7 @@ import traceback
from book_list.globals import get_translations, main_js from book_list.globals import get_translations, main_js
from book_list.theme import get_font_family from book_list.theme import get_font_family
from dom import ensure_id from dom import ensure_id
from gettext import gettext as _, install from gettext import install
LOADING_DOC = ''' LOADING_DOC = '''
<!DOCTYPE html> <!DOCTYPE html>
@ -227,7 +227,7 @@ class IframeClient:
console.log(e) console.log(e)
details = traceback.format_exc() details = traceback.format_exc()
console.log(details) 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: else:
print('Unknown action in message to iframe from parent: ' + data.action) print('Unknown action in message to iframe from parent: ' + data.action)

View File

@ -4,7 +4,6 @@ from __python__ import bound_methods, hash_literals
import traceback import traceback
from fs_images import fix_fullscreen_svg_images from fs_images import fix_fullscreen_svg_images
from gettext import gettext as _
from iframe_comm import IframeClient from iframe_comm import IframeClient
from range_utils import ( from range_utils import (
highlight_associated_with_selection, last_span_for_crw, reset_highlight_counter, 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 '' details = traceback.format_exception(error_object).join('') if error_object else ''
if details: if details:
console.log(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: except:
console.log('There was an error in the iframe unhandled exception handler') console.log('There was an error in the iframe unhandled exception handler')
else: else:
@ -379,8 +378,7 @@ class IframeBoss:
def change_number_of_columns(self, data): def change_number_of_columns(self, data):
if current_layout_mode() is 'flow': if current_layout_mode() is 'flow':
self.send_message('error', title=_('In flow mode'), msg=_( self.send_message('error', errkey='changing-columns-in-flow-mode')
'Cannot change number of pages per screen in flow mode, switch to paged mode first.'))
return return
cdata = get_columns_per_screen_data() cdata = get_columns_per_screen_data()
delta = int(data.delta) delta = int(data.delta)

View File

@ -784,6 +784,11 @@ class View:
if data.errkey is 'no-auto-scroll-in-paged-mode': if data.errkey is 'no-auto-scroll-in-paged-mode':
title = _('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') 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: if data.is_non_critical:
warning_dialog(title, msg, data.details, on_close=ui_operations.focus_iframe) warning_dialog(title, msg, data.details, on_close=ui_operations.focus_iframe)
return return