Module:Confirm-PD-on-URAA-date

Documentation for this module may be created at Module:Confirm-PD-on-URAA-date/doc

Code

--[=[
See https://en.wikipedia.org/wiki/Wikipedia:Non-U.S._copyrights#Dates_of_restoration_and_terms_of_protection

TODO: implement date comparison

work types used so far: music, photo
]=]

local p = {} --p stands for package

local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local langSwitch = require('Module:LangSwitch')._langSwitch

--[=[
pma term of protection on URAA date
]=]
function pma_URAA(args)
	local country = args.country
	local deathyear = args.deathyear
	local wartime = yesno(args.wartime)
	local work_type = args.work_type
	
	local pma_by_country = {
		["Afghanistan"] = 50,
		["Albania"] = 70,
		["Andorra"] = 70,
		["Angola"] = 50,
		["Antigua and Barbuda"] = 50,
		["Argentina"] = 50, -- now 50 for movies and 70 for everything else
		["Armenia"] = 50, -- now 70
		["Austria"] = 70,
		["Azerbaijan"] = 50,
		["Bahamas"] = 50,
		["Bahrain"] = 50, -- now 70
		["Bangladesh"] = 50, -- now 60
		["Barbados"] = 50,
		["Belarus"] = 50,
		["Belgium"] = 70,
		["Belize"] = 50,
		["Benin"] = 50,
		["Bhutan"] = 50,
		["Bolivia"] = 50,
		["Bosnia and Herzegovina"] = 70,
		["Botswana"] = 50,
		["Brazil"] = 60, -- now 70
		["Brunei"] = 50,
		["Bulgaria"] = 50, -- now 70
		["Burkina Faso"] = 70,
		["Burundi"] = 50,
		["Cambodia"] = 50,
		["Cameroon"] = 50,
		["Canada"] = 50, -- now 50
		["Cape Verde"] = 50,
		["Central African Republic"] = 50,
		["Chad"] = 50,
		["Chile"] = 50, -- now 70
		["People's Republic of China"] = 50, ["China"] = 50,
		["Comoros"] = 50,
		["Democratic Republic of the Congo"] = 50,
		["Republic of the Congo"] = 50,
		["Costa Rica"] = 70,
		["Côte d'Ivoire"] = 99, ["Ivory Coast"] = 99,
		["Croatia"] = 70,
		["Cuba"] = 50,
		["Cyprus"] = 50,
		["Denmark"] = 70,
		["Djibouti"] = 25, -- now 50
		["Dominica"] = 70,
		["Dominican Republic"] = 50,
		["Ecuador"] = 70,
		["Egypt"] = 50,
		["El Salvador"] = 50,
		["Equatorial Guinea"] = 50,
		["Estonia"] = 50, -- now 70
		["Eswatini"] = 50,
		["Fiji"] = 50,
		["Finland"] = 70,
		["Gabon"] = 50,
		["Gambia"] = 50,
		["Georgia"] = 70,
		["Germany"] = 70,
		["Ghana"] = 70,
		["Grenada"] = 50,
		["Guatemala"] = 75,
		["Guinea-Bissau"] = 50,
		["Guyana"] = 50,
		["Haiti"] = 50,
		["Honduras"] = 75,
		["Hong Kong"] = 50,
		["Iceland"] = 50, -- now 70
		["Indonesia"] = 50, -- now 70
		["Ireland"] = 70,
		["Israel"] = 50, -- now 70
		["Jamaica"] = 50,
		["Japan"] = 50,
		["Jordan"] = 50,
		["Kazakhstan"] = 50,
		["Kenya"] = 50,
		["Kiribati"] = 50,
		["Korea, North"] = 50,
		["Kyrgyzstan"] = 50,
		["Latvia"] = 50, -- now 70
		["Lebanon"] = 50,
		["Lesotho"] = 50,
		["Liechtenstein"] = 50, -- now 70
		["Lithuania"] = 50, -- now 70
		["Luxembourg"] = 50, -- now 70
		["Macau"] = 50,
		["Madagascar"] = 70,
		["Malawi"] = 50,
		["Malaysia"] = 50,
		["Mali"] = 50,
		["Malta"] = 70,
		["Mauritania"] = 50,
		["Mauritius"] = 50,
		["Micronesia"] = 50,
		["Moldova"] = 50, -- now 70
		["Mongolia"] = 50,
		["Montenegro"] = 70,
		["Morocco"] = 50,
		["Mozambique"] = 50, -- now 70
		["Namibia"] = 50,
		["Nepal"] = 50,
		["Netherlands"] = 70,
		["Aruba"] = 50,
		["Curaçao"] = 50,
		["Caribbean Netherlands"] = 50,
		["Sint Maarten"] = 50,
		["New Zealand"] = 50,
		["Nicaragua"] = 70,
		["Niger"] = 50,
		["Nigeria"] = 70,
		["North Macedonia"] = 70, ["Macedonia"] = 70,
		["Norway"] = 70,
		["Oman"] = 50, -- now 70
		["Pakistan"] = 50,
		["Panama"] = 50,
		["Papua New Guinea"] = 50,
		["Paraguay"] = 70,
		["Philippines"] = 50,
		["Poland"] = 50, -- now 70
		["Portugal"] = 50, -- now 70
		["Qatar"] = 50,
		["Rwanda"] = 50,
		["St. Kitts and Nevis"] = 50,
		["St. Lucia"] = 50,
		["St. Vincent and the Grenadines"] = 75,
		["Samoa"] = 75,
		["São Tomé and Príncipe"] = 50,
		["Saudi Arabia"] = 50,
		["Senegal"] = 50,
		["Serbia"] = 70,
		["Singapore"] = 70,
		["Slovakia"] = 70,
		["Slovenia"] = 70,
		["Solomon Islands"] = 50,
		["South Africa"] = 50,
		["Sudan"] = 50,
		["Suriname"] = 50,
		["Sweden"] = 70,
		["Syria"] = 50,
		["Tajikistan"] = 50,
		["Tanzania"] = 50,
		["Thailand"] = 50,
		["Timor Leste"] = 50,
		["Togo"] = 50,
		["Tonga"] = 50,
		["Trinidad and Tobago"] = 50,
		["Tunisia"] = 50,
		["Turkey"] = 70,
		["Turkmenistan"] = 50,
		["Tuvalu"] = 50,
		["Ukraine"] = 50, -- now 70
		["United Arab Emirates"] = 25, -- now 50
		["United Kingdom"] = 70,
		["United States"] = 70, ["United States of America"] = 70, ["USA"] = 70,
		["Uruguay"] = 50,
		["Uzbekistan"] = 50,
		["Vanuatu"] = 50,
		["Vatican City"] = 70,
		["Venezuela"] = 60,
		["Vietnam"] = 50,
		["Yemen"] = 30,
		["Zambia"] = 50,
		["Zimbabwe"] = 50
	}
	
	-- complicated cases first
	if country == 'Algeria' then
		if deathyear < 1972 then
			return 25
		else
			return 50
		end
	elseif country == 'Australia' then
		if deathyear < 1955 then
			return 50
		else
			return 70
		end
	elseif country == 'Czech Republic' then
		-- always 70 now
		if work_type == 'photo' then
			return 10
		else
			return 50
		end
	elseif country == 'France' then
		-- always 70 now
		if wartime ~= false then
			return nil -- wartime extensions
		elseif work_type == 'music' then
			return 70
		else
			return 50
		end
	elseif country == 'Greece' then
		-- always 70 now
		if deathyear < 1943 then
			return 50
		else
			return 70
		end
	elseif country == 'Hungary' then
		-- always 70 now
		if deathyear < 1944 then
			return 50
		else
			return 70
		end
	elseif country == 'India' then
		-- always 60 now
		if deathyear < 1941 then
			return 50
		else
			return 60
		end
	elseif country == 'Italy' then
		-- always 70 now
		if wartime ~= false then
			return nil -- wartime extensions
		else
			return 50
		end
	elseif country == 'South Korea' then
		if deathyear < 1957 then
			return 30
		else
			return 50
		end
	elseif country == 'Mexico' then
		if deathyear < 1952 then
			return 30
		else
			return 100
		end
	elseif country == 'Peru' then
		-- always 70 now
		if deathyear < 1946 then
			return 50
		else
			return 70
		end
	elseif country == 'Romania' then
		if deathyear < 1946 then
			return 50
		else
			return 70
		end
	elseif country == 'Russia' then
		if wartime then
			return 54 -- 74 now
		elseif wartime == false then
			return 50 -- 70 now
		else
			return nil
		end
	elseif country == 'Seychelles' then
		if deathyear < 1989 then
			return 25
		else
			return 50
		end
	elseif country == 'Spain' then
		if deathyear < 1987 or deathdate < '1987-12-07' then -- fix this
			return 80
		elseif deathyear > 1987 or deathdate >= '1987-12-07' then -- fix this
			return 70
		else
			return nil
		end
	elseif country == 'Sri Lanka' then
		if deathyear < 1953 then
			return 50
		else
			return 70
		end
	elseif country == 'Switzerland' then
		if deathyear < 1943 then
			return 50
		else
			return 70
		end
	else
		return pma_by_country[country]
	end
