Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Chrisportelli/sandbox
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
f = {} -- Dan il-metodu jirritorna l-għadd ta' oġġetti bil-Malti magħdud man-nom (il-metodu ma japplikax għal oġġetti/nomi li jużaw il-plural miksur). Il-parametri huma: -- number: kwantità ta' oġġetti -- singular: il-verżjoni bis-singular tal-oġġett/nom -- plural: il-verżjoni bil-plural tal-oġġett/nom -- formatNumber: għażla jekk tridx tirranġa n-numru bil-virgoli jew mingħajrhom local function getNounCount(number, singular, plural, formatNumber) formattedNumber = formatNumber and mw.getContentLanguage():formatNum(number) or number flooredNearestHundred = math.floor(number / 100) * 100 difference = number - flooredNearestHundred if number == 0 then return formattedNumber .. ' ' .. plural end if difference >= 2 and difference <= 10 then return formattedNumber .. ' ' .. plural elseif difference <= 1 or difference >= 11 then if difference >= 11 and difference <= 19 then return formattedNumber .. '-il ' .. singular else return formattedNumber .. ' ' .. singular end end end function f.kwantitaNom(frame) local number = tonumber(frame.args.number) local singular = frame.args.singular local plural = frame.args.plural local formatNumber = frame.args.formatNumber return getNounCount(number, singular, plural, formatNumber) end function f.numruArtikli() return getNounCount(mw.site.stats.articles, 'artiklu', 'artikli', true) end return f
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Chrisportelli/sandbox/doc
(
edit
)