mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add menu entry to lookup input word in dictionary
This should close #971.
This commit is contained in:
@@ -11,12 +11,17 @@ local DEBUG = require("dbg")
|
||||
local _ = require("gettext")
|
||||
|
||||
-- Wikipedia as a special dictionary
|
||||
local ReaderWikipedia = ReaderDictionary:new{
|
||||
local ReaderWikipedia = ReaderDictionary:extend{
|
||||
-- identify itself
|
||||
wiki = true,
|
||||
no_page = _("No wiki page found."),
|
||||
}
|
||||
|
||||
-- the super "class" ReaderDictionary has already registers a menu entry
|
||||
-- we should override the init function in ReaderWikipedia
|
||||
function ReaderWikipedia:init()
|
||||
end
|
||||
|
||||
function ReaderWikipedia:onLookupWikipedia(word, box)
|
||||
-- detect language of the text
|
||||
local ok, lang = pcall(Translator.detect, Translator, word)
|
||||
|
||||
Reference in New Issue
Block a user