Module:Number of works

De ProleWiki
local p = {}

function p.getWorkCount(frame)
    local category = frame.args.category or ''
    local pages = mw.site.stats.pagesInCategory(category)
    
    if tonumber(pages) == 1 then
        return "1 ouvrage"
    else
        return pages .. " ouvrages"
    end
end

function p.main(frame)
    return p.getWorkCount(frame)
end

return p