[RTL UI] Bidi-wrap filenames, paths, urls, metadata

bidi.lua:
- Revert "Alias everything to Bidi.nowrap() when in LTR UI,
  as using LTR isolates seems uneeded when already LTR" (part
  of a628714f) which was a wrong assumption: we need proper
  wrappers for all things paths. Enhance some of these wrappers.
- Fix GetText RTL wrapping which was losing empty lines and
  trailing \n.

- Wrap all paths, directories, filenames in the code with
  these wrappers.
- Wrap all book metadata (title, authors...) with BD.auto(),
  as it helps fixing some edge cases (like open/close quotation
  marks which are not considered as bracket types by FriBiDi).
  (Needed some minor logic changes in CoverBrowser.)

- Tweak hyphenation menu text
- Update forgotten SortWidget for UI mirroring
- KoptConfig: update "justification" index for RTL re-ordering,
  following the recent addition of the page_gap_height option.
This commit is contained in:
poire-z
2020-01-04 01:18:51 +01:00
parent a31abf79de
commit 0599c440cc
50 changed files with 378 additions and 182 deletions

View File

@@ -1,3 +1,4 @@
local BD = require("ui/bidi")
local ButtonDialog = require("ui/widget/buttondialog")
local ButtonDialogTitle = require("ui/widget/buttondialogtitle")
local Cache = require("cache")
@@ -303,7 +304,7 @@ function OPDSBrowser:fetchFeed(item_url, username, password, method)
return
elseif code == 301 then
UIManager:show(InfoMessage:new{
text = T(_("The catalog has been permanently moved. Please update catalog URL to '%1'."), headers['Location']),
text = T(_("The catalog has been permanently moved. Please update catalog URL to '%1'."), BD.url(headers['Location'])),
})
elseif code == 401 then
UIManager:show(InfoMessage:new{
@@ -355,7 +356,7 @@ function OPDSBrowser:getCatalog(item_url, username, password)
elseif not ok and catalog then
logger.info("cannot get catalog info from", item_url, catalog)
UIManager:show(InfoMessage:new{
text = T(_("Cannot get catalog info from %1"), (item_url or "")),
text = T(_("Cannot get catalog info from %1"), (BD.url(item_url) or "")),
})
return
end
@@ -545,7 +546,7 @@ function OPDSBrowser:downloadFile(item, format, remote_url)
end
else
UIManager:show(InfoMessage:new {
text = _("Could not save file to:\n") .. local_path,
text = _("Could not save file to:\n") .. BD.filepath(local_path),
timeout = 3,
})
end
@@ -559,7 +560,7 @@ function OPDSBrowser:downloadFile(item, format, remote_url)
if lfs.attributes(local_path, "mode") == "file" then
UIManager:show(ConfirmBox:new {
text = T(_("The file %1 already exists. Do you want to overwrite it?"), local_path),
text = T(_("The file %1 already exists. Do you want to overwrite it?"), BD.filepath(local_path)),
ok_text = _("Overwrite"),
ok_callback = function()
download()
@@ -572,7 +573,7 @@ end
function OPDSBrowser:createNewDownloadDialog(path, buttons)
self.download_dialog = ButtonDialogTitle:new{
title = T(_("Download directory:\n%1\n\nDownload file type:"), path),
title = T(_("Download directory:\n%1\n\nDownload file type:"), BD.dirpath(path)),
buttons = buttons
}
end