mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[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:
@@ -1,3 +1,4 @@
|
||||
local BD = require("ui/bidi")
|
||||
local Device = require("device")
|
||||
local Event = require("ui/event")
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
@@ -25,13 +26,16 @@ function ReaderHyphenation:init()
|
||||
|
||||
table.insert(self.hyph_table, {
|
||||
text_func = function()
|
||||
local limits_text = _("language defaults")
|
||||
if G_reader_settings:readSetting("hyph_left_hyphen_min")
|
||||
or G_reader_settings:readSetting("hyph_right_hyphen_min") then
|
||||
limits_text = T("%1 - %2", G_reader_settings:readSetting("hyph_left_hyphen_min"),
|
||||
-- Note: with our callback, we either get hyph_left_hyphen_min and
|
||||
-- hyph_right_hyphen_min both nil, or both defined.
|
||||
if G_reader_settings:readSetting("hyph_left_hyphen_min") or
|
||||
G_reader_settings:readSetting("hyph_right_hyphen_min") then
|
||||
-- @translators to RTL language translators: %1/left is the min length of the start of a hyphenated word, %2/right is the min length of the end of a hyphenated word (note that there is yet no support for hyphenation with RTL languages, so this will mostly apply to LTR documents)
|
||||
return T(_("Left/right minimal sizes: %1 - %2"),
|
||||
G_reader_settings:readSetting("hyph_left_hyphen_min"),
|
||||
G_reader_settings:readSetting("hyph_right_hyphen_min"))
|
||||
end
|
||||
return T(_("Left/right minimal sizes: %1"), limits_text)
|
||||
return _("Left/right minimal sizes: language defaults")
|
||||
end,
|
||||
callback = function()
|
||||
local DoubleSpinWidget = require("/ui/widget/doublespinwidget")
|
||||
@@ -120,7 +124,7 @@ These settings will apply to all books with any hyphenation dictionary.
|
||||
self.hyph_alg = v.filename
|
||||
self.ui.doc_settings:saveSetting("hyph_alg", self.hyph_alg)
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("Changed hyphenation to %1."), v.name),
|
||||
text = T(_("Changed hyphenation to %1."), BD.wrap(v.name)),
|
||||
})
|
||||
self.ui.document:setHyphDictionary(v.filename)
|
||||
-- Apply hyphenation sides limits
|
||||
@@ -137,7 +141,7 @@ These settings will apply to all books with any hyphenation dictionary.
|
||||
-- one is set, no fallback will ever be used - if a fallback one
|
||||
-- is set, no default is wanted; so when we set one below, we
|
||||
-- remove the other).
|
||||
text = T( _("Would you like %1 to be used as the default (★) or fallback (<28>) hyphenation language?\n\nDefault will always take precedence while fallback will only be used if the language of the book can't be automatically determined."), v.name),
|
||||
text = T( _("Would you like %1 to be used as the default (★) or fallback (<28>) hyphenation language?\n\nDefault will always take precedence while fallback will only be used if the language of the book can't be automatically determined."), BD.wrap(v.name)),
|
||||
choice1_text = _("Default"),
|
||||
choice1_callback = function()
|
||||
G_reader_settings:saveSetting("hyph_alg_default", v.filename)
|
||||
|
||||
Reference in New Issue
Block a user