Module:Localization
From Eco - English Wiki
local p = {}
local Utils = require('Module:Utils')
function p.t(msg, count)
if count == nil then
count=1
end
l = mw.loadData('Module:Localization/data')
local msgs = l.msgs[msg]
if msgs == nil then
mw.log('WARNING: Word not translated: ' .. msg)
return msg
end
if count==1 or Utils.tableLen(msgs) == 1 then
return msgs[1]
else
-- Pluralise
local lang = mw.getContentLanguage()
return lang:plural(count, msgs)
end
end
function p.translate(frame)
local args = Utils.normaliseArgs(frame)
return t(args.msg, args.count)
end
return p