Fix #1918153 [[Enhancement] Remember language when going to the calibre homepage from the User Manual](https://bugs.launchpad.net/calibre/+bug/1918153)

This commit is contained in:
Kovid Goyal 2021-03-09 11:50:39 +05:30
parent 0457fc1b9c
commit e57e255d3a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 2 deletions

View File

@ -93,7 +93,8 @@ unused_docs = ['global', 'cli/global']
locale_dirs = ['locale/']
title = '%s User Manual' % __appname__
if language not in {'en', 'eng'}:
needs_localization = language not in {'en', 'eng'}
if needs_localization:
import gettext
try:
t = gettext.translation('simple_index', locale_dirs[0], [language])
@ -174,6 +175,7 @@ def sort_languages(x):
html_context['other_languages'].sort(key=sort_languages)
html_context['support_text'] = _('Support calibre')
html_context['support_tooltip'] = _('Contribute to support calibre development')
html_context['homepage_url'] = 'http://calibre-ebook.com' + (f'/{language}' if needs_localization else '')
del sort_languages, get_language
epub_author = u'Kovid Goyal'

View File

@ -7,7 +7,7 @@ function toggle_languages_menu() {
</script>
<div style="text-align: center">
<a href="https://calibre-ebook.com" title="calibre homepage" id="calibre-homepage-logo"><img src="{{ pathto('_static/logo.png', 1) }}" /></a>
<a href="{{ homepage_url }}" title="calibre homepage" id="calibre-homepage-logo"><img src="{{ pathto('_static/logo.png', 1) }}" /></a>
<br/>
<form id="donate_form" action="https://www.paypal.com/cgi-bin/webscr" method="post" title="{{ support_tooltip }}">
<style>