Module:Localization

local ugsub = mw.ustring.gsub

-- return { -- replace all tokens in source string with replacement replace = function(frame) local str = frame.args['str'] for token, replace in pairs(frame:getParent.args) do			if mw.ustring.sub(token, 1, 1) == '$' then -- escape, to perform plain text replacement. see Module:String token = ugsub(token, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1") replace = ugsub(replace, "%%", "%%%%" ) str = ugsub(str, token, replace) -- Note: gsub returns 2 values, so result = gsub(str, gsub(token), gsub(replace)) won't work. end end return str end,

}