မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:category tree/langcatboiler

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:category tree/langcatboiler/doc

local export = {}

local function makeCategoryLink(object)
	return "[[:ကဏ္ဍ:" .. object:getCategoryName() .. "|" .. object:getCanonicalName() .. "]]"
end

local function linkbox(lang, setwiki, setwikt, setsister, entryname)
	local wiktionarylinks = "''ဟွံမွဲ''"
	
	local canonicalName = lang:getCanonicalName()
	local wikimediaLanguages = lang:getWikimediaLanguages()
	local categoryName = lang:getCategoryName()
	local wikipediaArticle = setwiki or lang:getWikipediaArticle()
	
	if setwikt then
		require "Module:debug".track "langcatboiler/setwikt"
		if setwikt == "-" then
			require "Module:debug".track "langcatboiler/setwikt/hyphen"
		end
	end
	
	if setwikt ~= "-" and wikimediaLanguages and wikimediaLanguages[1] then
		wiktionarylinks = {}
		
		for _, wikimedialang in ipairs(wikimediaLanguages) do
			table.insert(wiktionarylinks,
				(wikimedialang:getCanonicalName() ~= canonicalName and "(''" .. wikimedialang:getCanonicalName() .. "'') " or "") ..
				"'''[[:" .. wikimedialang:getCode() .. ":|" .. wikimedialang:getCode() .. ".wiktionary.org]]'''")
		end
		
		wiktionarylinks = table.concat(wiktionarylinks, "<br/>")
	end
	
	--local plural = wikimediaLanguages[2] and "s" or ""
	
	return table.concat{
[=[<div style="clear: right; border: solid #aaa 1px; margin: 1 1 1 1; background: #f9f9f9; width: 270px; padding: 5px; margin: 5px; text-align: left; float: right">
<div style="text-align: center; margin-bottom: 10px; margin-top: 5px">''']=], categoryName, [=['''</div>

{| style="font-size: 90%; background: #f9f9f9;"
|-
| style="vertical-align: middle; height: 35px; width: 35px;" | [[File:Wiktionary-logo-v2.svg|35px|none|ဝိက်ရှေန်နရဳ]]
|| ''Wiktionary in the edition of]=], categoryName, [=[''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | ]=], wiktionarylinks, [=[

|-
| style="vertical-align: middle; height: 35px" | [[File:Wikipedia-logo.png|35px|none|Wikipedia]]
|| ''Wikipedia article about]=], categoryName, [=[''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | ]=], (setwiki == "-" and "''ဟွံမွဲ''" or "'''[[w:" .. wikipediaArticle .. "|" .. wikipediaArticle .. "]]'''"), [=[

|-
| style="vertical-align: middle; height: 35px" | [[File:Wikimedia-logo.svg|35px|none|Wikimedia Commons]]
|| ''Links related to]=], categoryName, [=[<br>In the sister project at Wikimedia Commons''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | ]=], (setsister == "-" and "''ဟွံမွဲ''" or "'''[[commons:Category:" .. (setsister or categoryName) .. "|" .. (setsister or categoryName) .. "]]'''"), [=[

|-
| style="vertical-align: middle; height: 35px" | [[File:Crystal kfind.png|35px|none|Consideration]]
|| ''Additional considerations on]=], categoryName, [=[''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | '''[[Wiktionary:မဆေင်ကဵု]=], categoryName, [=[]]'''
|-
| style="vertical-align: middle; height: 35px" | [[File:Incomplete list.svg|35px|none|index]]
|| ''รายการศัพท์]=], categoryName, [=[''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | '''[[index:]=], categoryName, [=[]]'''
|-
| style="vertical-align: middle; height: 35px" | [[File:Open book nae 02.svg|35px|none|Meaning page]]
|| ''Definition of page]=], canonicalName, [=[''
|-
| colspan="2" style="padding-left: 10px;" | ''']=], require("Module:links").full_link({lang = require("Module:languages").getByCode("th"), term = entryname or canonicalName}), [=['''
|}
</div>]=]
}
end

local function edit_link(title, text)
	return '<span class="plainlinks">['
		.. tostring(mw.uri.fullUrl(title, { action = "edit" }))
		.. ' ' .. text .. ']</span>'
end

