mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Replace remaining 'local gettext' with '_' (#4160)
This commit is contained in:
@@ -116,4 +116,10 @@ files["spec/unit/*"].globals = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- TODO: clean up and enforce max line width (631)
|
-- TODO: clean up and enforce max line width (631)
|
||||||
ignore = {"631"}
|
-- https://luacheck.readthedocs.io/en/stable/warnings.html
|
||||||
|
-- 211 - Unused local variable
|
||||||
|
-- 631 - Line is too long
|
||||||
|
ignore = {
|
||||||
|
"211/__*",
|
||||||
|
"631",
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ local UIManager = require("ui/uimanager")
|
|||||||
local lfs = require("libs/libkoreader-lfs")
|
local lfs = require("libs/libkoreader-lfs")
|
||||||
local logger = require("logger")
|
local logger = require("logger")
|
||||||
local util = require("util")
|
local util = require("util")
|
||||||
local gettext = require("gettext")
|
local _ = require("gettext")
|
||||||
local T = require("ffi/util").template
|
local T = require("ffi/util").template
|
||||||
|
|
||||||
local FileConverter = {
|
local FileConverter = {
|
||||||
formats_from = {
|
formats_from = {
|
||||||
md = {
|
md = {
|
||||||
name = gettext("Markdown"),
|
name = _("Markdown"),
|
||||||
from = "markdown",
|
from = "markdown",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -70,23 +70,23 @@ function FileConverter:isSupported(file)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function FileConverter:showConvertButtons(file, ui)
|
function FileConverter:showConvertButtons(file, ui)
|
||||||
local _, filename_pure = util.splitFilePathName(file)
|
local __, filename_pure = util.splitFilePathName(file)
|
||||||
local filename_suffix = util.getFileNameSuffix(file)
|
local filename_suffix = util.getFileNameSuffix(file)
|
||||||
local filetype_name = self.formats_from[filename_suffix].name
|
local filetype_name = self.formats_from[filename_suffix].name
|
||||||
self.convert_dialog = ButtonDialogTitle:new{
|
self.convert_dialog = ButtonDialogTitle:new{
|
||||||
title = T(gettext("Convert %1 to:"), filetype_name),
|
title = T(_("Convert %1 to:"), filetype_name),
|
||||||
buttons = {
|
buttons = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
text = gettext("HTML"),
|
text = _("HTML"),
|
||||||
callback = function()
|
callback = function()
|
||||||
local html = FileConverter:_mdFileToHtml(file, filename_pure)
|
local html = FileConverter:_mdFileToHtml(file, filename_pure)
|
||||||
if not html then return end
|
if not html then return end
|
||||||
local filename_html = file..".html"
|
local filename_html = file..".html"
|
||||||
if lfs.attributes(filename_html, "mode") == "file" then
|
if lfs.attributes(filename_html, "mode") == "file" then
|
||||||
UIManager:show(ConfirmBox:new{
|
UIManager:show(ConfirmBox:new{
|
||||||
text = gettext("Overwrite existing HTML file?"),
|
text = _("Overwrite existing HTML file?"),
|
||||||
ok_text = gettext("Overwrite"),
|
ok_text = _("Overwrite"),
|
||||||
ok_callback = function()
|
ok_callback = function()
|
||||||
FileConverter:writeStringToFile(html, filename_html)
|
FileConverter:writeStringToFile(html, filename_html)
|
||||||
UIManager:close(self.convert_dialog)
|
UIManager:close(self.convert_dialog)
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ This is a registry for document providers
|
|||||||
local ConfirmBox = require("ui/widget/confirmbox")
|
local ConfirmBox = require("ui/widget/confirmbox")
|
||||||
local OpenWithDialog = require("ui/widget/openwithdialog")
|
local OpenWithDialog = require("ui/widget/openwithdialog")
|
||||||
local UIManager = require("ui/uimanager")
|
local UIManager = require("ui/uimanager")
|
||||||
local gettext = require("gettext")
|
|
||||||
local logger = require("logger")
|
local logger = require("logger")
|
||||||
local lfs = require("libs/libkoreader-lfs")
|
local lfs = require("libs/libkoreader-lfs")
|
||||||
local util = require("util")
|
local util = require("util")
|
||||||
|
local _ = require("gettext")
|
||||||
local T = require("ffi/util").template
|
local T = require("ffi/util").template
|
||||||
|
|
||||||
local DocumentRegistry = {
|
local DocumentRegistry = {
|
||||||
@@ -148,14 +148,14 @@ function DocumentRegistry:setProvider(file, provider, all)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function DocumentRegistry:showSetProviderButtons(file, filemanager_instance, ui, reader_ui)
|
function DocumentRegistry:showSetProviderButtons(file, filemanager_instance, ui, reader_ui)
|
||||||
local _, filename_pure = util.splitFilePathName(file)
|
local __, filename_pure = util.splitFilePathName(file)
|
||||||
local filename_suffix = util.getFileNameSuffix(file)
|
local filename_suffix = util.getFileNameSuffix(file)
|
||||||
|
|
||||||
local buttons = {}
|
local buttons = {}
|
||||||
local radio_buttons = {}
|
local radio_buttons = {}
|
||||||
local providers = self:getProviders(file)
|
local providers = self:getProviders(file)
|
||||||
|
|
||||||
for _, provider in ipairs(providers) do
|
for ___, provider in ipairs(providers) do
|
||||||
-- we have no need for extension, mimetype, weights, etc. here
|
-- we have no need for extension, mimetype, weights, etc. here
|
||||||
provider = provider.provider
|
provider = provider.provider
|
||||||
table.insert(radio_buttons, {
|
table.insert(radio_buttons, {
|
||||||
@@ -169,13 +169,13 @@ function DocumentRegistry:showSetProviderButtons(file, filemanager_instance, ui
|
|||||||
|
|
||||||
table.insert(buttons, {
|
table.insert(buttons, {
|
||||||
{
|
{
|
||||||
text = gettext("Cancel"),
|
text = _("Cancel"),
|
||||||
callback = function()
|
callback = function()
|
||||||
UIManager:close(self.set_provider_dialog)
|
UIManager:close(self.set_provider_dialog)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text = gettext("Open"),
|
text = _("Open"),
|
||||||
is_enter_default = true,
|
is_enter_default = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
local provider = self.set_provider_dialog.radio_button_table.checked_button.provider
|
local provider = self.set_provider_dialog.radio_button_table.checked_button.provider
|
||||||
@@ -183,9 +183,9 @@ function DocumentRegistry:showSetProviderButtons(file, filemanager_instance, ui
|
|||||||
-- always for this file
|
-- always for this file
|
||||||
if self.set_provider_dialog._check_file_button.checked then
|
if self.set_provider_dialog._check_file_button.checked then
|
||||||
UIManager:show(ConfirmBox:new{
|
UIManager:show(ConfirmBox:new{
|
||||||
text = T(gettext("Always open '%2' with %1?"),
|
text = T(_("Always open '%2' with %1?"),
|
||||||
provider.provider_name, filename_pure),
|
provider.provider_name, filename_pure),
|
||||||
ok_text = gettext("Always"),
|
ok_text = _("Always"),
|
||||||
ok_callback = function()
|
ok_callback = function()
|
||||||
self:setProvider(file, provider, false)
|
self:setProvider(file, provider, false)
|
||||||
|
|
||||||
@@ -197,9 +197,9 @@ function DocumentRegistry:showSetProviderButtons(file, filemanager_instance, ui
|
|||||||
-- always for all files of this file type
|
-- always for all files of this file type
|
||||||
elseif self.set_provider_dialog._check_global_button.checked then
|
elseif self.set_provider_dialog._check_global_button.checked then
|
||||||
UIManager:show(ConfirmBox:new{
|
UIManager:show(ConfirmBox:new{
|
||||||
text = T(gettext("Always open %2 files with %1?"),
|
text = T(_("Always open %2 files with %1?"),
|
||||||
provider.provider_name, filename_suffix),
|
provider.provider_name, filename_suffix),
|
||||||
ok_text = gettext("Always"),
|
ok_text = _("Always"),
|
||||||
ok_callback = function()
|
ok_callback = function()
|
||||||
self:setProvider(file, provider, true)
|
self:setProvider(file, provider, true)
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ function DocumentRegistry:showSetProviderButtons(file, filemanager_instance, ui
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.set_provider_dialog = OpenWithDialog:new{
|
self.set_provider_dialog = OpenWithDialog:new{
|
||||||
title = T(gettext("Open %1 with:"), filename_pure),
|
title = T(_("Open %1 with:"), filename_pure),
|
||||||
radio_buttons = radio_buttons,
|
radio_buttons = radio_buttons,
|
||||||
buttons = buttons,
|
buttons = buttons,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user