Jump to content

Module:ModuleMsg

From Outreach Wiki
local p = {}

function p.get_msgs(frame, pagename, lang)
	ret = {}
	page = mw.title.new(pagename)
	raw = page:getContent()
	for msgname in string.gmatch(raw, '<!%-%-T:(.-)%-%->') do
		msgvalue = mw.title.new('Translations:' .. pagename .. '/' .. msgname .. '/' .. lang):getContent()
		if msgvalue == nil then
			-- English fallback
			msgvalue = mw.title.new('Translations:' .. pagename .. '/' .. msgname .. '/en'):getContent()
		end
		ret[msgname] = msgvalue
	end
	return ret
end

return p