From f1e7f5206313be955325ace744aa0defceab9ff8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 29 Apr 2021 07:03:59 +0530 Subject: [PATCH] Only generate back links to localized versions of the website if they exist --- manual/conf.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manual/conf.py b/manual/conf.py index 455a788ea1..e8969a89a9 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -19,10 +19,9 @@ base = os.path.dirname(os.path.abspath(__file__)) sys.path.append(base) sys.path.insert(0, os.path.dirname(base)) from setup import __appname__, __version__ -import calibre.utils.localization as l # Ensure calibre translations are installed +from calibre.utils.localization import localize_website_link import custom del sys.path[0] -del l custom # General configuration # --------------------- @@ -175,7 +174,9 @@ 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'] = 'https://calibre-ebook.com' + (f'/{language}' if needs_localization else '') +html_context['homepage_url'] = 'https://calibre-ebook.com' +if needs_localization: + html_context['homepage_url'] = localize_website_link(html_context['homepage_url']) extlinks = { 'website': (html_context['homepage_url'] + '/%s', None), }