Module:Main: Difference between revisions
Content deleted Content added
moved to Template:Tax |
new tax message function |
||
Line 59:
return expanded
end
-- TODO: Refactor this and others, could just build an array of titles and then pass to
-- another function to do fallback
function p.get_tax_message_new( frame )
local tax_message = frame.args.tax_message
local language = frame.args.language
local country = frame.args.country
local p1 = mw.title.new( 'Template:Tax/' .. tax_message .. '/' .. language ) -- custom message
local p2 = mw.title.new( 'Template:Tax/' .. country .. '/' .. language ) -- special countries e.g. FR/NL
local p3 = mw.title.new( 'Template:Tax/Default/' .. language )
local p4 = mw.title.new( 'Template:Tax/LinkOnly' )
if ( country == 'US' ) then
page = p4
elseif p1.exists then
page = p1
elseif p2.exists then
page = p2
elseif p3.exists then
page = p3
else
page = p4
end
local expanded = frame:expandTemplate{ title = page, args = frame.args }
return expanded
end
|