Module:AfricanWomenJournalistsLangs
local p = {}
-- List of languages you care about
local langs = {
{ code = "ha", name = "Hausa" },
{ code = "ig", name = "Igbo" },
{ code = "yo", name = "Yoruba" },
{ code = "tw", name = "Twi" },
{ code = "fat", name = "Fante" },
{ code = "sw", name = "Swahili" },
{ code = "rw", name = "Kinyarwanda" },
}
-- Helper to check sitelink presence
local function hasSitelink(qid, lang)
local title = mw.wikibase.getSitelink(qid, lang .. "wiki")
return title and title ~= ""
end
-- Main function
function p.table(frame)
local args = frame.args
local result = '
class="wikitable sortable"\n! Image !! Name !! Description'
for _, lang in ipairs(langs) do result = result .. " !! " .. lang.name end result = result .. "\n" for _, qid in ipairs(args) do local label = mw.wikibase.getLabel(qid) or '' local description = mw.wikibase.getDescription(qid) or '' local image = mw.wikibase.getBestStatements(qid, "P18")[1] local img = image and '100px' or '' result = result .. " | ||||
\n| " .. img .. " | " .. label .. " | " .. description
for _, lang in ipairs(langs) do if hasSitelink(qid, lang.code) then result = result .. " | + " .. lang.name .. ""
else result = result .. " | –"
end end result = result .. "\n" end result = result .. " |
return result
end
return p