Content server: Fix switching from translations to no translations not working

This commit is contained in:
Kovid Goyal 2018-03-24 10:13:54 +05:30
parent b6fb23ed68
commit a26292751d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 6 deletions

View File

@ -63,9 +63,7 @@ def init_ui():
, 0) # We do this after event loop ticks over to avoid catching popstate events that some browsers send on page load
translations = get_translations()
if translations:
install(translations)
get_translations(translations)
install(translations)
remove_initial_progress_bar()
document.head.appendChild(E.style(get_widget_css()))
set_css(document.body, background_color=get_color('window-background'), color=get_color('window-foreground'))
@ -88,7 +86,7 @@ def install_data_and_init_ui(raw_data):
interface_data = get_interface_data()
sd = UserSessionData(interface_data.username, interface_data.user_session_data)
set_session_data(sd)
if data.translations:
if data.translations?:
get_translations(data.translations)
init_ui()
@ -128,7 +126,7 @@ def do_update_interface_data():
if end_type is 'load':
data = JSON.parse(xhr.responseText)
update_interface_data(data)
if data.translations:
if data.translations?:
get_translations(data.translations)
install(data.translations)
).send()

View File

@ -201,7 +201,7 @@ def update_interface_data(new_data):
def get_translations(newval):
if not get_translations.storage:
get_translations.storage = SessionData('calibre-translations-')
if newval:
if newval?:
get_translations.storage.set('current', newval)
else:
return get_translations.storage.get('current')