[fix, CI] Push to Transifex from master, fix multiline strings for xgettext (#5238)

Related to https://github.com/koreader/koreader/pull/5237
pull/5239/head
Frans de Jonge 5 years ago committed by GitHub
parent fbd331dd07
commit e2ceace302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,16 @@ set +e
if [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then
echo "CIRCLE_NODE_INDEX: ${CIRCLE_NODE_INDEX}"
if [ "$CIRCLE_NODE_INDEX" = 1 ]; then
echo -e "\\n${ANSI_GREEN}Pushing translation to Transifex."
cat >~/.transifexrc <<EOF
[https://www.transifex.com]
hostname = https://www.transifex.com
password = ${TRANSIFEX_TOKEN}
username = api
EOF
make pot
echo -e "\\n${ANSI_GREEN}Checking out koreader/doc for update."
git clone git@github.com:koreader/doc.git koreader_doc

@ -28,9 +28,9 @@ if [ "${tab_detected}" ]; then
exit 1
fi
newline_split=$(grep -Pzo "(_|gettext)\((\n|\s)+('|\"|\[\[)" --include \*.lua --exclude={dateparser.lua,xml.lua} --recursive {reader,setupkoenv,datastorage}.lua frontend plugins spec || true)
newline_split=$(grep -Pzo "(_|gettext)\((\[\[\\n)" --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 between gettext() call and string."
echo -e "\\n${ANSI_RED}Warning: whitespace detected at the start of gettext() multiline string."
echo "${newline_split}"
exit 1
fi

@ -70,3 +70,10 @@ jobs:
# CircleCI doesn't make the test results available as artifacts (October 2017)
- store_artifacts:
path: koreader-emulator-x86_64-linux-gnu/koreader/junit-test-results.xml
workflows:
version: 2
build:
jobs:
- build:
context: koreader-vars

@ -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)
})

@ -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,

@ -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.

@ -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,
})

@ -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 = {
{

@ -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.

@ -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)

@ -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,

@ -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.

@ -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,

@ -52,7 +52,8 @@ 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.]]),
},
}
@ -204,8 +205,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.]]),

