mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 00:13:50 +02:00
Use interface language rather than English as the default dictionary lookup language
This commit is contained in:
parent
46c0a9c6b6
commit
1a15bf6ea3
1 changed files with 5 additions and 3 deletions
|
|
@ -24,7 +24,7 @@
|
|||
from calibre import as_unicode, force_unicode, isbytestring
|
||||
from calibre.ptempfile import reset_base_dir
|
||||
from calibre.utils.zipfile import BadZipfile
|
||||
from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1
|
||||
from calibre.utils.localization import canonicalize_lang, lang_as_iso639_1, get_lang
|
||||
|
||||
vprefs = JSONConfig('viewer')
|
||||
dprefs = JSONConfig('viewer_dictionaries')
|
||||
|
|
@ -52,8 +52,10 @@ def __init__(self, path, parent):
|
|||
QAction.__init__(self, os.path.basename(path), parent)
|
||||
|
||||
def default_lookup_website(lang):
|
||||
if lang == 'und':
|
||||
lang = get_lang()
|
||||
lang = lang_as_iso639_1(lang) or lang
|
||||
if lang in ('und', 'en'):
|
||||
if lang == 'en':
|
||||
prefix = 'https://www.wordnik.com/words/'
|
||||
else:
|
||||
prefix = 'http://%s.wiktionary.org/wiki/' % lang
|
||||
|
|
@ -61,7 +63,7 @@ def default_lookup_website(lang):
|
|||
|
||||
def lookup_website(lang):
|
||||
if lang == 'und':
|
||||
lang = 'en'
|
||||
lang = get_lang()
|
||||
wm = dprefs['word_lookups']
|
||||
return wm.get(lang, default_lookup_website(lang))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue