Module:ISO 3166: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
(Added error codes)
Line 130: Line 130:
then
then
if code2=="" then
if code2=="" then
return cerror(eot,"Invalid ISO 3166-1 code "..code1,orig)
return cerror(eot,"Invalid ISO 3166-1 code "..code1,orig),'[[Category:Wikipedia page with obscure country]]'
else
else
return cerror(eot,"Invalid ISO 3166-2 code "..code1.."-"..code2,orig)
return cerror(eot,"Invalid ISO 3166-2 code "..code1.."-"..code2,orig),'[[Category:Wikipedia page with obscure country or subdivision]]'
end
end
end
end
Line 144: Line 144:
or (data[code1]["displayname"] or data[code1]["name"])
or (data[code1]["displayname"] or data[code1]["name"])
else
else
return cerror(eot,"Unknown ISO 3166-1 code "..code1,orig)
return cerror(eot,"Unknown ISO 3166-1 code "..code1,orig),'[[Category:Wikipedia page with obscure country]]'
end
end
else
else
Line 152: Line 152:
sdata = mw.loadData("Module:ISO 3166/data/"..code1)
sdata = mw.loadData("Module:ISO 3166/data/"..code1)
else
else
return cerror(eot,"Unknown ISO 3166-1 code "..code1,orig)
return cerror(eot,"Unknown ISO 3166-1 code "..code1,orig),'[[Category:Wikipedia page with obscure country]]'
end
end
if sdata[code2] then
if sdata[code2] then
Line 175: Line 175:
end
end
end
end
return cerror(eot,"Unknown ISO 3166-1 code "..code1,orig)
return cerror(eot,"Unknown ISO 3166-1 code "..code1,orig),'[[Category:Wikipedia page with obscure country]]'
end
end
Line 213: Line 213:
end
end
end
end
return cerror(eot,"Unknown country name "..args[1],args[1])
return cerror(eot,"Unknown country name "..args[1],args[1]),'[[Category:Wikipedia page with obscure country]]'
else
else
--3166-2 code
--3166-2 code
Line 229: Line 229:
end
end
if empty then
if empty then
return cerror(eot,"No subdivision codes for "..args[1],args[2])
return cerror(eot,"No subdivision codes for "..args[1],args[2]),'[[Category:Wikipedia page with obscure subdivision]]'
else
else
return cerror(eot,"Unknown subdivision name "..args[2],args[2])
return cerror(eot,"Unknown subdivision name "..args[2],args[2]),'[[Category:Wikipedia page with obscure subdivision]]'
end
end
end
end
end
end
return cerror(eot,"Unknown country name "..args[1],args[2])
return cerror(eot,"Unknown country name "..args[1],args[2]),'[[Category:Wikipedia page with obscure country]]'
end
end