end

--[=[
Current pma term of protection
]=]
function pma_now(args)
	local country = args.country
	local deathyear = args.deathyear
	local deathdate = args.deathdate or approx_deathdate(deathyear)
	local wartime = yesno(args.wartime)
	local work_type = args.work_type
	
	local pma_by_country = {
		["Armenia"] = 70,
		["Bahrain"] = 70,
		["Bangladesh"] = 60,
		["Brazil"] = 70,
		["Bulgaria"] = 70,
		["Canada"] = 50,
		["Chile"] = 70,
		["Djibouti"] = 50,
		["Estonia"] = 70,
		["Iceland"] = 70,
		["Indonesia"] = 70,
		["Iraq"] = 50,
		["Israel"] = 70,
		["Latvia"] = 70,
		["Liechtenstein"] = 70,
		["Lithuania"] = 70,
		["Luxembourg"] = 70,
		["Moldova"] = 70,
		["Mozambique"] = 70,
		["Oman"] = 70,
		["Palau"] = 50,
		["Poland"] = 70,
		["Portugal"] = 70,
		["Somalia"] = 30,
		["Ukraine"] = 70,
		["United Arab Emirates"] = 50
	}
	
	if country == 'Argentina' then
		if work_type == 'movie' then
			return 50
		else
			return 70
		end
	elseif country == 'Iran' then
		if deathyear < 1980 or deathdate < '1980-08-22' then -- fix this
			return 30
		elseif deathyear > 1980 or deathdate >= '1980-08-22' then -- fix this
			return 50
		else
			return nil
		end
	else
		return pma_by_country[country] or pma_URAA(args)
	end
