Jump to content

Module:Jct/statename

From Simple English Wikipedia, the free encyclopedia
Revision as of 07:33, 13 October 2013 by Happy5214 (talk | changes) (Replacing {{jct/statename}})
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Jct/statename/doc

local p = { }

function p.statename(frame)
	local pframe = frame:getParent()
	local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
	local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template
	
	local dualabbrs = {NT = "Northern Territory", WA = "Western Australia"}
	
	local data = mw.loadData("Module:Jct/statename/data")
	local abbr = args[1]
	local country = args[2]
	if country == 'AUS' then
		return dualabbrs[abbr] or data.statenames[abbr]
	else
		return data.statenames[abbr]
	end
end

return p