From fa746aa0766b957acbb36800d4a410c768392d4a Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 27 Mar 2021 07:15:27 +0200 Subject: Document: Fixed autoreload intervals; added strings --- po/en.po | 18 ++++++++++++++++++ res/lang/en.bin | Bin 15782 -> 15922 bytes src/ui/documentwidget.c | 29 +++++++++++++++-------------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/po/en.po b/po/en.po index 64621034..c8c34cb9 100644 --- a/po/en.po +++ b/po/en.po @@ -546,6 +546,24 @@ msgstr "AUTO-RELOAD" msgid "dlg.autoreload" msgstr "Select the auto-reload interval for this tab." +msgid "reload.never" +msgstr "Never" + +msgid "reload.onceperday" +msgstr "Once per day" + +#, c-format +msgid "num.minutes" +msgid_plural "num.minutes.n" +msgstr[0] "%d minute" +msgstr[1] "%d minutes" + +#, c-format +msgid "num.hours" +msgid_plural "num.hours.n" +msgstr[0] "%d hour" +msgstr[1] "%d hours" + msgid "link.newtab" msgstr "Open Link in New Tab" diff --git a/res/lang/en.bin b/res/lang/en.bin index f408cef4..995ceff0 100644 Binary files a/res/lang/en.bin and b/res/lang/en.bin differ diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index f6b68034..67cefc9b 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -85,24 +85,25 @@ enum iReloadInterval { }; static int seconds_ReloadInterval_(enum iReloadInterval d) { - static const int times[] = { 0, 1, 5, 15, 60, 4 * 60, 12 * 60, 24 * 60 }; + static const int mins[] = { 0, 1, 5, 15, 60, 4 * 60, 12 * 60, 24 * 60 }; if (d < 0 || d >= max_ReloadInterval) return 0; - return times[d]; + return mins[d] * 60; } static const char *label_ReloadInterval_(enum iReloadInterval d) { - static const char *labels[] = { - "Never", - "1 minute", - "5 minutes", - "15 minutes", - "1 hour", - "4 hours", - "12 hours", - "Once per day" - }; - if (d < 0 || d >= max_ReloadInterval) return 0; - return labels[d]; + switch (d) { + case never_RelodPeriod: + return cstr_Lang("reload.never"); + case day_ReloadInterval: + return cstr_Lang("reload.onceperday"); + case minute_ReloadInterval: + case fiveMinutes_ReloadInterval: + case fifteenMinutes_ReloadInterval: + return formatCStr_Lang("num.minutes.n", seconds_ReloadInterval_(d) / 60); + default: + return formatCStr_Lang("num.hours.n", seconds_ReloadInterval_(d) / 3600); + } + return ""; } struct Impl_PersistentDocumentState { -- cgit v1.2.3