mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Content server: Fix switching from translations to no translations not working
This commit is contained in:
parent
b6fb23ed68
commit
a26292751d
@ -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
|
, 0) # We do this after event loop ticks over to avoid catching popstate events that some browsers send on page load
|
||||||
|
|
||||||
translations = get_translations()
|
translations = get_translations()
|
||||||
if translations:
|
|
||||||
install(translations)
|
install(translations)
|
||||||
get_translations(translations)
|
|
||||||
remove_initial_progress_bar()
|
remove_initial_progress_bar()
|
||||||
document.head.appendChild(E.style(get_widget_css()))
|
document.head.appendChild(E.style(get_widget_css()))
|
||||||
set_css(document.body, background_color=get_color('window-background'), color=get_color('window-foreground'))
|
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()
|
interface_data = get_interface_data()
|
||||||
sd = UserSessionData(interface_data.username, interface_data.user_session_data)
|
sd = UserSessionData(interface_data.username, interface_data.user_session_data)
|
||||||
set_session_data(sd)
|
set_session_data(sd)
|
||||||
if data.translations:
|
if data.translations?:
|
||||||
get_translations(data.translations)
|
get_translations(data.translations)
|
||||||
init_ui()
|
init_ui()
|
||||||
|
|
||||||
@ -128,7 +126,7 @@ def do_update_interface_data():
|
|||||||
if end_type is 'load':
|
if end_type is 'load':
|
||||||
data = JSON.parse(xhr.responseText)
|
data = JSON.parse(xhr.responseText)
|
||||||
update_interface_data(data)
|
update_interface_data(data)
|
||||||
if data.translations:
|
if data.translations?:
|
||||||
get_translations(data.translations)
|
get_translations(data.translations)
|
||||||
install(data.translations)
|
install(data.translations)
|
||||||
).send()
|
).send()
|
||||||
|
@ -201,7 +201,7 @@ def update_interface_data(new_data):
|
|||||||
def get_translations(newval):
|
def get_translations(newval):
|
||||||
if not get_translations.storage:
|
if not get_translations.storage:
|
||||||
get_translations.storage = SessionData('calibre-translations-')
|
get_translations.storage = SessionData('calibre-translations-')
|
||||||
if newval:
|
if newval?:
|
||||||
get_translations.storage.set('current', newval)
|
get_translations.storage.set('current', newval)
|
||||||
else:
|
else:
|
||||||
return get_translations.storage.get('current')
|
return get_translations.storage.get('current')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user