local export = {}
function export.show(frame)
local title = mw.title.getCurrentTitle()
local rootpagename = title.rootText
local isSubpage = title.isSubpage
local subpagename = title.subpageText
mw.log(rootpagename, isSubpage, subpagename)
local lang, canonicalName
if isSubpage then
lang = require("Module:languages").getByCode(subpagename)
end
local listName, matches
if rootpagename then
listName, matches = mw.ustring.gsub(rootpagename, "[Ll]ist:", "")
end
local description
local category = ""
if lang then
if matches == 1 then
description = "本模板爲關於" .. listName .. "的" .. lang:getCanonicalName() .. "列表。"
if mw.ustring.match(listName, "Latin script") then
category = "[[Category:拉丁字母模板]]"
end
else
description = "本模板爲一個" .. lang:getCanonicalName() .. "列表。"
end
end
if description then
return description .. category
end
end
return export