mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ReaderFooter: Don't duplicate a 12h clock time format option (#6973)
* ReaderFooter: * Honor the global twelve_hour_clock setting, instead of duplicating a local one. (Re #6969) * os.date is a thin wrapper around strftime, so we might be able to get away with some not-quite-standard extensions... These are *definitely* supported on Linux, but are *NOT* the glibc extension (that'd be e.g., %-I), so, hopefully, they're somewhat portable... They are also supported on BSD/macOS. They are *not* supported by the MS UCRT. That means MinGW-w64, too. This *appears* to be supported on current Bionic (it might even support said glibc format altering extensions). * And of course, Windows is terrible, so, make this terribly ugly to not break it there... * Turns out BSD also supports the dash trim format extension, so, leave the trimming to the libc, and handle the special-casing in a way that doesn't create stupid locals. * Random unrelated cleanup ^^. (https://gitter.im/koreader/koreader?at=5fd24be492aa1c4ef5d11f31) * Update the testsuite (Because the default used to be 24h clock). Changed the default to 24h clock ;p. * Explain why we don't try to fix it in Lua
This commit is contained in:
@@ -177,7 +177,7 @@ local footerTextGeneratorMap = {
|
||||
time = function(footer)
|
||||
local symbol_type = footer.settings.item_prefix or "icons"
|
||||
local prefix = symbol_prefix[symbol_type].time
|
||||
local clock = util.secondsToHour(os.time(), footer.settings.time_format == "12")
|
||||
local clock = util.secondsToHour(os.time(), G_reader_settings:isTrue("twelve_hour_clock"))
|
||||
if not prefix then
|
||||
return clock
|
||||
else
|
||||
@@ -1287,43 +1287,6 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
text = _("Time format"),
|
||||
sub_item_table = {
|
||||
{
|
||||
text_func = function()
|
||||
local footer = {}
|
||||
footer.settings = {}
|
||||
footer.settings.time_format = "24"
|
||||
footer.settings.item_prefix = self.settings.item_prefix or "icons"
|
||||
return T(_("24-hour (%1)"),footerTextGeneratorMap.time(footer))
|
||||
end,
|
||||
checked_func = function()
|
||||
return self.settings.time_format == "24" or self.settings.time_format == nil
|
||||
end,
|
||||
callback = function()
|
||||
self.settings.time_format = "24"
|
||||
self:refreshFooter(true)
|
||||
end,
|
||||
},
|
||||
{
|
||||
text_func = function()
|
||||
local footer = {}
|
||||
footer.settings = {}
|
||||
footer.settings.time_format = "12"
|
||||
footer.settings.item_prefix = self.settings.item_prefix or "icons"
|
||||
return T(_("12-hour (%1)"),footerTextGeneratorMap.time(footer))
|
||||
end,
|
||||
checked_func = function()
|
||||
return self.settings.time_format == "12"
|
||||
end,
|
||||
callback = function()
|
||||
self.settings.time_format = "12"
|
||||
self:refreshFooter(true)
|
||||
end,
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
text = _("Duration format"),
|
||||
sub_item_table = {
|
||||
|
||||
Reference in New Issue
Block a user