-- Should perhaps use wiki syntax.
local function infobox(lang)
	local ret = {}
	
	table.insert(ret, '<table class="wikitable language-category-info"')
	
	if type(lang.getRawData) == "function" then
		local raw_data = lang:getRawData()
		if raw_data then
			local replacements = {
				[1] = "canonical-name",
				[2] = "wikidata-item",
				[3] = "family",
			}
			local function replacer(letter1, letter2)
				return letter1:lower() .. "-" .. letter2:lower()
			end
			-- For each key in the language data modules, returns a descriptive
			-- kebab-case version (containing ASCII lowercase words separated
			-- by hyphens).
			local function kebab_case(key)
				key = replacements[key] or key
				key = key:gsub("(%l)(%u)", replacer):gsub("(%l)_(%l)", replacer)
				return key
			end
			local function html_attribute_encode(str)
				str = mw.text.jsonEncode(str)
					:gsub('"', "&quot;")
					-- & in attributes is automatically escaped.
					-- :gsub("&", "&amp;")
					:gsub("<", "&lt;")
					:gsub(">", "&gt;")
				return str
			end
			pcall(function ()
				table.insert(ret, ' data-code="' .. lang:getCode() .. '"')
				for k, v in require("Module:table").sortedPairs(lang:getRawData()) do
					table.insert(ret, " data-" .. kebab_case(k)
						.. '="'
						.. html_attribute_encode(v)
						.. '"')
				end
			end)
		end
	end
	table.insert(ret, '>\n')
	table.insert(ret, '<tr class="language-category-data">\n<mnw colspan="2">'
		.. edit_link("Module:" .. require("Module:languages").getDataModuleName(lang:getCode()),
			"Edit language information")
		.. "</th>\n</tr>\n")
	table.insert(ret, "<tr>\n<mnw>Canonical name</mnw><td>" .. lang:getCanonicalName() .. "</td>\n</tr>\n")

	local otherNames = lang:getOtherNames(true)
	if otherNames then
		local names = {}
		
		for _, name in ipairs(otherNames) do
			table.insert(names, "<li>" .. name .. "</li>")
		end
		
		if #names > 0 then
			table.insert(ret, "<tr>\n<mnw>ယၟုတဏဟ်</mnw><td><ul>" .. table.concat(names, "\n") .. "</ul></td>\n</tr>\n")
		end
	end
	
	local aliases = lang:getAliases()
	if aliases then
		local names = {}
		
		for _, name in ipairs(aliases) do
			table.insert(names, "<li>" .. name .. "</li>")
		end
		
		if #names > 0 then
			table.insert(ret, "<tr>\n<mnw>Synonyms</mnw><td><ul>" .. table.concat(names, "\n") .. "</ul></td>\n</tr>\n")
		end
	end

	local varieties = lang:getVarieties()
	if varieties then
		local names = {}
		
		for _, name in ipairs(varieties) do
			if type(name) == "string" then
				table.insert(names, "<li>" .. name .. "</li>")
			else
				assert(type(name) == "table")
				local first_var
				local subvars = {}
				for i, var in ipairs(name) do
					if i == 1 then
						first_var = var
					else
						table.insert(subvars, "<li>" .. var .. "</li>")
					end
				end
				if #subvars > 0 then
					table.insert(names, "<li><dl><dt>" .. first_var .. "</dt>\n<dd><ul>" .. table.concat(subvars, "\n") .. "</ul></dd></dl></li>")
				elseif first_var then
					table.insert(names, "<li>" .. first_var .. "</li>")
				end
			end
		end
		
		if #names > 0 then
			table.insert(ret, "<tr>\n<mnw>Subtype</mnw><td><ul>" .. table.concat(names, "\n") .. "</ul></td>\n</tr>\n")
		end
	end

	table.insert(ret, "<tr>\n<mnw>[[Wiktionary:စရင်အရေဝ်ဘာသာဂမၠိုင်|Language code]]</th><td><code>" .. lang:getCode() .. "</code></td>\n</tr>\n")
	table.insert(ret, "<tr>\n<mnw>[[Wiktionary:List of language families and language groups|clan/lLanguage group]]</th>\n")
	
	local fam = lang:getFamily()
	local famCode = fam and fam:getCode()
	
	if not fam then
		table.insert(ret, "<td>Not yet rated</td>")
	elseif famCode == "qfa-iso" then
		table.insert(ret, "<td>[[:Category:Lonely language|Isolated language]]</td>")
	elseif famCode == "qfa-mix" then
		table.insert(ret, "<td>[[:Category:Mixed languages|Mixed language]]</td>")
	elseif famCode == "sgn" then
		table.insert(ret, "<td>[[:Category:Sign language|Sign language]]</td>")
	elseif famCode == "crp" then
		table.insert(ret, "<td>[[:Category:Hybrid dialects|Hybrid dialect]]</td>")
	elseif famCode == "art" then
		table.insert(ret, "<td>[[:Category:Artificial language|Artificial language]]</td>")
	else
		table.insert(ret, "<td>" .. makeCategoryLink(fam) .. "</td>")
	end
	
	table.insert(ret, "\n</tr>\n<tr>\n<mnw>predecessor</th>\n")
	
	local ancestors, ancestorChain = lang:getAncestors(), lang:getAncestorChain()
	if ancestors[2] then
		local ancestorList = {}
		
		for i, anc in ipairs(ancestors) do
			ancestorList[i] = "<li>" .. makeCategoryLink(anc) .. "</li>"
		end
		
		table.insert(ret, "<td><ul>\n" .. table.concat(ancestorList, "\n") .. "</ul></td>\n")
	elseif ancestorChain[1] then
		table.insert(ret, "<td><ul>\n")
		
		local chain = {}
		
		for i, anc in ipairs(ancestorChain) do
			chain[i] = "<li>" .. makeCategoryLink(anc) .. "</li>"
		end
		
		table.insert(ret, table.concat(chain, "\n<ul>\n"))
		
		for _, _ in ipairs(chain) do
			table.insert(ret, "</ul>")
		end
		
		table.insert(ret, "</td>\n")
	else
		table.insert(ret, "<td>ဟွံတီ</td>\n")
	end
	
	table.insert(ret, "</tr>\n")
	
	local scripts = lang:getScripts()
	
	if scripts[1] then
		local script_text = {}
		
		for _, sc in ipairs(scripts) do
			local text = {}
			local code = sc:getCode()
			if code ~= "Hira" then
				table.insert(text, "<li>" .. makeCategoryLink(sc))
			end
			
			if code == "Jpan" then
				local m_scripts = require("Module:scripts")
				local Hani = m_scripts.getByCode("Hani")
				local Hira = m_scripts.getByCode("Hira")
				local Kana = m_scripts.getByCode("Kana")
				table.insert(text, "<ul>")
				table.insert(text, "<li>" .. makeCategoryLink(Hani) .. "</li>")
				table.insert(text, "<li>" .. makeCategoryLink(Hira) .. "</li>")
				table.insert(text, "<li>" .. makeCategoryLink(Kana) .. "</li>")
				table.insert(text, "</ul>")
			elseif code == "Kore" then
				local m_scripts = require("Module:scripts")
				local Hang = m_scripts.getByCode("Hang")
				local Hani = m_scripts.getByCode("Hani")
				table.insert(text, "<ul>")
				table.insert(text, "<li>" .. makeCategoryLink(Hang) .. "</li>")
				table.insert(text, "<li>" .. makeCategoryLink(Hani) .. "</li>")
				table.insert(text, "</ul>")
			end
			
			table.insert(text, "</li>")
			
			table.insert(script_text, table.concat(text, "\n"))
		end
		
		table.insert(ret, "<tr>\n<mnw>အက္ခရ်သုင်စောဲချူ</mnw>\n<td><ul>\n" .. table.concat(script_text, "\n") .. "</ul></td>\n</tr>\n")
	else
		table.insert(ret, "<tr>\n<mnw>အက္ခရ်သုင်စောဲချူ</mnw>\n<td>not specified</td>\n</tr>\n")
	end
	
	if lang._rawData.translit_module then
		local translit_module = lang._rawData.translit_module
		local translit_module_info = {}
		table.insert(translit_module_info,
			("[[မဝ်ဂျူ:%s]]"):format(translit_module))
		
		if translit_module == "translit-redirect" then
			local data = mw.loadData("Module:translit-redirect/data")[lang:getCode()]
			if data then
				table.insert(translit_module_info, ":")
				local redirects_to = {}
				local m_scripts = require "Module:scripts"
				for script, data in require "Module:table".sortedPairs(data) do
					-- Skip boolean fields like "debug_mode" and "noError".
					if type(data) == "table" then
						table.insert(redirects_to,
							("\n* <code>%s</code>: %s"):format(
								script,
								data.module and ("[[မဝ်ဂျူ:%s]]"):format(data.module)
									or "(ဟွံမွဲ)"))
					end
				end
				table.insert(translit_module_info, table.concat(redirects_to))
			end
		end
		
		table.insert(ret, [=[
<tr>
<mnw>Decoding module</mnw>
<td>]=] .. table.concat(translit_module_info) .. [=[</td>
</tr>
]=])
end
	local wikidataItem = lang:getWikidataItem()
	if lang:getWikidataItem() and mw.wikibase then
		local URL = mw.wikibase.getEntityUrl(wikidataItem)
		local link
		if URL then
			link = '[' .. URL .. ' ' .. wikidataItem .. ']'
		else
			link = '<span class="error">Invalid Wikidata item: <code>' .. wikidataItem .. '</code></span>'
		end
		table.insert(ret, "<tr><th>วิกิสนเทศ</th><td>" .. link .. "</td></tr>")
	end
	
	table.insert(ret, "</table>")
	
	return table.concat(ret)