@ -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 <H1> to <H6>. Some of these can be ignored with the tweaks available here.
If the document contains no headings, or all are ignored, the alternative TOC will be built from document fragments and will point to the start of each individual HTML file in the EPUB.
@ -470,8 +470,8 @@ After applying these tweaks, the alternative TOC needs to be rebuilt by long-pre
{
id = "alt_toc_level_example";
title = _("Example of book specific TOC hints"),
description = _([[
If headings or document fragments do not result in a usable TOC, you can inspect the HTML and look for elements that contain chapter titles. Then you can set hints to their class names.
description = _(
[[If headings or document fragments do not result in a usable TOC, you can inspect the HTML and look for elements that contain chapter titles. Then you can set hints to their class names.
This is just an example, that will need to be adapted into a user style tweak.]]),
css = [[
.book_n { -cr-hint: toc-level1; }
@ -486,8 +486,8 @@ This is just an example, that will need to be adapted into a user style tweak.]]
{
id = "footnote-inpage_epub";
title = _("In-page EPUB footnotes"),
description = _([[
Show EPUB footnote text at the bottom of pages that contain links to them.
description = _(
[[Show EPUB footnote text at the bottom of pages that contain links to them.
This only works with footnotes that have specific attributes set by the publisher.]]),
css = [[
*[type~="note"],
@ -505,8 +505,8 @@ This only works with footnotes that have specific attributes set by the publishe
{
id = "footnote-inpage_epub_smaller";
title = _("In-page EPUB footnotes (smaller)"),
description = _([[
Show EPUB footnote text at the bottom of pages that contain links to them.
description = _(
[[Show EPUB footnote text at the bottom of pages that contain links to them.
This only works with footnotes that have specific attributes set by the publisher.]]),
css = [[
*[type~="note"],
@ -559,8 +559,8 @@ ol.references > li > .mw-cite-backlink { display: none; }
{
id = "footnote-inpage_classic_classnames";
title = _("In-page classic classname footnotes"),
description = _([[
Show footnotes with classic class names at the bottom of pages.
description = _(
[[Show footnotes with classic class names at the bottom of pages.
This tweak can be duplicated as a user style tweak when books contain footnotes wrapped with other class names.]]),
css = [[
.footnote, .note, .note1, .ntb, .ntb-txt, .ntb-txt-j
@ -573,8 +573,8 @@ This tweak can be duplicated as a user style tweak when books contain footnotes
{
id = "footnote-inpage_classic_classnames_smaller";
title = _("In-page classic classname footnotes (smaller)"),
description = _([[
Show footnotes with classic classname at the bottom of pages.
description = _(
[[Show footnotes with classic classname at the bottom of pages.
This tweak can be duplicated as a user style tweak when books contain footnotes wrapped with other class names.]]),
css = [[
.footnote, .note, .note1, .ntb, .ntb-txt, .ntb-txt-j
@ -589,8 +589,8 @@ This tweak can be duplicated as a user style tweak when books contain footnotes
{
id = "epub_switch_show_case";
title = _("Toggle alternative EPUB content"),
description = _([[
The EPUB3 format allows a
description = _(
[[The EPUB3 format allows a
<epub:switch> <epub:case> <epub:default>
construct to provide alternative content to engines that support optional features.
KOReader currently falls back to hiding all <epub:case> content and shows the <epub:default> content (usually an image).

@ -78,8 +78,8 @@ function optionsutil.showValuesHMargins(configurable, option)
local current = configurable[option.name]
if not default then
UIManager:show(InfoMessage:new{
text = T(_([[
Current margins:
text = T(_(
[[Current margins:
left: %1
right: %2
Default margins: not set]]),
@ -87,8 +87,8 @@ Default margins: not set]]),
})
else
UIManager:show(InfoMessage:new{
text = T(_([[
Current margins:
text = T(_(
[[Current margins:
left: %1
right: %2
Default margins:

@ -17,8 +17,8 @@ local language = G_reader_settings:readSetting("language") or "en"
local version = Version:getNormalizedCurrentVersion()
local rev = Version:getCurrentRevision()
local quickstart_guide = T(_([[
# KOReader Quickstart Guide
local quickstart_guide = T(_(
[[# KOReader Quickstart Guide
Welcome to KOReader.

@ -1012,8 +1012,8 @@ function ConfigDialog:onMakeDefault(name, name_text, values, labels, position)
return
-- known table value, make it pretty
elseif name == "h_page_margins" then
display_value = T(_([[
display_value = T(_(
[[
left: %1
right: %2
]]),

@ -144,8 +144,8 @@ function HyphenationLimitsWidget:update()
CloseButton:new{ window = self, padding_top = Size.margin.title, },
}
local hyph_into_text = _([[
Set minimum length before hyphenation occurs.
local hyph_into_text = _(
[[Set minimum length before hyphenation occurs.
These settings will apply to all books with any hyphenation dictionary.
'Use language defaults' resets them.]])
local hyph_info = FrameContainer:new{

@ -921,7 +921,7 @@ function util.unpackArchive(archive, extract_to)
return false, T(_("Couldn't extract archive:\n\n%1\n\nUnrecognized filename extension."), archive)
end
if not ok then
return false, T(_("Extracting archive failed:\n\n%1", archive))
return false, T(_("Extracting archive failed:\n\n%1"), archive)
end
return true
end

@ -677,8 +677,8 @@ function BookInfoManager:extractBooksInDirectory(path, cover_specs)
local Trapper = require("ui/trapper")
local Screen = require("device").screen
local go_on = Trapper:confirm(_([[
This will extract metadata and cover images for books in current directory.
local go_on = Trapper:confirm(_(
[[This will extract metadata and cover images for books in current directory.
Once extraction has started, you can abort at any moment by tapping on the screen.
Cover images will be saved with the adequate size for the current display mode.
@ -690,16 +690,16 @@ This extraction may take time and use some battery power: you may wish to keep y
return
end
local recursive = Trapper:confirm(_([[
Do you want to extract book information for books in sub-directories too?]]
local recursive = Trapper:confirm(_(
[[Do you want to extract book information for books in sub-directories too?]]
), _("Here only"), _("Here and under"))
local refresh_existing = Trapper:confirm(_([[
Do you want to refresh metadata and covers that have already been extracted?]]
local refresh_existing = Trapper:confirm(_(
[[Do you want to refresh metadata and covers that have already been extracted?]]
), _("Don't refresh"), _("Refresh"))
local prune = Trapper:confirm(_([[
If you have removed many books, or have renamed some directories, it is good to remove them from the cache database.
local prune = Trapper:confirm(_(
[[If you have removed many books, or have renamed some directories, it is good to remove them from the cache database.
Do you want to prune cache of removed books?]]
), _("Don't prune"), _("Prune"))

@ -83,8 +83,8 @@ function Goodreads:updateSettings()
local text_top
local hint_bottom
local text_bottom
local text_info = _([[
How to generate a key and a secret key:
local text_info = _(
[[How to generate a key and a secret key:
1. Go to https://www.goodreads.com/user/sign_up and create an account
2. Register for a development key on the following page: https://www.goodreads.com/user/sign_in?rd=true

@ -227,8 +227,8 @@ function ReaderStatistics:checkInitDatabase()
if self.convert_to_db then -- if conversion to sqlite was doing earlier
if not conn:exec("pragma table_info('book');") then
UIManager:show(ConfirmBox:new{
text = T(_([[
Cannot open database in %1.
text = T(_(
[[Cannot open database in %1.
The database may have been moved or deleted.
Do you want to create an empty database?
]]),
@ -258,8 +258,8 @@ Do you want to create an empty database?
end
if #ReadHistory.hist > 1 or (#ReadHistory.hist == 1 and filename_first_history ~= quickstart_filename) then
local info = InfoMessage:new{
text =_([[
New version of statistics plugin detected.
text =_(
[[New version of statistics plugin detected.
Statistics data needs to be converted into the new database format.
This may take a few minutes.
Please wait

@ -481,8 +481,8 @@ function TextEditor:editFile(file_path, readonly)
return false, T(_("Failed saving file: %1"), err)
end
end
local save_anyway = Trapper:confirm(T(_([[
Lua syntax check failed:
local save_anyway = Trapper:confirm(T(_(
[[Lua syntax check failed:
%1
@ -502,8 +502,8 @@ Do you really want to save to this file?
return false, false -- no need for more InfoMessage
end
else -- If content is empty, propose to delete the file
local delete_file = Trapper:confirm(T(_([[
Text content is empty.
local delete_file = Trapper:confirm(T(_(
[[Text content is empty.
Do you want to keep this file as empty, or do you prefer to delete it?
%1]]), file_path), _("Keep empty file"), _("Delete file"))

@ -664,8 +664,8 @@ function Wallabag:setFilterTag(touchmenu_instance)
end
function Wallabag:editServerSettings()
local text_info = T(_([[
Enter the details of your Wallabag server and account.
local text_info = T(_(
[[Enter the details of your Wallabag server and account.
Client ID and client secret are long strings so you might prefer to save the empty settings and edit the config file directly in your installation directory:
%1/wallabag.lua

Loading…
Cancel
Save