Module:Language info

From wizzypedia
Revision as of 18:50, 5 July 2022 by Mwazir (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Language info/doc

-- We only invoke this module once per page, therefore we do not need to use mw.loadData(), require() is faster.
local info = require("Module:Language info/data")

return {
	interwiki_links = function(frame)
		local key = frame.args['en']
		local lang = frame.args['lang']
		
		local str = ''
		-- local str = '<div style="display:none">languageinfo: en: '..key..' lang: '..lang..'</div>' -- debug code
		for k,v in pairs(info) do
			if k ~= lang then
				if v[key] then
					str = str .. '[[' .. k .. ':'.. v[key] .. ']]'
				end
			end
		end
		
		return str
	end,
}