local export = {}
local force_cat = false -- for debugging
function export.categorize(lang, source, roots, ids, sort_key)
local categories = {}
if lang:getCode() ~= source:getCode() then
table.insert(categories,
lang:getFullName() .. " terms derived from " .. source:getCanonicalName())
end
for index, root in ipairs(roots) do
if lang:getCode() == source:getCode() then
table.insert(categories,
lang:getFullName() .. " terms belonging to the root " .. root .. (ids and " (" .. ids .. ")" or ""))
else
table.insert(categories,
lang:getFullName() .. " terms derived from the " .. source:getCanonicalName() ..
" root " .. root .. (ids and " (" .. ids .. ")" or ""))
end
end
return require("Module:utilities").format_categories(categories, lang, sort_key, nil, force_cat)
end
function export.show(frame)
local params = {
= { required = true, type = "language" },
= { required = true, type = "language" },
= { required = true, list = true },
= { list = true, allow_holes = true },
= {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
return export.categorize(args, args, args, args.id, args.sort)
end
return export