[fix] GetText: Support Arabic plurals (#5517)

Fixes <https://github.com/koreader/koreader/issues/5516>.

Cf. <https://github.com/koreader/koreader/pull/5515>.
This commit is contained in:
Frans de Jonge
2019-10-21 18:29:40 +02:00
committed by GitHub
parent f05e62c1fb
commit b8b6abe4d4
2 changed files with 50 additions and 3 deletions

View File

@@ -202,8 +202,12 @@ function GetText_mt.__index.changeLang(new_lang)
local plurals = plural_forms:match("%((.*)%)")
if not plurals then
-- we might be dealing with a language without plurals
plurals = plural_forms:match("plural=(0)")
-- Some languages (e.g., Arabic) may not use parentheses.
-- However, the following more inclusive match is more likely
-- to accidentally include junk and seldom relevant.
-- We might also be dealing with a language without plurals.
-- That would look like `plural=0`.
plurals = plural_forms:match("plural=(.*)")
end
if plurals:find("[^n!=%%<>&:%(%)|?0-9 ]") then