mirror of
https://github.com/koreader/koreader
synced 2024-11-16 06:12:56 +00:00
translator: fix settings menu order (#12051)
This commit is contained in:
parent
041ca074fb
commit
527fd05d25
@ -231,11 +231,7 @@ function Translator:genSettingsMenu()
|
|||||||
return T("%1 (%2)", lang_name, lang_key)
|
return T("%1 (%2)", lang_name, lang_key)
|
||||||
end,
|
end,
|
||||||
checked_func = function()
|
checked_func = function()
|
||||||
if G_reader_settings:has(setting_name) then
|
return lang_key == (G_reader_settings:readSetting(setting_name) or default_checked_item)
|
||||||
return lang_key == G_reader_settings:readSetting(setting_name)
|
|
||||||
else
|
|
||||||
return lang_key == default_checked_item
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
callback = function()
|
callback = function()
|
||||||
G_reader_settings:saveSetting(setting_name, lang_key)
|
G_reader_settings:saveSetting(setting_name, lang_key)
|
||||||
@ -247,32 +243,6 @@ function Translator:genSettingsMenu()
|
|||||||
return {
|
return {
|
||||||
text = _("Translation settings"),
|
text = _("Translation settings"),
|
||||||
sub_item_table = {
|
sub_item_table = {
|
||||||
{
|
|
||||||
text = _("Auto-detect source language"),
|
|
||||||
help_text = _("This setting is best suited for foreign text found in books written in your native language."),
|
|
||||||
enabled_func = function()
|
|
||||||
return not (G_reader_settings:isTrue("translator_from_doc_lang") and self:getDocumentLanguage() ~= nil)
|
|
||||||
end,
|
|
||||||
checked_func = function()
|
|
||||||
return G_reader_settings:nilOrTrue("translator_from_auto_detect")
|
|
||||||
end,
|
|
||||||
callback = function()
|
|
||||||
G_reader_settings:flipNilOrTrue("translator_from_auto_detect")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text_func = function()
|
|
||||||
local lang = G_reader_settings:readSetting("translator_from_language")
|
|
||||||
return T(_("Translate from: %1"), self:getLanguageName(lang, ""))
|
|
||||||
end,
|
|
||||||
help_text = _("If a specific source language is manually selected, it will be used everywhere, in all your books."),
|
|
||||||
enabled_func = function()
|
|
||||||
return not G_reader_settings:nilOrTrue("translator_from_auto_detect")
|
|
||||||
and not (G_reader_settings:isTrue("translator_from_doc_lang") and self:getDocumentLanguage() ~= nil)
|
|
||||||
end,
|
|
||||||
sub_item_table = genLanguagesItems("translator_from_language"),
|
|
||||||
keep_menu_open = true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text_func = function()
|
text_func = function()
|
||||||
local __, name = self:getDocumentLanguage()
|
local __, name = self:getDocumentLanguage()
|
||||||
@ -292,6 +262,32 @@ This is useful:
|
|||||||
callback = function()
|
callback = function()
|
||||||
G_reader_settings:flipTrue("translator_from_doc_lang")
|
G_reader_settings:flipTrue("translator_from_doc_lang")
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text = _("Auto-detect source language"),
|
||||||
|
help_text = _("This setting is best suited for foreign text found in books written in your native language."),
|
||||||
|
enabled_func = function()
|
||||||
|
return not (G_reader_settings:isTrue("translator_from_doc_lang") and self:getDocumentLanguage() ~= nil)
|
||||||
|
end,
|
||||||
|
checked_func = function()
|
||||||
|
return G_reader_settings:nilOrTrue("translator_from_auto_detect")
|
||||||
|
and not (G_reader_settings:isTrue("translator_from_doc_lang") and self:getDocumentLanguage() ~= nil)
|
||||||
|
end,
|
||||||
|
callback = function()
|
||||||
|
G_reader_settings:flipNilOrTrue("translator_from_auto_detect")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text_func = function()
|
||||||
|
local lang = G_reader_settings:readSetting("translator_from_language")
|
||||||
|
return T(_("Translate from: %1"), self:getLanguageName(lang, ""))
|
||||||
|
end,
|
||||||
|
help_text = _("If a specific source language is manually selected, it will be used everywhere, in all your books."),
|
||||||
|
enabled_func = function()
|
||||||
|
return not G_reader_settings:nilOrTrue("translator_from_auto_detect")
|
||||||
|
and not (G_reader_settings:isTrue("translator_from_doc_lang") and self:getDocumentLanguage() ~= nil)
|
||||||
|
end,
|
||||||
|
sub_item_table = genLanguagesItems("translator_from_language"),
|
||||||
separator = true,
|
separator = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -300,7 +296,6 @@ This is useful:
|
|||||||
return T(_("Translate to: %1"), self:getLanguageName(lang, ""))
|
return T(_("Translate to: %1"), self:getLanguageName(lang, ""))
|
||||||
end,
|
end,
|
||||||
sub_item_table = genLanguagesItems("translator_to_language", self:getTargetLanguage()),
|
sub_item_table = genLanguagesItems("translator_to_language", self:getTargetLanguage()),
|
||||||
keep_menu_open = true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user