end

--[=[
URAA accession date for a country
]=]
function uraa_accession_date(country)
	-- fix this
	local uraa_dates = {
		["Afghanistan"] = "2016-07-29",
		["Albania"] = "1996-01-01",
		["Algeria"] = "1998-04-19",
		["Andorra"] = "2004-06-02",
		["Angola"] = "1996-11-23",
		["Antigua and Barbuda"] = "1996-01-01",
		["Argentina"] = "1996-01-01",
		["Armenia"] = "2000-10-19",
		["Australia"] = "1996-01-01",
		["Austria"] = "1996-01-01",
		["Azerbaijan"] = "1999-06-04",
		["Bahamas"] = "1996-01-01",
		["Bahrain"] = "1996-01-01",
		["Bangladesh"] = "1996-01-01",
		["Barbados"] = "1996-01-01",
		["Belarus"] = "1997-12-12",
		["Belgium"] = "1996-01-01",
		["Belize"] = "1996-01-01",
		["Benin"] = "1996-01-01",
		["Bhutan"] = "2004-11-25",
		["Bolivia"] = "1996-01-01",
		["Bosnia and Herzegovina"] = "1996-01-01",
		["Botswana"] = "1996-01-01",
		["Brazil"] = "1996-01-01",
		["Brunei"] = "1996-01-01",
		["Bulgaria"] = "1996-01-01",
		["Burkina Faso"] = "1996-01-01",
		["Burundi"] = "1996-01-01",
		["Cambodia"] = "2004-10-13",
		["Cameroon"] = "1996-01-01",
		["Canada"] = "1996-01-01",
		["Cape Verde"] = "1997-07-07",
		["Central African Republic"] = "1996-01-01",
		["Chad"] = "1996-01-01",
		["Chile"] = "1996-01-01",
		["People's Republic of China"] = "1996-01-01",
		["China"] = "1996-01-01",
		["Colombia"] = "1996-01-01",
		["Comoros"] = "2005-04-17",
		["Democratic Republic of the Congo"] = "1996-01-01",
		["Republic of the Congo"] = "1996-01-01",
		["Costa Rica"] = "1996-01-01",
		["Côte d'Ivoire"] = "1996-01-01",
		["Ivory Coast"] = "1996-01-01",
		["Croatia"] = "1996-01-01",
		["Cuba"] = "1996-01-01",
		["Cyprus"] = "1996-01-01",
		["Czech Republic"] = "1996-01-01",
		["Denmark"] = "1996-01-01",
		["Djibouti"] = "1996-01-01",
		["Dominica"] = "1996-01-01",
		["Dominican Republic"] = "1996-01-01",
		["Ecuador"] = "1996-01-01",
		["Egypt"] = "1996-01-01",
		["El Salvador"] = "1996-01-01",
		["Equatorial Guinea"] = "1997-06-26",
		["Estonia"] = "1996-01-01",
		["Eswatini"] = "1996-01-01",
		["Fiji"] = "1996-01-01",
		["Finland"] = "1996-01-01",
		["France"] = "1996-01-01",
		["Gabon"] = "1996-01-01",
		["Gambia"] = "1996-01-01",
		["Georgia"] = "1996-01-01",
		["Germany"] = "1996-01-01",
		["Ghana"] = "1996-01-01",
		["Greece"] = "1996-01-01",
		["Grenada"] = "1996-02-22",
		["Guatemala"] = "1996-01-01",
		["Guinea"] = "1996-01-01",
		["Guinea-Bissau"] = "1996-01-01",
		["Guyana"] = "1996-01-01",
		["Haiti"] = "1996-01-11",
		["Honduras"] = "1996-01-01",
		["Hong Kong"] = "1996-01-01",
		["Hungary"] = "1996-01-01",
		["Iceland"] = "1996-01-01",
		["India"] = "1996-01-01",
		["Indonesia"] = "1996-01-01",
		["Ireland"] = "1996-01-01",
		["Israel"] = "1996-01-01",
		["Italy"] = "1996-01-01",
		["Jamaica"] = "1996-01-01",
		["Japan"] = "1996-01-01",
		["Jordan"] = "1999-07-28",
		["Kazakhstan"] = "1999-04-12",
		["Kenya"] = "1996-01-01",
		["Kiribati"] = "2018-01-02",
		["Korea, North"] = "2003-04-28",
		["Korea, South"] = "1996-01-01",
		["Kuwait"] = "1996-01-01",
		["Kyrgyzstan"] = "1998-12-20",
		["Laos"] = "2012-03-14",
		["Latvia"] = "1996-01-01",
		["Lebanon"] = "1996-01-01",
		["Lesotho"] = "1996-01-01",
		["Libya"] = "1996-01-01",
		["Liechtenstein"] = "1996-01-01",
		["Lithuania"] = "1996-01-01",
		["Luxembourg"] = "1996-01-01",
		["Macau"] = "1996-01-01",
		["Madagascar"] = "1996-01-01",
		["Malawi"] = "1996-01-01",
		["Malaysia"] = "1996-01-01",
		["Maldives"] = "1996-01-01",
		["Mali"] = "1996-01-01",
		["Malta"] = "1996-01-01",
		["Mauritania"] = "1996-01-01",
		["Mauritius"] = "1996-01-01",
		["Mexico"] = "1996-01-01",
		["Micronesia"] = "2003-10-07",
		["Moldova"] = "1996-01-01",
		["Monaco"] = "1996-01-01",
		["Mongolia"] = "1997-01-29",
		["Montenegro"] = "1996-01-01",
		["Morocco"] = "1996-01-01",
		["Mozambique"] = "1996-01-01",
		["Myanmar"] = "1996-01-01",
		["Namibia"] = "1996-01-01",
		["Nepal"] = "2004-04-23",
		["Netherlands"] = "1996-01-01",
		["Aruba"] = "1996-01-01",
		["Curaçao"] = "1996-01-01",
		["Caribbean Netherlands"] = "1996-01-01",
		["Sint Maarten"] = "1996-01-01",
		["New Zealand"] = "1996-01-01",
		["Nicaragua"] = "1996-01-01",
		["Niger"] = "1996-01-01",
		["Nigeria"] = "1996-01-01",
		["North Macedonia"] = "1996-01-01", ["Macedonia"] = "1996-01-01",
		["Norway"] = "1996-01-01",
		["Oman"] = "1999-07-14",
		["Pakistan"] = "1996-01-01",
		["Panama"] = "1996-06-08",
		["Papua New Guinea"] = "1996-06-09",
		["Paraguay"] = "1996-01-01",
		["Peru"] = "1996-01-01",
		["Philippines"] = "1996-01-01",
		["Poland"] = "1996-01-01",
		["Portugal"] = "1996-01-01",
		["Qatar"] = "1996-01-13",
		["Romania"] = "1996-01-01",
		["Russia"] = "1996-01-01",
		["Rwanda"] = "1996-01-01",
		["St. Kitts and Nevis"] = "1996-01-01",
		["St. Lucia"] = "1996-01-01",
		["St. Vincent and the Grenadines"] = "1996-01-01",
		["Samoa"] = "2006-07-21",
		["São Tomé and Príncipe"] = "2016-06-14",
		["Saudi Arabia"] = "2004-08-02",
		["Senegal"] = "1996-01-01",
		["Serbia"] = "1996-01-01",
		["Seychelles"] = "2015-04-26",
		["Singapore"] = "1996-01-01",
		["Slovakia"] = "1996-01-01",
		["Slovenia"] = "1996-01-01",
		["Solomon Islands"] = "1996-07-26",
		["South Africa"] = "1996-01-01",
		["Spain"] = "1996-01-01",
		["Sri Lanka"] = "1996-01-01",
		["Sudan"] = "2000-12-28",
		["Suriname"] = "1996-01-01",
		["Sweden"] = "1996-01-01",
		["Switzerland"] = "1996-01-01",
		["Syria"] = "2004-06-11",
		["Taiwan"] = "2002-01-01",
		["Tajikistan"] = "2000-03-09",
		["Tanzania"] = "1996-01-01",
		["Thailand"] = "1996-01-01",
		["Timor Leste"] = "1996-01-01",
		["Togo"] = "1996-01-01",
		["Tonga"] = "2001-06-14",
		["Trinidad and Tobago"] = "1996-01-01",
		["Tunisia"] = "1996-01-01",
		["Turkey"] = "1996-01-01",
		["Turkmenistan"] = "2016-05-29",
		["Tuvalu"] = "2017-06-02",
		["Uganda"] = "1996-01-01",
		["Ukraine"] = "1996-01-01",
		["United Arab Emirates"] = "1996-04-10",
		["United Kingdom"] = "1996-01-01",
		["United States"] = "1996-01-01",
		["United States of America"] = "1996-01-01",
		["USA"] = "1996-01-01",
		["Uruguay"] = "1996-01-01",
		["Uzbekistan"] = "2005-04-19",
		["Vanuatu"] = "2012-08-24",
		["Vatican City"] = "1996-01-01",
		["Venezuela"] = "1996-01-01",
		["Vietnam"] = "1998-12-23",
		["Yemen"] = "2008-04-14",
		["Zambia"] = "1996-01-01",
		["Zimbabwe"] = "1996-01-01"
	}
	return uraa_dates[country]
