diff --git a/frontend/ui/widget/dictquicklookup.lua b/frontend/ui/widget/dictquicklookup.lua index 560b58b37..420ecf0b5 100644 --- a/frontend/ui/widget/dictquicklookup.lua +++ b/frontend/ui/widget/dictquicklookup.lua @@ -21,6 +21,7 @@ local ScrollTextWidget = require("ui/widget/scrolltextwidget") local Size = require("ui/size") local TextWidget = require("ui/widget/textwidget") local TimeVal = require("ui/timeval") +local Translator = require("ui/translator") local UIManager = require("ui/uimanager") local VerticalGroup = require("ui/widget/verticalgroup") local VerticalSpan = require("ui/widget/verticalspan") @@ -1211,6 +1212,27 @@ function DictQuickLookup:lookupInputWord(hint) input_hint = hint or "", input_type = "text", buttons = { + { + { + text = _("Translate"), + is_enter_default = false, + callback = function() + if self.input_dialog:getInputText() == "" then return end + self:closeInputDialog() + Translator:showTranslation(self.input_dialog:getInputText()) + end, + }, + { + text = _("Search Wikipedia"), + is_enter_default = self.is_wiki, + callback = function() + if self.input_dialog:getInputText() == "" then return end + self.is_wiki = true + self:closeInputDialog() + self:inputLookup() + end, + }, + }, { { text = _("Cancel"), @@ -1219,16 +1241,16 @@ function DictQuickLookup:lookupInputWord(hint) end, }, { - text = self.is_wiki and _("Search Wikipedia") or _("Search dictionary"), - is_enter_default = true, + text = _("Search dictionary"), + is_enter_default = not self.is_wiki, callback = function() if self.input_dialog:getInputText() == "" then return end + self.is_wiki = false self:closeInputDialog() - self:onClose() self:inputLookup() end, }, - } + }, }, } UIManager:show(self.input_dialog)