|
|
@ -24,11 +24,7 @@ end
|
|
|
|
function ReaderWikipedia:onLookupWikipedia(word, box)
|
|
|
|
function ReaderWikipedia:onLookupWikipedia(word, box)
|
|
|
|
-- detect language of the text
|
|
|
|
-- detect language of the text
|
|
|
|
local ok, lang = pcall(Translator.detect, Translator, word)
|
|
|
|
local ok, lang = pcall(Translator.detect, Translator, word)
|
|
|
|
-- prompt users to turn on Wifi if network is unreachable
|
|
|
|
if not ok then return end
|
|
|
|
if not ok and lang and lang:find("Network is unreachable") then
|
|
|
|
|
|
|
|
NetworkMgr:promptWifiOn()
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- convert "zh-CN" and "zh-TW" to "zh"
|
|
|
|
-- convert "zh-CN" and "zh-TW" to "zh"
|
|
|
|
lang = lang:match("(.*)-") or lang
|
|
|
|
lang = lang:match("(.*)-") or lang
|
|
|
|
-- strip punctuation characters around selected word
|
|
|
|
-- strip punctuation characters around selected word
|
|
|
|