Hyphenation: add custom hyphenation rules (#7746)

The hyphenation of a word can be changed from its default
by long pressing for 3 seconds and selecting 'Hyphenate'.
These overrides are stored in a per-language file, i.e:
koreader/settings/user-German.hyph.
This commit is contained in:
zwim
2021-05-31 20:34:26 +02:00
committed by GitHub
parent b30e366ccd
commit f25da5d0d5
39 changed files with 355 additions and 256 deletions

View File

@@ -169,6 +169,20 @@ function ReaderHighlight:init()
}
end)
-- User hyphenation dict
self:addToHighlightDialog("11_user_dict", function(_self)
return {
text= _("Hyphenate"),
show_in_highlight_dialog_func = function()
return _self.ui.userHyph and _self.ui.userhyph:isAvailable() and not _self.selected_text.text:find("[ ,;-%.\n]")
end,
callback = function()
_self.ui.userhyph:modifyUserEntry(_self.selected_text.text)
_self:onClose()
end,
}
end)
self.ui:registerPostInitCallback(function()
self.ui.menu:registerToMainMenu(self)
end)