Module:User:kc kennylau/redlinkcat

local export = {}

local posname = { ['n']='nouns', ['v']='verbs', ['a']='adjectives' }

local inflname = { ['n']='declension', ['v']='conjugation', ['a']='declension' }

local function if_not_empty(val) return val ~= "" and val end

function export.show(frame) local args = frame:getParent.args local langcode = if_not_empty(args[1]) local pos = if_not_empty(args[2]) if langcode then if pos then return maincat(langcode, pos) else return langcat end else if pos then return poscat else return main end end end

function main return "" end

function poscat return "" end

function langcat return "" end

function maincat(langcode, pos) mw.log(langcode, require("Module:languages").getByCode(langcode), ('%q'):format(pos)) local canonicalname = require("Module:languages").getByCode(langcode):getCanonicalName local text = "This category contains " .. canonicalname .. " " .. posname[pos] text = text .. " with red links in their " .. inflname[pos] .. " tables." text = text .. " This category may sometimes be empty." local poscat = posname[pos]:gsub("^.", string.upper) .. " with red links in their " .. inflname[pos] .. " tables by language" local langcat = canonicalname .. " terms with red links in their inflection tables" text = text .. ""	text = text .. ""	text = text .. "__HIDDENCAT__" return text end

return export