end

--[=[
URAA accession date for a country
]=]
function uraa_accession_year(country)
	return string.sub(uraa_accession_date(country), 1, 4) -- fix this
end

--[=[
Whether pma is the only critierion for whether a work was PD on the URAA accession date
]=]
function pma_sufficient(country)
	local pma_sufficiency = {
		["Afghanistan"] = false,
		["Albania"] = true,
		["Algeria"] = false,
		["Andorra"] = true,
		["Angola"] = true,
		["Antigua and Barbuda"] = false,
		["Argentina"] = false,
		["Armenia"] = true,
		["Australia"] = false,
		["Austria"] = false,
		["Azerbaijan"] = true,
		["Bahamas"] = true,
		["Bahrain"] = true,
		["Bangladesh"] = true,
		["Barbados"] = true,
		["Belarus"] = true,
		["Belgium"] = true,
		["Belize"] = true,
		["Benin"] = true,
		["Bhutan"] = true,
		["Bolivia"] = true,
		["Bosnia and Herzegovina"] = true,
		["Botswana"] = true,
		["Brazil"] = false,
		["Brunei"] = true,
		["Bulgaria"] = true,
		["Burkina Faso"] = true,
		["Burundi"] = true,
		["Cambodia"] = true,
		["Cameroon"] = true,
		["Canada"] = false,
		["Cape Verde"] = true,
		["Central African Republic"] = true,
		["Chad"] = true,
		["Chile"] = true,
		["People's Republic of China"] = false, ["China"] = false,
		["Colombia"] = false,
		["Comoros"] = true,
		["Democratic Republic of the Congo"] = true,
		["Republic of the Congo"] = true,
		["Costa Rica"] = true,
		["Côte d'Ivoire"] = false, ["Ivory Coast"] = false,
		["Croatia"] = true,
		["Cuba"] = true,
		["Cyprus"] = true,
		["Czech Republic"] = false,
		["Denmark"] = true,
		["Djibouti"] = false,
		["Dominica"] = true,
		["Dominican Republic"] = true,
		["Ecuador"] = true,
		["Egypt"] = true,
		["El Salvador"] = true,
		["Equatorial Guinea"] = true,
		["Estonia"] = true,
		["Eswatini"] = true,
		["Fiji"] = true,
		["Finland"] = true,
		["France"] = false,
		["Gabon"] = true,
		["Gambia"] = true,
		["Georgia"] = true,
		["Germany"] = true,
		["Ghana"] = true,
		["Greece"] = true,
		["Grenada"] = true,
		["Guatemala"] = true,
		["Guinea"] = false,
		["Guinea-Bissau"] = true,
		["Guyana"] = true,
		["Haiti"] = true,
		["Honduras"] = true,
		["Hong Kong"] = false,
		["Hungary"] = true,
		["Iceland"] = true,
		["India"] = false,
		["Indonesia"] = false,
		["Ireland"] = true,
		["Israel"] = false,
		["Italy"] = false,
		["Jamaica"] = true,
		["Japan"] = true,
		["Jordan"] = true,
		["Kazakhstan"] = true,
		["Kenya"] = false,
		["Kiribati"] = true,
		["Korea, North"] = true,
		["Korea, South"] = true,
		["Kuwait"] = false,
		["Kyrgyzstan"] = true,
		["Laos"] = false,
		["Latvia"] = true,
		["Lebanon"] = false,
		["Lesotho"] = true,
		["Libya"] = false,
		["Liechtenstein"] = true,
		["Lithuania"] = true,
		["Luxembourg"] = true,
		["Macau"] = false,
		["Madagascar"] = true,
		["Malawi"] = true,
		["Malaysia"] = true,
		["Maldives"] = false,
		["Mali"] = true,
		["Malta"] = true,
		["Mauritania"] = true,
		["Mauritius"] = true,
		["Mexico"] = false,
		["Micronesia"] = true,
		["Moldova"] = true,
		["Monaco"] = false,
		["Mongolia"] = true,
		["Montenegro"] = true,
		["Morocco"] = true,
		["Mozambique"] = true,
		["Myanmar"] = false,
		["Namibia"] = false,
		["Nepal"] = true,
		["Netherlands"] = true,
		["Aruba"] = true,
		["Curaçao"] = true,
		["Caribbean Netherlands"] = true,
		["Sint Maarten"] = true,
		["New Zealand"] = false,
		["Nicaragua"] = true,
		["Niger"] = true,
		["Nigeria"] = false,
		["North Macedonia"] = true, ["Macedonia"] = true,
		["Norway"] = true,
		["Oman"] = false,
		["Pakistan"] = false,
		["Panama"] = true,
		["Papua New Guinea"] = true,
		["Paraguay"] = true,
		["Peru"] = false,
		["Philippines"] = false,
		["Poland"] = true,
		["Portugal"] = true,
		["Qatar"] = true,
		["Romania"] = true,
		["Russia"] = false,
		["Rwanda"] = true,
		["St. Kitts and Nevis"] = true,
		["St. Lucia"] = true,
		["St. Vincent and the Grenadines"] = true,
		["Samoa"] = true,
		["São Tomé and Príncipe"] = true,
		["Saudi Arabia"] = true,
		["Senegal"] = true,
		["Serbia"] = true,
		["Seychelles"] = false,
		["Singapore"] = true,
		["Slovakia"] = true,
		["Slovenia"] = true,
		["Solomon Islands"] = true,
		["South Africa"] = true,
		["Spain"] = true,
		["Sri Lanka"] = false,
		["Sudan"] = false,
		["Suriname"] = true,
		["Sweden"] = true,
		["Switzerland"] = true,
		["Syria"] = true,
		["Taiwan"] = false,
		["Tajikistan"] = true,
		["Tanzania"] = true,
		["Thailand"] = true,
		["Timor Leste"] = true,
		["Togo"] = true,
		["Tonga"] = true,
		["Trinidad and Tobago"] = true,
		["Tunisia"] = true,
		["Turkey"] = true,
		["Turkmenistan"] = true,
		["Tuvalu"] = true,
		["Uganda"] = false,
		["Ukraine"] = true,
		["United Arab Emirates"] = false,
		["United Kingdom"] = false,
		["United States"] = false, ["United States of America"] = false, ["USA"] = false,
		["Uruguay"] = true,
		["Uzbekistan"] = true,
		["Vanuatu"] = true,
		["Vatican City"] = true,
		["Venezuela"] = false,
		["Vietnam"] = false,
		["Yemen"] = false,
		["Zambia"] = true,
		["Zimbabwe"] = false
	}
	return pma_sufficiency[country]