end

local function NavFrame(content, title)
	return '<div class="NavFrame"><div class="NavHead">'
		.. (title or '{{{title}}}') .. '</div>'
		.. '<div class="NavContent" style="text-align: left;">'
		.. content
		.. '</div></div>'
end

function export.country_categories(frame)
	local categories = {}
	local canonicalName = mw.title.getCurrentTitle().text:gsub("^အရေဝ်ဘာသာ", "")

	--သုင်စောဲ "ပ္ဍဲ" represent "of" because those countries do not own
	for i, country in ipairs(frame:getParent().args) do
		if i > 1 then
			--table.insert(categories, "[[Category:Languages of " .. country .. "]]")
			--Add a prefix like "ဍုင်ရး" + index the language name
			table.insert(categories, "[[ကဏ္ဍ:အရေဝ်ဘာသာနူပ္ဍဲ" .. require("Module:utilities").prepend_country(country) .. "|" .. canonicalName .. "]]")
		end
	end
	
	if #categories > 0 then
		return table.concat(categories)
	else
		return "[[Category:Languages that do not belong to the country category|" .. canonicalName .. "]]"
	end
end


-- Category object

local Category = {}
Category.__index = Category


function Category.new(info)
	for key, val in pairs(info) do
		if not (key == "code" or key == "entryname" or key == "setsister" or key == "setwiki" or key == "setwikt") then
			error("The parameter \"" .. key .. "\" was not recognized.")
		end
	end
	
	local self = setmetatable({}, Category)
	self._info = info
	
	if not self._info.code then
		error("No language code was specified.")
	else
		self._lang = require("Module:languages").getByCode(self._info.code) or error("The language code \"" .. self._info.code .. "\" is not valid.")
	end
	
	return self
