diff --git a/.ci/check.sh b/.ci/check.sh index ba1e4fb7d..894444ef7 100755 --- a/.ci/check.sh +++ b/.ci/check.sh @@ -28,9 +28,9 @@ if [ "${tab_detected}" ]; then exit 1 fi -newline_split=$(grep -Pzo "(_|gettext)\((\[\[\\n)" --include \*.lua --exclude={dateparser.lua,xml.lua} --recursive {reader,setupkoenv,datastorage}.lua frontend plugins spec || true) +newline_split=$(grep -Pzo "(_|gettext)\((\n|\s)+('|\"|\[\[)" --include \*.lua --exclude={dateparser.lua,xml.lua} --recursive {reader,setupkoenv,datastorage}.lua frontend plugins spec || true) if [ "${newline_split}" ]; then - echo -e "\\n${ANSI_RED}Warning: whitespace detected at the start of gettext() multiline string." + echo -e "\\n${ANSI_RED}Warning: whitespace detected between gettext() call and string." echo "${newline_split}" exit 1 fi diff --git a/.circleci/config.yml b/.circleci/config.yml index a7d19b3fc..08a877601 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: koreader/koappimage:0.1.5 + - image: koreader/koappimage:0.1.6 environment: EMULATE_READER: 1 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index 2d57e73c8..5e9b86295 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -229,8 +229,8 @@ function ReaderDictionary:addToMainMenu(menu_items) keep_menu_open = true, callback = function() UIManager:show(InfoMessage:new{ - text = T(_( -[[If you'd like to change the order in which dictionaries are queried (and their results displayed), you can: + text = T(_([[ +If you'd like to change the order in which dictionaries are queried (and their results displayed), you can: - move all dictionary directories out of %1. - move them back there, one by one, in the order you want them to be used.]]), self.data_dir) }) diff --git a/frontend/apps/reader/modules/readergesture.lua b/frontend/apps/reader/modules/readergesture.lua index e6c6f61d7..9a05eea11 100644 --- a/frontend/apps/reader/modules/readergesture.lua +++ b/frontend/apps/reader/modules/readergesture.lua @@ -148,8 +148,8 @@ local default_multiswipes = { "southeast northeast northwest", } local multiswipes = {} -local multiswipes_info_text = _( -[[Multiswipes allow you to perform complex gestures built up out of multiple swipe directions, never losing touch with the screen. +local multiswipes_info_text = _([[ +Multiswipes allow you to perform complex gestures built up out of multiple swipe directions, never losing touch with the screen. These advanced gestures consist of either straight swipes or diagonal swipes. To ensure accuracy, they can't be mixed.]]) @@ -433,8 +433,8 @@ function ReaderGesture:addToMainMenu(menu_items) local SpinWidget = require("ui/widget/spinwidget") local GestureDetector = require("device/gesturedetector") local items = SpinWidget:new{ - text = T(_( -[[Set double tap interval in milliseconds. + text = T(_([[ +Set double tap interval in milliseconds. The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). Default value: %1]]), GestureDetector.DOUBLE_TAP_INTERVAL/1000), width = Screen:getWidth() * 0.6, @@ -460,8 +460,8 @@ Default value: %1]]), GestureDetector.DOUBLE_TAP_INTERVAL/1000), local SpinWidget = require("ui/widget/spinwidget") local GestureDetector = require("device/gesturedetector") local items = SpinWidget:new{ - text = T(_( -[[Set two finger tap duration in milliseconds. + text = T(_([[ +Set two finger tap duration in milliseconds. The duration value can range from 100 (0.1 seconds) to 2000 (2 seconds). Default value: %1]]), GestureDetector.TWO_FINGER_TAP_DURATION/1000), width = Screen:getWidth() * 0.6, @@ -487,8 +487,8 @@ Default value: %1]]), GestureDetector.TWO_FINGER_TAP_DURATION/1000), local SpinWidget = require("ui/widget/spinwidget") local GestureDetector = require("device/gesturedetector") local items = SpinWidget:new{ - text = T(_( -[[Set hold interval in milliseconds. + text = T(_([[ +Set hold interval in milliseconds. The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). Default value: %1]]), GestureDetector.HOLD_INTERVAL/1000), width = Screen:getWidth() * 0.6, @@ -514,8 +514,8 @@ Default value: %1]]), GestureDetector.HOLD_INTERVAL/1000), local SpinWidget = require("ui/widget/spinwidget") local GestureDetector = require("device/gesturedetector") local items = SpinWidget:new{ - text = T(_( -[[Set pan delay interval in milliseconds. + text = T(_([[ +Set pan delay interval in milliseconds. The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). Default value: %1]]), GestureDetector.PAN_DELAYED_INTERVAL/1000), width = Screen:getWidth() * 0.6, @@ -541,8 +541,8 @@ Default value: %1]]), GestureDetector.PAN_DELAYED_INTERVAL/1000), local SpinWidget = require("ui/widget/spinwidget") local GestureDetector = require("device/gesturedetector") local items = SpinWidget:new{ - text = T(_( -[[Set swipe interval in milliseconds. + text = T(_([[ +Set swipe interval in milliseconds. The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). Default value: %1]]), GestureDetector.SWIPE_INTERVAL/1000), width = Screen:getWidth() * 0.6, diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 5af6c23e1..7ce4d71ad 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -572,8 +572,8 @@ function ReaderHighlight:onHoldPan(_, ges) UIManager:setDirty(self.dialog, "ui") end -local info_message_ocr_text = _( -[[No OCR results or no language data. +local info_message_ocr_text = _([[ +No OCR results or no language data. KOReader has a build-in OCR engine for recognizing words in scanned PDF and DjVu documents. In order to use OCR in scanned pages, you need to install tesseract trained data for your document language. diff --git a/frontend/apps/reader/modules/readerlink.lua b/frontend/apps/reader/modules/readerlink.lua index 1af22036a..5b76acb3d 100644 --- a/frontend/apps/reader/modules/readerlink.lua +++ b/frontend/apps/reader/modules/readerlink.lua @@ -131,8 +131,8 @@ function ReaderLink:addToMainMenu(menu_items) G_reader_settings:saveSetting("tap_ignore_external_links", not isTapIgnoreExternalLinksEnabled()) end, - help_text = _( -[[Ignore taps on external links. Useful with Wikipedia EPUBs to make page turning easier. + help_text = _([[ +Ignore taps on external links. Useful with Wikipedia EPUBs to make page turning easier. You can still follow them from the dictionary window or the selection menu after holding on them.]]), separator = true, }, @@ -162,8 +162,8 @@ You can still follow them from the dictionary window or the selection menu after G_reader_settings:saveSetting("swipe_ignore_external_links", not isSwipeIgnoreExternalLinksEnabled()) end, - help_text = _( -[[Ignore external links near swipe. Useful with Wikipedia EPUBs to follow only footnotes with swipe. + help_text = _([[ +Ignore external links near swipe. Useful with Wikipedia EPUBs to follow only footnotes with swipe. You can still follow external links from the dictionary window or the selection menu after holding on them.]]), separator = true, }, @@ -174,8 +174,8 @@ You can still follow external links from the dictionary window or the selection G_reader_settings:saveSetting("swipe_to_jump_to_latest_bookmark", not isSwipeToJumpToLatestBookmarkEnabled()) end, - help_text = _( -[[Swipe to the left to go the most recently bookmarked page. + help_text = _([[ +Swipe to the left to go the most recently bookmarked page. This can be useful to quickly swipe back and forth between what you are reading and some reference page (for example notes, a map or a characters list). If any of the other Swipe to follow link options is enabled, this will work only when the current page contains no link.]]), }, @@ -208,8 +208,8 @@ If any of the other Swipe to follow link options is enabled, this will work only G_reader_settings:saveSetting("footnote_link_in_popup", not isFootnoteLinkInPopupEnabled()) end, - help_text = _( -[[Show internal link target content in a footnote popup when it looks like it might be a footnote, instead of following the link. + help_text = _([[ +Show internal link target content in a footnote popup when it looks like it might be a footnote, instead of following the link. Note that depending on the book quality, footnote detection may not always work correctly. The footnote content may be empty, truncated, or include other footnotes. @@ -246,8 +246,8 @@ From the footnote popup, you can jump to the footnote location in the book by sw precision = "%+d", ok_text = _("Set font size"), title_text = _("Set footnote popup font size"), - text = _( -[[The footnote popup font adjusts to the font size you've set for the document. + text = _([[ +The footnote popup font adjusts to the font size you've set for the document. You can specify here how much smaller or larger it should be relative to the document font size. A negative value will make it smaller, while a positive one will make it larger. The recommended value is -2.]]), @@ -256,8 +256,8 @@ The recommended value is -2.]]), end, }) end, - help_text = _( -[[The footnote popup font adjusts to the font size you've set for the document. + help_text = _([[ +The footnote popup font adjusts to the font size you've set for the document. This allows you to specify how much smaller or larger it should be relative to the document font size.]]), separator = true, }) diff --git a/frontend/apps/reader/modules/readerrolling.lua b/frontend/apps/reader/modules/readerrolling.lua index a74087505..e69733fac 100644 --- a/frontend/apps/reader/modules/readerrolling.lua +++ b/frontend/apps/reader/modules/readerrolling.lua @@ -346,8 +346,8 @@ function ReaderRolling:addToMainMenu(menu_items) -- FIXME: repeated code with page overlap menu for readerpaging -- needs to keep only one copy of the logic as for the DRY principle. -- The difference between the two menus is only the enabled func. - local overlap_lines_help_text = _( -[[When page overlap is enabled, some lines from the previous page will be displayed on the next page. + local overlap_lines_help_text = _([[ +When page overlap is enabled, some lines from the previous page will be displayed on the next page. You can set how many lines are shown.]]) local page_overlap_menu = { { diff --git a/frontend/apps/reader/modules/readerstyletweak.lua b/frontend/apps/reader/modules/readerstyletweak.lua index e82f902aa..f69df86bf 100644 --- a/frontend/apps/reader/modules/readerstyletweak.lua +++ b/frontend/apps/reader/modules/readerstyletweak.lua @@ -340,8 +340,8 @@ function ReaderStyleTweak:init() end, hold_callback = function() UIManager:show(InfoMessage:new{ - text = _( -[[Style tweaks allow changing small parts of book styles (including the publisher/embedded styles) to make visual adjustments or disable unwanted publisher layout choices. + text = _([[ +Style tweaks allow changing small parts of book styles (including the publisher/embedded styles) to make visual adjustments or disable unwanted publisher layout choices. Some tweaks may be useful with some books, while resulting in undesirable effects with others. diff --git a/frontend/apps/reader/modules/readertypeset.lua b/frontend/apps/reader/modules/readertypeset.lua index 254352ea6..ea6cbb8c7 100644 --- a/frontend/apps/reader/modules/readertypeset.lua +++ b/frontend/apps/reader/modules/readertypeset.lua @@ -513,8 +513,8 @@ function ReaderTypeset:onSetPageMargins(margins, refresh_callback) if refresh_callback then -- Show a toast on set, with the unscaled & scaled values UIManager:show(InfoMessage:new{ - text = T(_( -[[ Margins set to: + text = T(_([[ + Margins set to: horizontal: %1 (%2px) top: %3 (%4px) diff --git a/frontend/apps/reader/modules/readerview.lua b/frontend/apps/reader/modules/readerview.lua index 53f44b829..920541b2f 100644 --- a/frontend/apps/reader/modules/readerview.lua +++ b/frontend/apps/reader/modules/readerview.lua @@ -739,8 +739,8 @@ end function ReaderView:onSetScrollMode(page_scroll) if self.ui.document.info.has_pages and page_scroll and self.ui.zooming.paged_modes[self.zoom_mode] then UIManager:show(InfoMessage:new{ - text = _( -[[Continuous view (scroll mode) works best with zoom to page width or zoom to content width. + text = _([[ +Continuous view (scroll mode) works best with zoom to page width or zoom to content width. In combination with zoom to fit page, page height, content height or content, continuous view can cause unexpected shifts when turning pages.]]), timeout = 5, diff --git a/frontend/apps/reader/modules/readerwikipedia.lua b/frontend/apps/reader/modules/readerwikipedia.lua index e92519fdc..bbddd6ed8 100644 --- a/frontend/apps/reader/modules/readerwikipedia.lua +++ b/frontend/apps/reader/modules/readerwikipedia.lua @@ -242,8 +242,8 @@ function ReaderWikipedia:addToMainMenu(menu_items) home_dir = home_dir:gsub("^(.-)/*$", "%1") -- remove trailing slash if home_dir and lfs.attributes(home_dir, "mode") == "directory" then local wikipedia_dir = home_dir.."/Wikipedia" - local text = _( -[[Wikipedia articles can be saved as an EPUB for more comfortable reading. + local text = _([[ +Wikipedia articles can be saved as an EPUB for more comfortable reading. You can select an existing directory, or use a default directory named "Wikipedia" in your reader's home directory. diff --git a/frontend/apps/reader/modules/readerzooming.lua b/frontend/apps/reader/modules/readerzooming.lua index 50dd6cab3..d8297defe 100644 --- a/frontend/apps/reader/modules/readerzooming.lua +++ b/frontend/apps/reader/modules/readerzooming.lua @@ -342,8 +342,8 @@ end function ReaderZooming:setZoomMode(mode) if self.ui.view.page_scroll and self.paged_modes[mode] then UIManager:show(InfoMessage:new{ - text = T(_( -[[%1 + text = T(_([[ +%1 In combination with continuous view (scroll mode), this can cause unexpected vertical shifts when turning pages.]]), self.paged_modes[mode]), timeout = 5, diff --git a/frontend/ui/data/creoptions.lua b/frontend/ui/data/creoptions.lua index c97db7926..a9cce0138 100644 --- a/frontend/ui/data/creoptions.lua +++ b/frontend/ui/data/creoptions.lua @@ -52,8 +52,7 @@ local CreOptions = { optionsutil.enableIfEquals(configurable, "view_mode", 0) -- "page" end, name_text_hold_callback = optionsutil.showValues, - help_text = _( -[[In landscape mode, you can choose to display one or two pages of the book on the screen. + help_text = _([[In landscape mode, you can choose to display one or two pages of the book on the screen. Note that this may not be ensured under some conditions: in scroll mode, when a very big font size is used, or on devices with a very low aspect ratio.]]), }, } @@ -205,8 +204,8 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m default_arg = 2, event = "SetBlockRenderingMode", name_text_hold_callback = optionsutil.showValues, - help_text = _( -[[- 'legacy' uses original CR3 block rendering code. + help_text = _([[ +- 'legacy' uses original CR3 block rendering code. - 'flat' ensures flat rendering with collapsing margins and accurate page breaks. - 'book' additionally allows floats, but limits style support to avoid blank spaces and overflows. - 'web' renders as web browsers do, allowing negative margins and possible page overflow.]]), diff --git a/frontend/ui/data/css_tweaks.lua b/frontend/ui/data/css_tweaks.lua index 87adc2e47..70ce3e92b 100644 --- a/frontend/ui/data/css_tweaks.lua +++ b/frontend/ui/data/css_tweaks.lua @@ -168,8 +168,8 @@ h1 + h6, h2 + h6, h3 + h6, h4 + h6, h5 + h6 { page-break-before: avoid !importan title = _("Widows and orphans"), { title = _("About widow and orphan lines"), - info_text = _( -[[Widows and orphans are lines at the beginning or end of a paragraph, which are left dangling at the top or bottom of a page, separated from the rest of the paragraph. + info_text = _([[ +Widows and orphans are lines at the beginning or end of a paragraph, which are left dangling at the top or bottom of a page, separated from the rest of the paragraph. The first line of a paragraph alone at the bottom of a page is called an orphan line. The last line of a paragraph alone at the top of a page is called a widow line. @@ -202,8 +202,8 @@ DocFragment { { id = "widows_avoid_orphans_allow"; title = _("Avoid widows but allow orphans"), - description = _( -[[Avoid widow lines, but allow orphan lines, allowing for some possible blank space at the bottom of pages. + description = _([[ +Avoid widow lines, but allow orphan lines, allowing for some possible blank space at the bottom of pages. Allowing orphans avoids ambiguous blank space at the bottom of a page, which could otherwise be confused with real spacing between paragraphs.]]), css = [[ body { orphans: 1; widows: 2; } @@ -274,8 +274,8 @@ h1, h2, h3, h4, h5, h6 { hyphens: none !important; } { id = "paragraph_web_browser_style"; title = _("Generic web browser paragraph style"), - description = _( -[[Display paragraphs as browsers do, in full-block style without indentation or justification, discarding KOReader's book paragraph style. + description = _([[ +Display paragraphs as browsers do, in full-block style without indentation or justification, discarding KOReader's book paragraph style. This might be needed with some documents that expect this style as the default, and only use CSS when it needs to diverge from this default.]]), priority = -1, css = [[ @@ -420,8 +420,8 @@ width: 100% !important; title = _("Alternative TOC hints"), { title = _("About alternative TOC"), - info_text = _( -[[An alternative table of contents can be built with a long-press on the "Table of contents" menu item. + info_text = _([[ +An alternative table of contents can be built with a long-press on the "Table of contents" menu item. The TOC will be built from document headings