From 56fa8a45b755a48d5d79a4a4550c4ab416cb4a99 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 09:39:50 +0800 Subject: [PATCH 01/10] remove rescaleByDPI since it's not reversible alternatively we store the original size before scaling by screen DPI and use that value when needed. --- frontend/ui/device/screen.lua | 4 ---- frontend/ui/font.lua | 4 +++- frontend/ui/rendertext.lua | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/ui/device/screen.lua b/frontend/ui/device/screen.lua index 788162dd1..83ea3d520 100644 --- a/frontend/ui/device/screen.lua +++ b/frontend/ui/device/screen.lua @@ -171,10 +171,6 @@ function Screen:scaleByDPI(px) return math.ceil(px * self:getDPI()/167) end -function Screen:rescaleByDPI(px) - return math.ceil(px * 167/self:getDPI()) -end - function Screen:getRotationMode() return self.cur_rotation_mode end diff --git a/frontend/ui/font.lua b/frontend/ui/font.lua index f457fc3aa..4c7a32a8a 100644 --- a/frontend/ui/font.lua +++ b/frontend/ui/font.lua @@ -54,6 +54,8 @@ function Font:getFace(font, size) font = self.cfont end + -- original size before scaling by screen DPI + local orig_size = size local size = Screen:scaleByDPI(size) local face = self.faces[font..size] @@ -72,7 +74,7 @@ function Font:getFace(font, size) self.faces[font..size] = face --DEBUG("getFace, found: "..realname.." size:"..size) end - return { size = size, ftface = face, hash = font..size } + return { size = size, orig_size = orig_size, ftface = face, hash = font..size } end function Font:_readList(target, dir, effective_dir) diff --git a/frontend/ui/rendertext.lua b/frontend/ui/rendertext.lua index 2b2b753c5..03a7e9464 100644 --- a/frontend/ui/rendertext.lua +++ b/frontend/ui/rendertext.lua @@ -73,8 +73,8 @@ function RenderText:getGlyph(face, charcode, bold, bgcolor, fgcolor) local rendered_glyph = face.ftface:renderGlyph(charcode, bgcolor, fgcolor, bold) if face.ftface:checkGlyph(charcode) == 0 then for index, font in pairs(Font.fallbacks) do - -- rescale face size by DPI since it will be scaled in getFace again - local fb_face = Font:getFace(font, Screen:rescaleByDPI(face.size)) + -- use original size before scaling by screen DPI + local fb_face = Font:getFace(font, face.orig_size) if fb_face.ftface:checkGlyph(charcode) ~= 0 then rendered_glyph = fb_face.ftface:renderGlyph(charcode, bgcolor, fgcolor, bold) --DEBUG("fallback to font", font) From 7b10d66e1b812359be8db285732180288633a499 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 14:41:45 +0800 Subject: [PATCH 02/10] enable Wikipedia support Since wikipedia server is language specific we should first detect language of the text by querying Google Translate. Make sure you have access to both Google Translate and Wikipedia service to use this function. --- .../apps/reader/modules/readerdictionary.lua | 27 ++---- .../apps/reader/modules/readerhighlight.lua | 40 ++++++--- .../apps/reader/modules/readerwikipedia.lua | 51 +++++++++++ frontend/apps/reader/readerui.lua | 8 ++ frontend/ui/translator.lua | 85 +++++++++++++++++++ frontend/ui/widget/dictquicklookup.lua | 38 ++++++++- frontend/ui/wikipedia.lua | 84 ++++++++++++++++++ 7 files changed, 296 insertions(+), 37 deletions(-) create mode 100644 frontend/apps/reader/modules/readerwikipedia.lua create mode 100644 frontend/ui/translator.lua create mode 100644 frontend/ui/wikipedia.lua diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index ecabd4eee..6f5119283 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -12,6 +12,7 @@ local ReaderDictionary = EventListener:new{} function ReaderDictionary:onLookupWord(word, box, highlight) self.highlight = highlight self:stardictLookup(word, box) + return true end function ReaderDictionary:stardictLookup(word, box) @@ -47,24 +48,7 @@ end function ReaderDictionary:showDict(results, box) if results and results[1] then - DEBUG("showing quick lookup dictionary window") - local align = "center" - local region = Geom:new{ - x = 0, y = 0, - w = Screen:getWidth(), - h = Screen:getHeight(), - } - if box then - if box.y + box.h/2 < Screen:getHeight()/2 then - region.y = box.y + box.h - region.h = Screen:getHeight() - box.y - box.h - align = "top" - else - region.y = 0 - region.h = box.y - align = "bottom" - end - end + DEBUG("showing quick lookup window") UIManager:show(DictQuickLookup:new{ ui = self.ui, highlight = self.highlight, @@ -72,9 +56,9 @@ function ReaderDictionary:showDict(results, box) results = results, dictionary = self.default_dictionary, width = Screen:getWidth() - Screen:scaleByDPI(80), - height = math.min(region.h*0.7, Screen:getHeight()*0.5), - region = region, - align = align, + word_box = box, + -- differentiate between dict and wiki + wiki = self.wiki, }) end end @@ -82,6 +66,7 @@ end function ReaderDictionary:onUpdateDefaultDict(dict) DEBUG("make default dictionary:", dict) self.default_dictionary = dict + return true end function ReaderDictionary:onReadSettings(config) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 494abd8e9..c6d869e9f 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -294,8 +294,7 @@ function ReaderHighlight:onHoldRelease() text = _("Highlight"), callback = function() self:saveHighlight() - UIManager:close(self.highlight_dialog) - self:handleEvent(Event:new("Tap")) + self:onClose() end, }, { @@ -303,39 +302,44 @@ function ReaderHighlight:onHoldRelease() enabled = false, callback = function() self:addNote() - UIManager:close(self.highlight_dialog) - self:handleEvent(Event:new("Tap")) + self:onClose() end, }, }, { + { + text = _("Wikipedia"), + callback = function() + UIManager:scheduleIn(0.1, function() + self:lookupWikipedia() + self:onClose() + end) + end, + }, { text = _("Translate"), enabled = false, callback = function() self:translate(self.selected_text) - UIManager:close(self.highlight_dialog) - self:handleEvent(Event:new("Tap")) + self:onClose() end, }, + }, + { { text = _("Share"), enabled = false, callback = function() self:shareHighlight() - UIManager:close(self.highlight_dialog) - self:handleEvent(Event:new("Tap")) + self:onClose() end, }, - }, - { { text = _("More"), enabled = false, callback = function() self:moreAction() - UIManager:close(self.highlight_dialog) - self:handleEvent(Event:new("Tap")) + self:onClose() end, }, }, @@ -411,6 +415,12 @@ function ReaderHighlight:addNote() DEBUG("add Note") end +function ReaderHighlight:lookupWikipedia() + if self.selected_text then + self.ui:handleEvent(Event:new("LookupWikipedia", self.selected_text.text)) + end +end + function ReaderHighlight:shareHighlight() DEBUG("share highlight") end @@ -436,4 +446,10 @@ function ReaderHighlight:onSaveSettings() self.ui.doc_settings:saveSetting("highlight_drawer", self.view.highlight.saved_drawer) end +function ReaderHighlight:onClose() + UIManager:close(self.highlight_dialog) + -- clear highlighted text + self:handleEvent(Event:new("Tap")) +end + return ReaderHighlight diff --git a/frontend/apps/reader/modules/readerwikipedia.lua b/frontend/apps/reader/modules/readerwikipedia.lua new file mode 100644 index 000000000..17821e181 --- /dev/null +++ b/frontend/apps/reader/modules/readerwikipedia.lua @@ -0,0 +1,51 @@ +local ReaderDictionary = require("apps/reader/modules/readerdictionary") +local EventListener = require("ui/widget/eventlistener") +local Translator = require("ui/translator") +local Wikipedia = require("ui/wikipedia") +local UIManager = require("ui/uimanager") +local Geom = require("ui/geometry") +local Screen = require("ui/screen") +local JSON = require("JSON") +local DEBUG = require("dbg") +local _ = require("gettext") + +-- Wikipedia as a special dictionary +local ReaderWikipedia = ReaderDictionary:new{ + -- identify itself + wiki = true, + no_page = _("No wiki page found."), +} + +function ReaderWikipedia:onLookupWikipedia(word, box) + local lang = Translator:detect(word) or "en" + -- convert "zh-CN" and "zh-TW" to "zh" + lang = lang:match("(.*)-") or lang + local results = {} + local ok, pages = pcall(Wikipedia.wikintro, Wikipedia, word, lang) + if ok and pages then + for pageid, page in pairs(pages) do + local result = { + dict = _("Wikipedia"), + word = page.title, + definition = page.extract or self.no_page, + } + table.insert(results, result) + end + DEBUG("lookup result:", word, results) + self:showDict(results, box) + else + DEBUG("error:", pages) + -- dummy results + results = { + { + dict = _("Wikipedia"), + word = word, + definition = self.no_page, + } + } + DEBUG("dummy result table:", word, results) + self:showDict(results, box) + end +end + +return ReaderWikipedia diff --git a/frontend/apps/reader/readerui.lua b/frontend/apps/reader/readerui.lua index 9bc50c61e..352da8887 100644 --- a/frontend/apps/reader/readerui.lua +++ b/frontend/apps/reader/readerui.lua @@ -29,6 +29,7 @@ local ReaderHighlight = require("apps/reader/modules/readerhighlight") local ReaderScreenshot = require("apps/reader/modules/readerscreenshot") local ReaderFrontLight = require("apps/reader/modules/readerfrontlight") local ReaderDictionary = require("apps/reader/modules/readerdictionary") +local ReaderWikipedia = require("apps/reader/modules/readerwikipedia") local ReaderHyphenation = require("apps/reader/modules/readerhyphenation") local ReaderActivityIndicator = require("apps/reader/modules/readeractivityindicator") local ReaderLink = require("apps/reader/modules/readerlink") @@ -142,6 +143,13 @@ function ReaderUI:init() ui = self, document = self.document, }) + -- wikipedia + table.insert(self, ReaderWikipedia:new{ + dialog = self.dialog, + view = self[1], + ui = self, + document = self.document, + }) -- screenshot controller table.insert(self.active_widgets, ReaderScreenshot:new{ dialog = self.dialog, diff --git a/frontend/ui/translator.lua b/frontend/ui/translator.lua new file mode 100644 index 000000000..357d8c83b --- /dev/null +++ b/frontend/ui/translator.lua @@ -0,0 +1,85 @@ +local socket = require('socket') +local url = require('socket.url') +local http = require('socket.http') +local https = require('ssl.https') +local ltn12 = require('ltn12') +local JSON = require("JSON") +local DEBUG = require("dbg") + +--[[ +-- Translate text using Google Translate. +-- http://translate.google.com/translate_a/t?client=z&ie=UTF-8&oe=UTF-8&hl=en&tl=en&text=hello +--]] + +local Translator = { + trans_servers = { + "http://translate.google.cn", + "http://translate.google.com", + }, + trans_path = "/translate_a/t", + trans_params = { + client = "z", -- client z returns normal JSON result + ie = "UTF-8", + oe = "UTF-8", + hl = "en", + tl = "en", + sl = nil, -- we don't specify source languagae to detect language + }, + default_lang = "en", +} + +function Translator:getTransServer() + return G_reader_settings:readSetting("trans_server") or self.trans_servers[1] +end + +--[[ +-- return decoded JSON table from translate server +--]] +function Translator:loadPage(target_lang, source_lang, text) + local request, sink = {}, {} + local query = "" + self.trans_params.tl = target_lang + self.trans_params.sl = source_lang + for k,v in pairs(self.trans_params) do + query = query .. k .. '=' .. v .. '&' + end + local parsed = url.parse(self:getTransServer()) + parsed.path = self.trans_path + parsed.query = query .. "text=" .. url.escape(text) + + -- HTTP request + request['url'] = url.build(parsed) + request['method'] = 'GET' + request['sink'] = ltn12.sink.table(sink) + DEBUG("request", request) + http.TIMEOUT, https.TIMEOUT = 10, 10 + local httpRequest = parsed.scheme == 'http' and http.request or https.request + local code, headers, status = socket.skip(1, httpRequest(request)) + + -- raise error message when network is unavailable + if headers == nil then + error("Network is unreachable") + end + + local content = table.concat(sink) + if content ~= "" then + local ok, result = pcall(JSON.decode, JSON, content) + if ok and result then + --DEBUG("translate result", result) + return result + else + DEBUG("error:", result) + end + end +end + +function Translator:detect(text) + local result = self:loadPage("en", nil, text) + if result then + local src_lang = result.src + DEBUG("detected language:", src_lang) + return src_lang + end +end + +return Translator diff --git a/frontend/ui/widget/dictquicklookup.lua b/frontend/ui/widget/dictquicklookup.lua index 071b0e827..fd232affc 100644 --- a/frontend/ui/widget/dictquicklookup.lua +++ b/frontend/ui/widget/dictquicklookup.lua @@ -37,6 +37,8 @@ local DictQuickLookup = InputContainer:new{ content_face = Font:getFace("cfont", DDICT_FONT_SIZE), width = nil, height = nil, + -- box of highlighted word, quick lookup window tries to not hide the word + word_box = nil, title_padding = Screen:scaleByDPI(5), title_margin = Screen:scaleByDPI(2), @@ -85,6 +87,26 @@ function DictQuickLookup:init() end function DictQuickLookup:update() + -- calculate window dimension and try to not hide highlighted word + self.align = "center" + self.region = Geom:new{ + x = 0, y = 0, + w = Screen:getWidth(), + h = Screen:getHeight(), + } + if self.word_box then + local box = self.word_box + if box.y + box.h/2 < Screen:getHeight()/2 then + self.region.y = box.y + box.h + self.region.h = Screen:getHeight() - box.y - box.h + self.align = "top" + else + self.region.y = 0 + self.region.h = box.y + self.align = "bottom" + end + end + self.height = math.min(self.region.h*0.7, Screen:getHeight()*0.5) -- dictionary title self.dict_title = FrameContainer:new{ padding = self.title_padding, @@ -150,9 +172,11 @@ function DictQuickLookup:update() { { text = _("Wikipedia"), - enabled = false, callback = function() - self.ui:handleEvent(Event:new("HighlightWiki")) + UIManager:scheduleIn(0.1, function() + self:lookupWikipedia() + self:onClose() + end) end, }, { @@ -225,7 +249,7 @@ function DictQuickLookup:update() } self[1] = WidgetContainer:new{ align = self.align, - dimen = self.region:copy(), + dimen = self.region, FrameContainer:new{ bordersize = 0, padding = Screen:scaleByDPI(5), @@ -336,6 +360,7 @@ function DictQuickLookup:lookupInputWord(hint) self:onClose() self.input_dialog = InputDialog:new{ title = _("Input lookup word"), + input = hint, input_hint = hint or "", input_type = "text", buttons = { @@ -369,7 +394,8 @@ end function DictQuickLookup:inputLookup() local word = self.input_dialog:getInputText() if word and word ~= "" then - self.ui:handleEvent(Event:new("LookupWord", word)) + local event = self.wiki and "LookupWikipedia" or "LookupWord" + self.ui:handleEvent(Event:new(event, word)) end end @@ -378,4 +404,8 @@ function DictQuickLookup:closeInputDialog() UIManager:close(self.input_dialog) end +function DictQuickLookup:lookupWikipedia() + self.ui:handleEvent(Event:new("LookupWikipedia", self.lookupword, self.word_box)) +end + return DictQuickLookup diff --git a/frontend/ui/wikipedia.lua b/frontend/ui/wikipedia.lua new file mode 100644 index 000000000..b75bd9c05 --- /dev/null +++ b/frontend/ui/wikipedia.lua @@ -0,0 +1,84 @@ +local socket = require('socket') +local url = require('socket.url') +local http = require('socket.http') +local https = require('ssl.https') +local ltn12 = require('ltn12') +local JSON = require("JSON") +local DEBUG = require("dbg") + +--[[ +-- Query wikipedia using Wikimedia Web API. +-- http://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exintro=&explaintext=&redirects=&titles=hello +--]] + +local Wikipedia = { + wiki_server = "http://%s.wikipedia.org", + wiki_path = "/w/api.php", + wiki_params = { + action = "query", + prop = "extracts", + format = "json", + exintro = "", + explaintext = "", + redirects = "", + }, + default_lang = "en", +} + +function Wikipedia:getWikiServer(lang) + return string.format(self.wiki_server, lang or self.default_lang) +end + +--[[ +-- return decoded JSON table from Wikipedia +--]] +function Wikipedia:loadPage(text, lang, intro, plain) + local request, sink = {}, {} + local query = "" + self.wiki_params.exintro = intro and "" or nil + self.wiki_params.explaintext = plain and "" or nil + for k,v in pairs(self.wiki_params) do + query = query .. k .. '=' .. v .. '&' + end + local parsed = url.parse(self:getWikiServer(lang)) + parsed.path = self.wiki_path + parsed.query = query .. "titles=" .. url.escape(text) + + -- HTTP request + request['url'] = url.build(parsed) + request['method'] = 'GET' + request['sink'] = ltn12.sink.table(sink) + DEBUG("request", request) + http.TIMEOUT, https.TIMEOUT = 10, 10 + local httpRequest = parsed.scheme == 'http' and http.request or https.request + local code, headers, status = socket.skip(1, httpRequest(request)) + + -- raise error message when network is unavailable + if headers == nil then + error("Network is unreachable") + end + + local content = table.concat(sink) + if content ~= "" then + local ok, result = pcall(JSON.decode, JSON, content) + if ok and result then + DEBUG("wiki result", result) + return result + else + DEBUG("error:", result) + end + end +end + +-- extract intro passage in wiki page +function Wikipedia:wikintro(text, lang) + local result = self:loadPage(text, lang, true, true) + if result then + local query = result.query + if query then + return query.pages + end + end +end + +return Wikipedia From 948d92a3b3b60193f1e0ba6fd3176d63dfed2b84 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 14:45:11 +0800 Subject: [PATCH 03/10] fix tap on word title will crash koreader --- frontend/ui/uimanager.lua | 4 +++- frontend/ui/widget/button.lua | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 74d8df49f..9d2c79ea4 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -249,7 +249,9 @@ function UIManager:setDirty(widget, refresh_type) if not refresh_type then refresh_type = "auto" end - self._dirty[widget] = refresh_type + if widget then + self._dirty[widget] = refresh_type + end end function UIManager:insertZMQ(zeromq) diff --git a/frontend/ui/widget/button.lua b/frontend/ui/widget/button.lua index 68a6e3f03..714a652cb 100644 --- a/frontend/ui/widget/button.lua +++ b/frontend/ui/widget/button.lua @@ -147,7 +147,7 @@ function Button:showHide(show) end function Button:onTapSelect() - if self.enabled then + if self.enabled and self.callback then self[1].invert = true UIManager:setDirty(self.show_parent, "partial") UIManager:scheduleIn(0.1, function() From c83f35a0d07dfde280712c387a14cd0525bae111 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 14:45:38 +0800 Subject: [PATCH 04/10] long press the backspace key will clear input text --- frontend/ui/widget/inputtext.lua | 6 ++++++ frontend/ui/widget/virtualkeyboard.lua | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/frontend/ui/widget/inputtext.lua b/frontend/ui/widget/inputtext.lua index 262e0ab4b..cba04858a 100644 --- a/frontend/ui/widget/inputtext.lua +++ b/frontend/ui/widget/inputtext.lua @@ -151,6 +151,12 @@ function InputText:delChar() UIManager:setDirty(self.parent, "partial") end +function InputText:clear() + self.text = "" + self:initTextBox() + UIManager:setDirty(self.parent, "partial") +end + function InputText:getText() return self.text end diff --git a/frontend/ui/widget/virtualkeyboard.lua b/frontend/ui/widget/virtualkeyboard.lua index 617eedf12..bd863a9fc 100644 --- a/frontend/ui/widget/virtualkeyboard.lua +++ b/frontend/ui/widget/virtualkeyboard.lua @@ -41,6 +41,7 @@ function VirtualKey:init() self.callback = function () self.keyboard:setLayout(self.key or self.label) end elseif self.label == "Backspace" then self.callback = function () self.keyboard:delChar() end + self.hold_callback = function () self.keyboard:clear() end else self.callback = function () self.keyboard:addChar(self.key) end end @@ -83,6 +84,12 @@ function VirtualKey:init() range = self.dimen, }, }, + HoldSelect = { + GestureRange:new{ + ges = "hold", + range = self.dimen, + }, + }, } end end @@ -96,6 +103,15 @@ function VirtualKey:onTapSelect() return true end +function VirtualKey:onHoldSelect() + self[1].invert = true + if self.hold_callback then + self.hold_callback() + end + UIManager:scheduleIn(0.5, function() self:invert(false) end) + return true +end + function VirtualKey:invert(invert) self[1].invert = invert UIManager:setDirty(self.keyboard, "partial") @@ -191,7 +207,7 @@ function VirtualKeyboard:init() for i = 1, string.len(GLOBAL_INPUT_VALUE) do self:addChar(string.sub(GLOBAL_INPUT_VALUE,i,i)) end - end + end end function VirtualKeyboard:initLayout(layout) @@ -303,4 +319,11 @@ function VirtualKeyboard:delChar() UIManager:setDirty(self.inputbox, "partial") end +function VirtualKeyboard:clear() + DEBUG("clear input") + self.inputbox:clear() + UIManager:setDirty(self, "partial") + UIManager:setDirty(self.inputbox, "partial") +end + return VirtualKeyboard From 9d6a5b8e7d596ed70ee05eeb681d417dfc468edd Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 15:19:18 +0800 Subject: [PATCH 05/10] update pot file --- l10n/templates/koreader.pot | 171 +++++++++++++++++++----------------- 1 file changed, 91 insertions(+), 80 deletions(-) diff --git a/l10n/templates/koreader.pot b/l10n/templates/koreader.pot index 61abac261..bc9b4841f 100644 --- a/l10n/templates/koreader.pot +++ b/l10n/templates/koreader.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://github.com/koreader/koreader-base/issues\n" -"POT-Creation-Date: 2014-08-19 08:01+0000\n" +"POT-Creation-Date: 2014-08-20 07:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -17,24 +17,14 @@ msgid "" " does not exist" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:435 -msgid "" -" found" -msgstr "" - -#: frontend/apps/filemanager/filemanagersearch.lua:437 -msgid "" -" matching " -msgstr "" - #: plugins/evernote.koplugin/main.lua:334 msgid "" " others." msgstr "" -#: frontend/ui/uimanager.lua:516 -#: frontend/ui/uimanager.lua:522 -#: frontend/ui/uimanager.lua:528 +#: frontend/ui/uimanager.lua:518 +#: frontend/ui/uimanager.lua:524 +#: frontend/ui/uimanager.lua:530 msgid "" " pages" msgstr "" @@ -59,8 +49,8 @@ msgid "" "5 deg" msgstr "" -#: frontend/apps/reader/modules/readerhighlight.lua:302 -#: frontend/ui/widget/dictquicklookup.lua:159 +#: frontend/apps/reader/modules/readerhighlight.lua:301 +#: frontend/ui/widget/dictquicklookup.lua:183 msgid "" "Add Note" msgstr "" @@ -70,19 +60,19 @@ msgid "" "Apply" msgstr "" -#: frontend/apps/filemanager/filemanagersetdefaults.lua:249 +#: frontend/apps/filemanager/filemanagersetdefaults.lua:267 msgid "" "Are you sure to save the settings to \"defaults.persistent.lua\"?" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:483 -#: frontend/apps/filemanager/filemanagersearch.lua:584 +#: frontend/apps/filemanager/filemanagersearch.lua:569 +#: frontend/apps/filemanager/filemanagersearch.lua:670 msgid "" -"Author(s): " +"Author(s):" msgstr "" #: frontend/apps/reader/modules/readertypeset.lua:66 -#: frontend/ui/device/screen.lua:262 +#: frontend/ui/device/screen.lua:258 msgid "" "Auto" msgstr "" @@ -98,27 +88,27 @@ msgid "" "Bookmarks" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:620 +#: frontend/apps/filemanager/filemanagersearch.lua:706 msgid "" -"Browse " +"Browse" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:195 +#: frontend/apps/filemanager/filemanagersearch.lua:209 msgid "" "Browse series" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:209 +#: frontend/apps/filemanager/filemanagersearch.lua:223 msgid "" "Browse tags" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:225 -#: frontend/apps/filemanager/filemanagersetdefaults.lua:134 -#: frontend/apps/filemanager/filemanagersetdefaults.lua:192 +#: frontend/apps/filemanager/filemanagersearch.lua:239 +#: frontend/apps/filemanager/filemanagersetdefaults.lua:125 +#: frontend/apps/filemanager/filemanagersetdefaults.lua:183 #: frontend/apps/reader/modules/readergoto.lua:36 #: frontend/ui/widget/confirmbox.lua:29 -#: frontend/ui/widget/dictquicklookup.lua:344 +#: frontend/ui/widget/dictquicklookup.lua:369 #: frontend/ui/widget/touchmenu.lua:547 #: plugins/evernote.koplugin/main.lua:124 #: plugins/zsync.koplugin/main.lua:274 @@ -167,14 +157,14 @@ msgid "" "Copy" msgstr "" -#: frontend/ui/uimanager.lua:516 -#: frontend/ui/uimanager.lua:522 -#: frontend/ui/uimanager.lua:528 +#: frontend/ui/uimanager.lua:518 +#: frontend/ui/uimanager.lua:524 +#: frontend/ui/uimanager.lua:530 msgid "" "Custom " msgstr "" -#: frontend/ui/device/screen.lua:293 +#: frontend/ui/device/screen.lua:289 msgid "" "Custom DPI" msgstr "" @@ -184,7 +174,7 @@ msgid "" "Cut" msgstr "" -#: frontend/apps/filemanager/filemanagersetdefaults.lua:331 +#: frontend/apps/filemanager/filemanagersetdefaults.lua:349 msgid "" "Default settings successfully saved!" msgstr "" @@ -236,7 +226,7 @@ msgid "" "Downloading may take several minutes..." msgstr "" -#: frontend/ui/uimanager.lua:503 +#: frontend/ui/uimanager.lua:505 msgid "" "E-ink full refresh rate" msgstr "" @@ -272,12 +262,12 @@ msgid "" "Evernote" msgstr "" -#: frontend/ui/uimanager.lua:511 +#: frontend/ui/uimanager.lua:513 msgid "" "Every 6 pages" msgstr "" -#: frontend/ui/uimanager.lua:506 +#: frontend/ui/uimanager.lua:508 msgid "" "Every page" msgstr "" @@ -323,7 +313,7 @@ msgid "" "File manager menu" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:451 +#: frontend/apps/filemanager/filemanagersearch.lua:537 msgid "" "File not found!" msgstr "" @@ -333,7 +323,7 @@ msgid "" "FileManager" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:236 +#: frontend/apps/filemanager/filemanagersearch.lua:247 msgid "" "Find books" msgstr "" @@ -405,7 +395,7 @@ msgid "" msgstr "" #: frontend/apps/reader/modules/readerhighlight.lua:294 -#: frontend/ui/widget/dictquicklookup.lua:137 +#: frontend/ui/widget/dictquicklookup.lua:159 msgid "" "Highlight" msgstr "" @@ -425,17 +415,17 @@ msgid "" "Indentation" msgstr "" -#: frontend/ui/widget/dictquicklookup.lua:338 +#: frontend/ui/widget/dictquicklookup.lua:362 msgid "" "Input lookup word" msgstr "" -#: frontend/ui/uimanager.lua:492 +#: frontend/ui/uimanager.lua:494 msgid "" "Input page number for a full refresh" msgstr "" -#: frontend/ui/device/screen.lua:300 +#: frontend/ui/device/screen.lua:296 msgid "" "Input screen DPI" msgstr "" @@ -465,7 +455,7 @@ msgid "" "Language" msgstr "" -#: frontend/ui/device/screen.lua:285 +#: frontend/ui/device/screen.lua:281 msgid "" "Large" msgstr "" @@ -511,18 +501,18 @@ msgid "" "Logout" msgstr "" -#: frontend/ui/widget/dictquicklookup.lua:350 +#: frontend/ui/widget/dictquicklookup.lua:375 msgid "" "Lookup" msgstr "" -#: frontend/ui/device/screen.lua:277 +#: frontend/ui/device/screen.lua:273 msgid "" "Medium" msgstr "" -#: frontend/apps/reader/modules/readerhighlight.lua:333 -#: frontend/ui/widget/dictquicklookup.lua:166 +#: frontend/apps/reader/modules/readerhighlight.lua:338 +#: frontend/ui/widget/dictquicklookup.lua:190 msgid "" "More" msgstr "" @@ -533,16 +523,19 @@ msgid "" "Night mode" msgstr "" -#: frontend/apps/reader/modules/readerdictionary.lua:39 +#: frontend/apps/filemanager/filemanagersearch.lua:521 +msgid "" +"No" +msgstr "" + +#: frontend/apps/reader/modules/readerdictionary.lua:40 msgid "" "No definition found." msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:433 +#: frontend/apps/filemanager/filemanagersearch.lua:519 msgid "" -"No match for \" .. self.search_value)\n" -" else\n" -" dummy = _(\"No " +"No match for" msgstr "" #: reader.lua:91 @@ -550,12 +543,17 @@ msgid "" "No reader engine for this file" msgstr "" +#: frontend/apps/reader/modules/readerwikipedia.lua:16 +msgid "" +"No wiki page found." +msgstr "" + #: plugins/evernote.koplugin/main.lua:350 msgid "" "Note: " msgstr "" -#: frontend/apps/filemanager/filemanagersetdefaults.lua:200 +#: frontend/apps/filemanager/filemanagersetdefaults.lua:191 #: frontend/apps/reader/modules/readerfrontlight.lua:115 #: frontend/ui/widget/confirmbox.lua:28 #: frontend/ui/widget/touchmenu.lua:553 @@ -623,8 +621,8 @@ msgid "" "Paste" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:489 -#: frontend/apps/filemanager/filemanagersearch.lua:590 +#: frontend/apps/filemanager/filemanagersearch.lua:575 +#: frontend/apps/filemanager/filemanagersearch.lua:676 msgid "" "Path: " msgstr "" @@ -676,7 +674,7 @@ msgid "" "Render Quality" msgstr "" -#: frontend/ui/device/screen.lua:259 +#: frontend/ui/device/screen.lua:255 msgid "" "Screen DPI" msgstr "" @@ -697,12 +695,12 @@ msgid "" "Scroll Mode" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:191 +#: frontend/apps/filemanager/filemanagersearch.lua:205 msgid "" "Search Books" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:510 +#: frontend/apps/filemanager/filemanagersearch.lua:596 msgid "" "Search Results" msgstr "" @@ -712,10 +710,10 @@ msgid "" "Search books" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:485 -#: frontend/apps/filemanager/filemanagersearch.lua:586 +#: frontend/apps/filemanager/filemanagersearch.lua:571 +#: frontend/apps/filemanager/filemanagersearch.lua:672 msgid "" -"Series: " +"Series:" msgstr "" #: frontend/ui/widget/configdialog.lua:582 @@ -773,7 +771,7 @@ msgid "" "Settings" msgstr "" -#: frontend/apps/reader/modules/readerhighlight.lua:322 +#: frontend/apps/reader/modules/readerhighlight.lua:330 msgid "" "Share" msgstr "" @@ -793,16 +791,21 @@ msgid "" "Show page overlap" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:453 +#: frontend/apps/filemanager/filemanagersearch.lua:539 msgid "" -"Size: " +"Size:" msgstr "" -#: frontend/ui/device/screen.lua:269 +#: frontend/ui/device/screen.lua:265 msgid "" "Small" msgstr "" +#: frontend/apps/filemanager/filemanagersetdefaults.lua:78 +msgid "" +"Some changes will just work on the next restart. Wrong settings might crash Koreader! Continue?" +msgstr "" + #: frontend/apps/filemanager/filemanagermenu.lua:92 msgid "" "Start with last opened file" @@ -853,10 +856,10 @@ msgid "" "Table of contents" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:484 -#: frontend/apps/filemanager/filemanagersearch.lua:585 +#: frontend/apps/filemanager/filemanagersearch.lua:570 +#: frontend/apps/filemanager/filemanagersearch.lua:671 msgid "" -"Tags: " +"Tags:" msgstr "" #: frontend/ui/data/strings.lua:12 @@ -864,13 +867,13 @@ msgid "" "Text Align" msgstr "" -#: frontend/ui/device/screen.lua:254 +#: frontend/ui/device/screen.lua:250 msgid "" "This will take effect on next restart." msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:482 -#: frontend/apps/filemanager/filemanagersearch.lua:583 +#: frontend/apps/filemanager/filemanagersearch.lua:568 +#: frontend/apps/filemanager/filemanagersearch.lua:669 msgid "" "Title: " msgstr "" @@ -880,7 +883,7 @@ msgid "" "Toggle" msgstr "" -#: frontend/apps/reader/modules/readerhighlight.lua:313 +#: frontend/apps/reader/modules/readerhighlight.lua:320 msgid "" "Translate" msgstr "" @@ -906,7 +909,10 @@ msgid "" "View Mode" msgstr "" -#: frontend/ui/widget/dictquicklookup.lua:152 +#: frontend/apps/reader/modules/readerhighlight.lua:311 +#: frontend/apps/reader/modules/readerwikipedia.lua:28 +#: frontend/apps/reader/modules/readerwikipedia.lua:41 +#: frontend/ui/widget/dictquicklookup.lua:174 msgid "" "Wikipedia" msgstr "" @@ -926,17 +932,12 @@ msgid "" "Writing screen to " msgstr "" -#: frontend/apps/filemanager/filemanagersetdefaults.lua:77 -msgid "" -"Wrong settings might crash Koreader! Continue?" -msgstr "" - #: frontend/apps/filemanager/filemanagermenu.lua:40 msgid "" "You have unsaved default settings. Save them now?" msgstr "" -#: frontend/apps/filemanager/filemanagersearch.lua:152 +#: frontend/apps/filemanager/filemanagersearch.lua:155 msgid "" "You must specify at least one field to search at! (SEARCH_XXX = true in defaults.lua)" msgstr "" @@ -1022,6 +1023,11 @@ msgid "" "default" msgstr "" +#: frontend/apps/filemanager/filemanagersearch.lua:521 +msgid "" +"found" +msgstr "" + #: frontend/ui/data/strings.lua:62 msgid "" "full" @@ -1067,6 +1073,11 @@ msgid "" "manual" msgstr "" +#: frontend/apps/filemanager/filemanagersearch.lua:523 +msgid "" +"matching" +msgstr "" + #: frontend/ui/data/strings.lua:38 msgid "" "medium" From 557c29a7d9fc7138ed886af190f29c6d6d832b7a Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 15:46:43 +0800 Subject: [PATCH 06/10] prompt users to turn on Wifi in OTA update and Wikipedia lookup --- frontend/apps/reader/modules/readerwikipedia.lua | 8 +++++++- frontend/ui/otamanager.lua | 8 +++++++- frontend/ui/translator.lua | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/apps/reader/modules/readerwikipedia.lua b/frontend/apps/reader/modules/readerwikipedia.lua index 17821e181..34537ad33 100644 --- a/frontend/apps/reader/modules/readerwikipedia.lua +++ b/frontend/apps/reader/modules/readerwikipedia.lua @@ -1,5 +1,6 @@ local ReaderDictionary = require("apps/reader/modules/readerdictionary") local EventListener = require("ui/widget/eventlistener") +local NetworkMgr = require("ui/networkmgr") local Translator = require("ui/translator") local Wikipedia = require("ui/wikipedia") local UIManager = require("ui/uimanager") @@ -17,7 +18,12 @@ local ReaderWikipedia = ReaderDictionary:new{ } function ReaderWikipedia:onLookupWikipedia(word, box) - local lang = Translator:detect(word) or "en" + local ok, lang = pcall(Translator.detect, Translator, word) + -- prompt users to turn on Wifi if network is unreachable + if not ok and lang and lang:find("Network is unreachable") then + NetworkMgr:promptWifiOn() + return + end -- convert "zh-CN" and "zh-TW" to "zh" lang = lang:match("(.*)-") or lang local results = {} diff --git a/frontend/ui/otamanager.lua b/frontend/ui/otamanager.lua index 663b1130b..ac682f257 100644 --- a/frontend/ui/otamanager.lua +++ b/frontend/ui/otamanager.lua @@ -1,5 +1,6 @@ local InfoMessage = require("ui/widget/infomessage") local ConfirmBox = require("ui/widget/confirmbox") +local NetworkMgr = require("ui/networkmgr") local UIManager = require("ui/uimanager") local Device = require("ui/device") local DEBUG = require("dbg") @@ -63,8 +64,13 @@ function OTAManager:checkUpdate() local r, c, h = http.request{ url = ota_zsync_file, sink = ltn12.sink.file(io.open(local_zsync_file, "w"))} - -- parse OTA package version + -- prompt users to turn on Wifi if network is unreachable + if h == nil then + NetworkMgr:promptWifiOn() + return + end if c ~= 200 then return end + -- parse OTA package version local ota_package = nil local zsync = io.open(local_zsync_file, "r") if zsync then diff --git a/frontend/ui/translator.lua b/frontend/ui/translator.lua index 357d8c83b..13299d438 100644 --- a/frontend/ui/translator.lua +++ b/frontend/ui/translator.lua @@ -79,6 +79,8 @@ function Translator:detect(text) local src_lang = result.src DEBUG("detected language:", src_lang) return src_lang + else + return self.default_lang end end From 0d112c4fa5fd6a008c3b2c51e35c8fc1265bbd60 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 15:47:10 +0800 Subject: [PATCH 07/10] fix koboEnableWifi --- frontend/ui/networkmgr.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/frontend/ui/networkmgr.lua b/frontend/ui/networkmgr.lua index af720df67..7b6e3e742 100644 --- a/frontend/ui/networkmgr.lua +++ b/frontend/ui/networkmgr.lua @@ -19,20 +19,20 @@ local function kindleEnableWifi(toggle) end local function koboEnableWifi(toggle) - if toggle == 1 - local path = "/etc/wpa_supplicant/wpa_supplicant.conf" - os.execute("insmod /drivers/ntx508/wifi/sdio_wifi_pwr.ko 2>/dev/null") - os.execute("insmod /drivers/ntx508/wifi/dhd.ko") - os.execute("ifconfig eth0 up") - os.execute("wlarm_le -i eth0 up") - os.execute("wpa_supplicant -s -i eth0 -c "..path.." -C /var/run/wpa_supplicant -B") - os.execute("udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q >/dev/null 2>&1") + if toggle == 1 then + local path = "/etc/wpa_supplicant/wpa_supplicant.conf" + os.execute("insmod /drivers/ntx508/wifi/sdio_wifi_pwr.ko 2>/dev/null") + os.execute("insmod /drivers/ntx508/wifi/dhd.ko") + os.execute("ifconfig eth0 up") + os.execute("wlarm_le -i eth0 up") + os.execute("wpa_supplicant -s -i eth0 -c "..path.." -C /var/run/wpa_supplicant -B") + os.execute("udhcpc -S -i eth0 -s /etc/udhcpc.d/default.script -t15 -T10 -A3 -b -q >/dev/null 2>&1") else - os.execute("killall udhcpc wpa_supplicant 2>/dev/null") - os.execute("wlarm_le -i eth0 down") - os.execute("ifconfig eth0 down") - os.execute("rmmod -r dhd") - os.execute("rmmod -r sdio_wifi_pwr") + os.execute("killall udhcpc wpa_supplicant 2>/dev/null") + os.execute("wlarm_le -i eth0 down") + os.execute("ifconfig eth0 down") + os.execute("rmmod -r dhd") + os.execute("rmmod -r sdio_wifi_pwr") end end From 50d45a13d13bc32c9ecc56109a73816bb5e6eeed Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 16:58:04 +0800 Subject: [PATCH 08/10] fix missing declaration for symbol 'munmap' --- koreader-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koreader-base b/koreader-base index 48e46a9b0..1075c61f7 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit 48e46a9b01eb31888cb818b3f402045025f05069 +Subproject commit 1075c61f74888d0ab291c8a3d0ed55d9dde8457b From a275a8cc89918e680ecf2523460b1e54ed70f902 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 18:04:19 +0800 Subject: [PATCH 09/10] strip punctuations in word before wikipedia lookup --- frontend/apps/reader/modules/readerhighlight.lua | 1 - frontend/apps/reader/modules/readerwikipedia.lua | 6 ++++++ frontend/ui/widget/dictquicklookup.lua | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index c6d869e9f..890b42e5f 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -312,7 +312,6 @@ function ReaderHighlight:onHoldRelease() callback = function() UIManager:scheduleIn(0.1, function() self:lookupWikipedia() - self:onClose() end) end, }, diff --git a/frontend/apps/reader/modules/readerwikipedia.lua b/frontend/apps/reader/modules/readerwikipedia.lua index 34537ad33..984fc2028 100644 --- a/frontend/apps/reader/modules/readerwikipedia.lua +++ b/frontend/apps/reader/modules/readerwikipedia.lua @@ -18,6 +18,7 @@ local ReaderWikipedia = ReaderDictionary:new{ } function ReaderWikipedia:onLookupWikipedia(word, box) + -- detect language of the text local ok, lang = pcall(Translator.detect, Translator, word) -- prompt users to turn on Wifi if network is unreachable if not ok and lang and lang:find("Network is unreachable") then @@ -26,6 +27,11 @@ function ReaderWikipedia:onLookupWikipedia(word, box) end -- convert "zh-CN" and "zh-TW" to "zh" lang = lang:match("(.*)-") or lang + -- strip punctuation characters around selected word + word = string.gsub(word, "^%p+", '') + word = string.gsub(word, "%p+$", '') + -- seems lower case phrase has higher hit rate + word = string.lower(word) local results = {} local ok, pages = pcall(Wikipedia.wikintro, Wikipedia, word, lang) if ok and pages then diff --git a/frontend/ui/widget/dictquicklookup.lua b/frontend/ui/widget/dictquicklookup.lua index fd232affc..cb4b62ccb 100644 --- a/frontend/ui/widget/dictquicklookup.lua +++ b/frontend/ui/widget/dictquicklookup.lua @@ -175,7 +175,6 @@ function DictQuickLookup:update() callback = function() UIManager:scheduleIn(0.1, function() self:lookupWikipedia() - self:onClose() end) end, }, From f575797b013a0442330fbb0f1226a96fef8bdd92 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 20 Aug 2014 18:25:37 +0800 Subject: [PATCH 10/10] use original lookup word in wikipedia lookup --- frontend/apps/reader/modules/readerdictionary.lua | 8 +++++--- frontend/apps/reader/modules/readerwikipedia.lua | 4 ++-- frontend/ui/widget/dictquicklookup.lua | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index 6f5119283..c12b916b0 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -30,7 +30,7 @@ function ReaderDictionary:stardictLookup(word, box) local ok, results = pcall(JSON.decode, JSON, results_str) if ok and results then DEBUG("lookup result table:", word, results) - self:showDict(results, box) + self:showDict(word, results, box) else -- dummy results results = { @@ -41,18 +41,20 @@ function ReaderDictionary:stardictLookup(word, box) } } DEBUG("dummy result table:", word, results) - self:showDict(results, box) + self:showDict(word, results, box) end end end -function ReaderDictionary:showDict(results, box) +function ReaderDictionary:showDict(word, results, box) if results and results[1] then DEBUG("showing quick lookup window") UIManager:show(DictQuickLookup:new{ ui = self.ui, highlight = self.highlight, dialog = self.dialog, + -- original lookup word + word = word, results = results, dictionary = self.default_dictionary, width = Screen:getWidth() - Screen:scaleByDPI(80), diff --git a/frontend/apps/reader/modules/readerwikipedia.lua b/frontend/apps/reader/modules/readerwikipedia.lua index 984fc2028..f1418eff8 100644 --- a/frontend/apps/reader/modules/readerwikipedia.lua +++ b/frontend/apps/reader/modules/readerwikipedia.lua @@ -44,7 +44,7 @@ function ReaderWikipedia:onLookupWikipedia(word, box) table.insert(results, result) end DEBUG("lookup result:", word, results) - self:showDict(results, box) + self:showDict(word, results, box) else DEBUG("error:", pages) -- dummy results @@ -56,7 +56,7 @@ function ReaderWikipedia:onLookupWikipedia(word, box) } } DEBUG("dummy result table:", word, results) - self:showDict(results, box) + self:showDict(word, results, box) end end diff --git a/frontend/ui/widget/dictquicklookup.lua b/frontend/ui/widget/dictquicklookup.lua index cb4b62ccb..987379d21 100644 --- a/frontend/ui/widget/dictquicklookup.lua +++ b/frontend/ui/widget/dictquicklookup.lua @@ -404,7 +404,7 @@ function DictQuickLookup:closeInputDialog() end function DictQuickLookup:lookupWikipedia() - self.ui:handleEvent(Event:new("LookupWikipedia", self.lookupword, self.word_box)) + self.ui:handleEvent(Event:new("LookupWikipedia", self.word, self.word_box)) end return DictQuickLookup