end

export.new = Category.new


function Category:getInfo()
	return self._info
end


function Category:getBreadcrumbName()
	return self._lang:getCanonicalName()
end


function Category:getDataModule()
	return "Module:category tree/langcatboiler"
end


function Category:canBeEmpty()
	return true
end


function Category:isHidden()
	return false
end


function Category:getCategoryName()
	return mw.getContentLanguage():ucfirst(self._lang:getCategoryName())
end


function Category:getDescription()
	local canonicalName = self._lang:getCanonicalName()
	local categoryName = self._lang:getCategoryName()

	if self._lang:getCode() == "und" then
		return
			"This is the main category of'''" .. categoryName .. "''', represented in Wiktionary by the [[Wiktionary:အရေဝ်ဘာသာဂမၠိုင်|code]] '''" .. self._lang:getCode() .. "''' " ..
			"This language contains terms in historical writing, whose meaning has not yet been determined by scholars."
	end
	
	local ret = linkbox(self._lang, self._info.setwiki, self._info.setwikt, self._info.setsister, self._info.entryname)
	
	ret = ret .. "This is the main category of'''" .. categoryName .. "'''\n\n information about " .. canonicalName .. ":\n\n" .. infobox(self._lang)
	
	if self._lang:getType() == "reconstructed" then
		ret = ret .. "\n\n" ..
			canonicalName .. " is a reconstructed language. Its words and roots are not directly attested in any written works, but have been reconstructed through the ''comparative method'', " ..
			"which finds regular similarities between languages that cannot be explained by coincidence or word-borrowing, and extrapolates ancient forms from these similarities.\n\n" ..
			"According to our [[Wiktionary:Criteria for inclusion|criteria for inclusion]], terms in " .. canonicalName ..
			" should '''not''' be present in entries in the main namespace, but may be added to the Reconstruction: namespace."
	elseif self._lang:getType() == "appendix-constructed" then
		ret = ret .. "\n\n" ..
			canonicalName .. " is a constructed language that is only in sporadic use. " ..
			"According to our [[Wiktionary:Criteria for inclusion|criteria for inclusion]], terms in " .. canonicalName ..
			" should '''not''' be present in entries in the main namespace, but may be added to the Appendix: namespace. " ..
			"All terms in this language may be available at [[Appendix:" .. canonicalName .. "]]."
	end
	
	local about = mw.title.new("Wiktionary:မဆေင်ကဵု" .. categoryName)
	
	if about.exists then
		ret = ret .. "\n\n" ..
			"Please look at '''[[Wiktionary:မဆေင်ကဵု" .. categoryName .. "]]''' for information and special considerations to create a list" .. categoryName
	end
	
