mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Only generate back links to localized versions of the website if they exist
This commit is contained in:
parent
4a7016f020
commit
f1e7f52063
@ -19,10 +19,9 @@ base = os.path.dirname(os.path.abspath(__file__))
|
|||||||
sys.path.append(base)
|
sys.path.append(base)
|
||||||
sys.path.insert(0, os.path.dirname(base))
|
sys.path.insert(0, os.path.dirname(base))
|
||||||
from setup import __appname__, __version__
|
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
|
import custom
|
||||||
del sys.path[0]
|
del sys.path[0]
|
||||||
del l
|
|
||||||
custom
|
custom
|
||||||
# General configuration
|
# General configuration
|
||||||
# ---------------------
|
# ---------------------
|
||||||
@ -175,7 +174,9 @@ def sort_languages(x):
|
|||||||
html_context['other_languages'].sort(key=sort_languages)
|
html_context['other_languages'].sort(key=sort_languages)
|
||||||
html_context['support_text'] = _('Support calibre')
|
html_context['support_text'] = _('Support calibre')
|
||||||
html_context['support_tooltip'] = _('Contribute to support calibre development')
|
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 = {
|
extlinks = {
|
||||||
'website': (html_context['homepage_url'] + '/%s', None),
|
'website': (html_context['homepage_url'] + '/%s', None),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user