[fix] Tailor plurals match (#5603)

Fixes #5601.
pull/5607/head
Frans de Jonge 5 years ago committed by GitHub
parent 9d2da98247
commit 50878eab9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -197,9 +197,9 @@ function GetText_mt.__index.changeLang(new_lang)
-- header
if not headers and data.msgid == "" then
headers = data.msgstr
local plural_forms = data.msgstr:match("Plural%-Forms: (.*);")
local plural_forms = data.msgstr:match("Plural%-Forms: (.*)")
local nplurals = plural_forms:match("nplurals=([0-9]+);") or 2
local plurals = plural_forms:match("%((.*)%)")
local plurals = plural_forms:match("plural=%((.*)%);")
if not plurals then
-- Some languages (e.g., Arabic) may not use parentheses.
@ -207,7 +207,7 @@ function GetText_mt.__index.changeLang(new_lang)
-- 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=(.*)")
plurals = plural_forms:match("plural=(.*);")
end
if plurals:find("[^n!=%%<>&:%(%)|?0-9 ]") then

Loading…
Cancel
Save