--[[ not use; still have error
	local ok, tree_of_descendants = pcall(
		require("Module:family tree").print_children,
		self._lang:getCode(), {
			protolanguage_under_family = true,
			must_have_descendants = true
		})
	
	if ok then
		if tree_of_descendants then
			ret = ret .. NavFrame(
				tree_of_descendants,
				"Family tree")
		else
			ret = ret .. "\n\n" .. self._lang:getCanonicalName()
				.. " has no descendants or varieties listed in Wiktionary's language data modules."
		end
	else
		mw.log("error while generating tree: " .. tostring(tree_of_descendants))
	end
--]]

	return ret
end


function Category:getParents()
	local canonicalName = self._lang:getCanonicalName()
	
	local ret = {{name = "ကဏ္ဍ:အရေဝ်ဘာသာအိုတ်ဿီု", sort = canonicalName}}
	
	local fam = self._lang:getFamily()
	local famCode = fam and fam:getCode()
	
	if not fam then
		table.insert(ret, {name = "Category:Unclassified languages", sort = canonicalName})
	elseif famCode == "qfa-iso" then
		table.insert(ret, {name = "Category:Lonely language", sort = canonicalName})
	elseif famCode == "qfa-mix" then
		table.insert(ret, {name = "Category:Mixed languages", sort = canonicalName})
	elseif famCode == "sgn" then
		table.insert(ret, {name = "Category:All sign language", sort = canonicalName})
	elseif famCode == "crp" then
		table.insert(ret, {name = "Category:Hybrid dialects", sort = canonicalName})
		
		for _, anc in ipairs(self._lang:getAncestors()) do
			table.insert(ret, {name = "ကဏ္ဍ:" .. anc:getCanonicalName() .. "-based creole or pidgin languages", sort = canonicalName})
		end
	elseif famCode == "art" then
		if self._lang:getType() == "appendix-constructed" then
			table.insert(ret, {name = "Category:Artificial language in the appendix only", sort = canonicalName})
		else
			table.insert(ret, {name = "Category:Artificial language", sort = canonicalName})
		end
		
		for _, anc in ipairs(self._lang:getAncestors()) do
			table.insert(ret, {name = "Category:Artificial languages based on languages" .. anc:getCanonicalName(), sort = canonicalName})
		end
	else
		table.insert(ret, {name = "ကဏ္ဍ:" .. mw.getContentLanguage():ucfirst(fam:getCategoryName()), sort = canonicalName})
		
		if self._lang:getType() == "reconstructed" then
			table.insert(ret, {name = "Category:Reconstructed Language", sort = (mw.ustring.gsub(canonicalName, "original$", ""))})
		end
	end
	
	--သုင်စောဲအက္ခရ်အရေဝ်ဘာသာ...
	for _, sc in ipairs(self._lang:getScripts()) do
		table.insert(ret, {name = "ကဏ္ဍ:အရေဝ်ဘာသာသုင်စောဲ" .. mw.getContentLanguage():ucfirst(sc:getCategoryName()), sort = canonicalName})
		
		if sc:getCode() == "Jpan" then
			table.insert(ret, {name = "ကဏ္ဍ:အရေဝ်ဘာသာသုင်စောဲ" .. mw.getContentLanguage():ucfirst(require("Module:scripts").getByCode("Hani"):getCategoryName()), sort = canonicalName})
			table.insert(ret, {name = "ကဏ္ဍ:အရေဝ်ဘာသာသုင်စောဲ" .. mw.getContentLanguage():ucfirst(require("Module:scripts").getByCode("Hira"):getCategoryName()), sort = canonicalName})
			table.insert(ret, {name = "ကဏ္ဍ:အရေဝ်ဘာသာသုင်စောဲ" .. mw.getContentLanguage():ucfirst(require("Module:scripts").getByCode("Kana"):getCategoryName()), sort = canonicalName})
		elseif sc:getCode() == "Kore" then
			table.insert(ret, {name = "ကဏ္ဍ:အရေဝ်ဘာသာသုင်စောဲ" .. mw.getContentLanguage():ucfirst(require("Module:scripts").getByCode("Hang"):getCategoryName()), sort = canonicalName})
			table.insert(ret, {name = "ကဏ္ဍ:အရေဝ်ဘာသာသုင်စောဲ" .. mw.getContentLanguage():ucfirst(require("Module:scripts").getByCode("Hani"):getCategoryName()), sort = canonicalName})
		end
	end
	
	if self._lang:hasTranslit() then
		table.insert(ret, {name = "Category:Languages with automatic transliteration", sort = canonicalName})
	end
	
	return ret
