Documentation for this module may be created at Module:Plural/doc
local p = {}
function p.ru_pluralize(count, one, few, many)
local mod10 = count % 10
local mod100 = count % 100
if mod10 == 1 and mod100 ~= 11 then
return one -- singular
elseif mod10 >= 2 and mod10 <= 4 and (mod100 < 10 or mod100 >= 20) then
return few -- few
else
return many -- many
end
end
function p.Plural(frame)
local args = frame.args
local lang = args["lang"] or "ru"
local count = tonumber(args[1]) or 0
if lang == "ru" then
return p.ru_pluralize(count, args[2], args[3], args[4])
else
return "[Only these lang values are supported: ru]"
end
end
return p