Module:Sandbox/Awesome Aasim/Fandomi18ntoWMi18n

This is an old revision of this page, as edited by Awesome Aasim (talk | contribs) at 20:42, 5 March 2025 (Created page with 'local p = {} p.toWMi18n = function(frame) local data = mw.loadData(frame.args[1]) local out = "" for k,v in data do l = mw.ustring.gsub(k, '"', '\"') w = mw.ustring.gsub(v, '"', '\"') out = out .. "[\"" .. l .. "\", " .. w .. "],\n" end return frame:callParserFunction("#tag", "syntaxhighlight", out, {lang="json"}) end return p'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

p.toWMi18n = function(frame)
	local data = mw.loadData(frame.args[1])
	local out = ""
	for k,v in data do
		l = mw.ustring.gsub(k, '"', '\"')
		w = mw.ustring.gsub(v, '"', '\"')
		out = out .. "[\"" .. l .. "\", " .. w .. "],\n"
	end
	
	return frame:callParserFunction("#tag", "syntaxhighlight", out, {lang="json"})
end

return p