end


function Category:getChildren()
	local ret = {}
	
	local m_poscatboiler = require("Module:category tree/poscatboiler")
	
	for _, label in ipairs({"ဗီုတဏဟ်", "Data maintenance", "Keyword", "ယၟု", "phrase", "အဆက်", "သင်္ကေတ", "ထာမ်ပလိက်", "Terms by root", "Terminology by usage", "Transcription"}) do
		local child = m_poscatboiler.new({code = self._lang:getCode(), label = label})
		local parents = child:getParents()
		
		if parents then
			-- Find the current category among the child's parents, to find its sort key
			for _, parent in ipairs(parents) do
				if type(parent.name) == "string" and parent.name == "ကဏ္ဍ:" .. self:getCategoryName() then
					table.insert(ret, {name = child, sort = parent.sort})
					break
				end
			end
		end
	end
	
	local m_derivcatboiler = require("Module:category tree/derived cat")
	local child = m_derivcatboiler.new({code = nil, label = self._lang:getCode()})
	local sortkey = child._info.label
	local parents = child:getParents()
	
	if parents then
		-- Find the current category among the child's parents, to find its sort key
		for _, parent in ipairs(parents) do
			if type(parent.name) == "string" and parent.name == "ကဏ္ဍ:" .. self:getCategoryName() then
				sortkey = parent.sort
				break
			end
		end
	end
	
	table.insert(ret, {name = child, sort = sortkey})
	
	local m_topic_cat = require("Module:category tree/topic cat")
	local child = m_topic_cat.new({code = self._lang:getCode(), label = "က္ဍိုပ်မုလိက်အိုတ်သီု"})
	local sortkey = child._info.label
	local parents = child:getParents()
	
	if parents then
		-- Find the current category among the child's parents, to find its sort key
		for _, parent in ipairs(parents) do
			if type(parent.name) == "string" and parent.name == "ကဏ္ဍ:" .. self:getCategoryName() then
				sortkey = parent.sort
				break
			end
		end
	end
	
	table.insert(ret, {name = child, sort = sortkey})
	
	-- FIXME: This is hacky, but it works as a stopgap measure.
	-- We should fix this when these categories get their own category tree modules.
	table.insert(ret, {name = {
		_lang = self._lang,
		getCategoryName = function(self) return "Regional " .. self._lang:getCanonicalName() end,
		getDescription = function(self) return self._lang:getCanonicalName() .. " terms used in specific regions or dialects." end,
		}, sort = "regional"})
	
	table.insert(ret, {name = {
		_lang = self._lang,
		getCategoryName = function(self) return "Requests (" .. self._lang:getCanonicalName() .. ")" end,
		getDescription = function(self) return self._lang:getCanonicalName() .. " entries that need attention of experienced editors." end,
		}, sort = "requests"})
	
	table.insert(ret, {name = {
		_lang = self._lang,
		getCategoryName = function(self) return "User " .. self._lang:getCode() end,
		getDescription = function(self) return "Wiktionary users categorized by language proficiency levels" .. self._lang:getCanonicalName() end,
		}, sort = "user"})
	
	return ret
end


function Category:getUmbrella()
	return nil
end


return export