Jump to content

Module:Jct/statename: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Replacing {{jct/statename}}
(No difference)

Revision as of 07:33, 13 October 2013

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