Modul:Plural
Aspect

local p = {}
plural = {}
plural["locuitor"] = "locuitori"
function get_first_plural(singular)
if plural[singular] ~= nil then
return plural[singular]
else
return string.format("%si", singular)
end
end
function p.get_plural(frame)
mw.log(frame.args[1])
mw.log(frame.args[2])
mw.log(frame.args[3])
mw.log(frame.args[4])
local form = ""
local count = tonumber(frame.args[1])
local singular = frame.args[2]
if frame.args[3] ~= nil then
local first_plural = frame.args[3]
end
if frame.args[4] ~= nil then
local first_plural = frame.args[4]
end
if count == 1 then
form = singular
elseif count == 0 or (count%100 > 0 and count%100 < 20) then
if first_plural == nil then
form = get_first_plural(singular)
else
form = first_plural
end
else
if second_plural == nil and first_plural == nil then
form = "de " .. get_first_plural(singular)
elseif first_plural ~= nil then
form = "de " .. first_plural
else
form = second_plural
end
end
return string.format("%d %s", count, form)
end
return p