end

function expiry_year(args)
	return args.deathyear + pma_URAA(args) + 1
end

function verbose_output_en(args)
	local country = args.country or 'Testlandia'
	local expiryyear = expiry_year(args)
	local pma = pma_URAA(args) or 'XX'
	local uraa_date = uraa_accession_date(country) or 'YYYY-MM-DD'
	local deathyear = args.deathyear or 'YYYY'
	
	return "'''PD''': Copyright expired in source country (<code>" .. country .. "</code>) in <code>" .. expiryyear .. "</code>. Determined using <code>" .. pma .. "-pma</code> details valid at time of URAA accession for <code>" .. country .. "</code>, <code>" .. uraa_date .. "</code>, together with specified deathyear, <code>" .. deathyear .. "</code>."
end

function verbose_nil_en(args)
	local country = args.country or 'Country'
	return country .. "needs checking manually at [[:en:Wikipedia:Non-U.S._copyrights#Dates_of_restoration_and_terms_of_protection]]. Set <code>PD-on-URAA-date=yes</code> if it was PD in the source country on the URAA date."
end

function verbose_output(args)
	local langArgs = {
		['en'] = verbose_output_en(args)
	}
	local lang = args.lang
	return langSwitch(langArgs, lang)
end

function verbose_nil(args)
	local langArgs = {
		['en'] = verbose_nil_en(args)
	}
	local lang = args.lang
	return langSwitch(langArgs, lang)
end

function pd_on_uraa_date(args)
	local country = args.country
	local deathyear = args.deathyear
	local deathdate = args.deathdate or approx_deathdate(deathyear)
	
	if pma_sufficient(country) then
		local expiryyear = deathyear + pma_URAA(args) + 1
		local accession_year = uraa_accession_date(country)
		return expiryyear <= accession_year
	else
		return nil
	end
end

function tick()
	return frame:expandTemplate{
		title = 'Tick',
		args = {}
    }
end

function cross()
	return frame:expandTemplate{
		title = 'Cross',
		args = {}
    }
end

function confirm_pd_on_uraa_date(args)
	local pd = pd_on_uraa_date(args)
	local verbose = yesno(args.verbose or 'no')
	args.lang = 'en' -- fix this
	
	if pd and verbose then
		return tick() .. " " .. verbose_output(args)
	elseif pd == false then
		return cross() .. " " .. verbose_output(args)
	elseif pd == nil then
		return verbose_nil(args)
	end
end

return p