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

local Nationality = {}

local c = require("Module:Citizenship")
local u = require('Dev:Utility')
local t = nil

function Nationality.category( frame )
    local output = ""
    
    local targ = u.getArgs(frame)
    
    local b = tostring(mw.title.getCurrentTitle().text)
    
    t = c.countries

    if targ[1] and targ[1] ~= "" then
        local arg = (targ[1] .. "" or "")
        arg = mw.text.trim(arg)
        if t[arg] ~= nil then
            output = t[arg] or ""
        else
            if string.find(arg, "ians") then
                output = mw.ustring.sub(arg, 0, -5)
            else
                output = mw.ustring.sub(arg, 0, -3)
            end
        end
    else
        if t[b] ~= nil then
            output = t[b] or ""
        else
            if string.find(b, "ians") then
                output = mw.ustring.sub(b, 0, -5)
            else
                output = mw.ustring.sub(b, 0, -3)
            end
        end
    end
    
    if output ~= "" then
        output = "[[" .. output .. "]]"
    end
    
    return output

end

return Nationality
Community content is available under CC-BY-SA unless otherwise noted.