模組:Category tree/poscatboiler/data/languages/sandbox

維基詞典,自由的多語言詞典

此數據子模塊定義了維基詞典分類結構的一部分。

關於poscatboiler系統的介紹以及如何添加或更改分類,請參見Module:category tree/poscatboiler/data/documentation


local raw_categories = {}
local raw_handlers = {}

local m_languages = require("Module:languages")


-- This handles language categories of the form e.g. [[Category:French language]] and
-- [[:Category:British Sign Language]] and regional variant categories of the form
-- e.g. [[Category:Regional French]].


-----------------------------------------------------------------------------
--                                                                         --
--                              RAW CATEGORIES                             --
--                                                                         --
-----------------------------------------------------------------------------


raw_categories["方言"] = {
	description = "本分類將各個語言的詞語按照使用的區域進行分類。",
	additional = "{{{umbrella_msg}}}",
	parents = {
		"分类",
	},
}

raw_categories["所有語言"] = {
	intro = "{{sisterlinks|Category:Languages}}\n[[File:Languages world map-transparent background.svg|thumb|right|250px|世界語系分佈略圖]]",
	description = "本分類包括了維基詞典中的所有語言分類。",
	additional = "維基詞典收錄的各種語言并不是都在此處有自己的分類。有關完整列表,請參閱[[Wiktionary:語言列表]]。" ,
	parents = {
		"分类",
	},
}

raw_categories["所有絕跡語言"] = {
	description = "本分類包括了維基詞典所有[[絕跡語言]]的分類。",
	additional = "與收錄絕跡語言名字的[[:Category:絕跡語言]]不同。",
	parents = {
		"所有語言",
	},
}



-----------------------------------------------------------------------------
--                                                                         --
--                                RAW HANDLERS                             --
--                                                                         --
-----------------------------------------------------------------------------


local function makeCategoryLink(object)
	return "[[:Category:" .. 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
	
	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|維基詞典]]
|| '']=], 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|維基百科]]
|| ''維基百科上有關]=], 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:Crystal kfind.png|35px|none|相關信息]]
|| ]=], categoryName, [=[的相關信息
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | '''[[Wiktionary:]=], canonicalName, [=[]]'''
<!-- |-
| style="vertical-align: middle; height: 35px" | [[File:Incomplete list.svg|35px|none|索引]]
|| ]=], categoryName, [=[的索引
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | '''[[Index:]=], canonicalName, [=[]]''' -->
|-
| style="vertical-align: middle; height: 35px" | [[File:Open book nae 02.svg|35px|none|詞條]]
|| ]=], categoryName, [=[的詞條
|-
| colspan="2" style="padding-left: 10px;" | ''']=], require("Module:links").full_link({lang = require("Module:languages").getByCode("zh"), 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<th colspan="2">'
		.. edit_link("Module:" .. m_languages.getDataModuleName(lang:getCode()),
			"編輯語言資料")
		.. "</th>\n</tr>\n")
	table.insert(ret, "<tr>\n<th>標準名稱</th><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<th>其他名稱</th><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<th>別名</th><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<th>變體</th><td><ul>" .. table.concat(names, "\n") .. "</ul></td>\n</tr>\n")
	-- 	end
	-- end

	table.insert(ret, "<tr>\n<th>[[Wiktionary:語言|語言代碼]]</th><td><code>" .. lang:getCode() .. "</code></td>\n</tr>\n")
	table.insert(ret, "<tr>\n<th>[[Wiktionary:語系|語系]]</th>\n")
	
	local fam = lang:getFamily()
	local famCode = fam and fam:getCode()
	
	if not fam then
		table.insert(ret, "<td>未分類</td>")
	elseif famCode == "qfa-iso" then
		table.insert(ret, "<td>[[:Category:孤立語言|孤立語言]]</td>")
	elseif famCode == "qfa-mix" then
		table.insert(ret, "<td>[[:Category:混合語言|混合語言]]</td>")
	elseif famCode == "sgn" then
		table.insert(ret, "<td>[[:Category:手語|手語]]</td>")
	elseif famCode == "crp" then
		table.insert(ret, "<td>[[:Category:克里奧爾語或皮欽語|克里奧爾語或皮欽語]]</td>")
	elseif famCode == "art" then
		table.insert(ret, "<td>[[:Category:重構語言|重構語言]]</td>")
	else
		table.insert(ret, "<td>" .. makeCategoryLink(fam) .. "</td>")
	end
	
	table.insert(ret, "\n</tr>\n<tr>\n<th>祖語</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<th>[[Wiktionary:文字|文字]]</th>\n<td><ul>\n" .. table.concat(script_text, "\n") .. "</ul></td>\n</tr>\n")
	else
		table.insert(ret, "<tr>\n<th>[[Wiktionary:文字|文字]]</th>\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,
			("[[Module:%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 ("[[Module:%s]]"):format(data.module)
									or "(none)"))
					end
				end
				table.insert(translit_module_info, table.concat(redirects_to))
			end
		end
		
		table.insert(ret, [=[
<tr>
<th>[[Wiktionary:轉寫與羅馬化|轉寫模組]]</th>
<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">無效的維基數據頁面: <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


local function get_description_intro_additional(lang, countries, extinct, setwiki, setwikt, setsister, entryname)
	if lang:getCode() == "und" then
		local description =
			"本分類為'''" .. lang:getCategoryName() .. "'''的主分類,維基詞典使用[[Wiktionary:語言|代碼]] '''" .. lang:getCode() .. "'''來表示。" ..
			"該語言包含歷史著作中的詞語,其含義尚未為學界所確定。"
		return description, nil, nil
	end
	
	local canonicalName = lang:getCanonicalName()
	
	local intro = linkbox(lang, setwiki, setwikt, setsister, entryname)

	local description = "本分類為'''" .. lang:getCategoryName() .. "'''的主分類。"

	local country_links = {}
	for _, country in ipairs(countries) do
		if country ~= "UNKNOWN" then
			table.insert(country_links, "[[" .. country .. "]]")
		end
	end
	local country_desc
	if #country_links > 0 then
		local country_link_text = mw.text.listToText(country_links, "、", "和")
		if extinct then
			country_desc = "這是一種曾使用於" .. country_link_text .. "的[[絕跡語言]]。\n\n"
		else
			country_desc = "該語言使用於" .. country_link_text .. "。\n\n"
		end
	elseif extinct then
		country_desc = "這是一種[[絕跡語言]]。"
	else
		country_desc = ""
	end

	local add = country_desc .. "與" .. canonicalName .. "有關的信息:\n\n" .. infobox(lang)
	
	if lang:getType() == "reconstructed" then
		add = add .. "\n\n" ..
			canonicalName .. "是一種重構語言。其詞語和詞根不見於任何書面作品中,是通過比較分析得出的結果," ..
			"即在非巧合和借詞的情況下對比不同語言的共同點,並從中推斷出該種重構語言形。\n\n" ..
			"根據本站的[[Wiktionary:收錄標準|收錄標準]]," .. canonicalName .. "的詞條'''不應'''出現在" ..
			"主詞條空間中,只能以Reconstruction: 名字空間的形式出現。"
	elseif lang:getType() == "appendix-constructed" then
		add = add .. "\n\n" ..
			canonicalName .. "是一種使用不夠廣泛的人工語言。" ..
			"根據本站的[[Wiktionary:收錄標準|收錄標準]]," .. canonicalName .. "的詞條'''不應'''出現在" ..
			"主詞條空間中,只能Appendix: (附錄)名字空間的形式出現。 " ..
			"本語言的所有詞條可在[[Appendix:" .. canonicalName .. "]]中找到。"
	end
	
	local about = mw.title.new("Wiktionary:關於" .. canonicalName)
	
	if about.exists then
		add = add .. "\n\n" ..
			"請參見'''[[Wiktionary:關於" .. canonicalName .. "]]'''以獲取" .. lang:getCategoryName() .. "的有關信息,以及該種語言詞條創建的規範。"
	end
	
	local ok, tree_of_descendants = pcall(
		require("Module:family tree").print_children,
		lang:getCode(), {
			protolanguage_under_family = true,
			must_have_descendants = true
		})
	
	if ok then
		if tree_of_descendants then
			add = add .. NavFrame(
				tree_of_descendants,
				"Family tree")
		else
			add = add .. "\n\n" .. lang:getCanonicalName()
				.. "在維基詞典的資料模組中沒有派生語彙或變體。"
		end
	else
		mw.log("error while generating tree: " .. tostring(tree_of_descendants))
	end

	return description, intro, add
end


local function get_parents(lang, countries, extinct)
	local langCode = lang:getCode()
	local canonicalName = lang:getCanonicalName()
	
	local ret = {{name = "所有語言", sort = langCode}}
	
	local fam = lang:getFamily()
	local famCode = fam and fam:getCode()
	
	-- FIXME: Some of the following categories should be added to this module.
	if not fam then
		table.insert(ret, {name = "Category:未分類語言", sort = langCode})
	elseif famCode == "qfa-iso" then
		table.insert(ret, {name = "Category:孤立語言", sort = langCode})
	elseif famCode == "qfa-mix" then
		table.insert(ret, {name = "Category:混合語言", sort = langCode})
	elseif famCode == "sgn" then
		table.insert(ret, {name = "Category:手語", sort = langCode})
	elseif famCode == "crp" then
		table.insert(ret, {name = "Category:克里奧爾語或皮欽語", sort = langCode})
		
		for _, anc in ipairs(lang:getAncestors()) do
			table.insert(ret, {name = "Category:基於" .. anc:getCanonicalName() .. "而成的克里奧爾語或皮欽語", sort = langCode})
		end
	elseif famCode == "art" then
		if lang:getType() == "appendix-constructed" then
			table.insert(ret, {name = "Category:只存於附錄的人工語言", sort = langCode})
		else
			table.insert(ret, {name = "Category:人工語言", sort = langCode})
		end
		
		for _, anc in ipairs(lang:getAncestors()) do
			table.insert(ret, {name = "Category:基於" .. anc:getCanonicalName() .. "而成的人工語言", sort = langCode})
		end
	else
		table.insert(ret, {name = "Category:" .. fam:getCategoryName(), sort = langCode})
		
		if lang:getType() == "reconstructed" then
			table.insert(ret, {name = "Category:重構語言", sort = langCode})
		end
	end
	
	for _, sc in ipairs(lang:getScripts()) do
		table.insert(ret, {name = "Category:" .. sc:getCategoryName() .. "語言", sort = langCode})
		
		if sc:getCode() == "Jpan" then
			table.insert(ret, {name = "Category:" .. require("Module:scripts").getByCode("Hani"):getCategoryName() .. "語言", sort = langCode})
			table.insert(ret, {name = "Category:" .. require("Module:scripts").getByCode("Hira"):getCategoryName() .. "語言", sort = langCode})
			table.insert(ret, {name = "Category:" .. require("Module:scripts").getByCode("Kana"):getCategoryName() .. "語言", sort = langCode})
		elseif sc:getCode() == "Kore" then
			table.insert(ret, {name = "Category:" .. require("Module:scripts").getByCode("Hang"):getCategoryName() .. "語言", sort = langCode})
			table.insert(ret, {name = "Category:" .. require("Module:scripts").getByCode("Hani"):getCategoryName() .. "語言", sort = langCode})
		end
	end
	
	if lang:hasTranslit() then
		table.insert(ret, {name = "Category:使用自動轉寫的語言", sort = langCode})
	end
	
	local saw_country = false
	for _, country in ipairs(countries) do
		if country ~= "UNKNOWN" then
			table.insert(ret, {name = "Category:" .. country .. "語言", sort = langCode})
			saw_country = true
		end
	end

	if extinct then
		table.insert(ret, {name = "所有絕跡語言", sort = langCode})
	end

	if not saw_country then
		table.insert(ret, {name = "Category:沒有分入國家分類的語言", sort = langCode})
	end

	return ret
end


local function get_children(lang)
	local ret = {}

	-- FIXME: We should work on the children mechanism so it isn't necessary to manually specify these.
	-- for _, label in ipairs({"附錄", "詞條維護", "詞元", "名字", "短語", "韻部", "符號", "模板", "詞源", "依應用分類的"}) do
	-- 	table.insert(ret, {name = label, is_label = true})
	-- end

	table.insert(ret, {name = "派生自{{{langname}}}的", is_label = true, lang = false})
	-- table.insert(ret, {module = "topic cat", args = {code = "{{{langcode}}}", label = "所有主題"}, sort = "所有主題"})
	table.insert(ret, {name = "{{{langname}}}方言"})
	-- table.insert(ret, {name = "Requests concerning {{{langname}}}"})
	table.insert(ret, {name = "Category:User {{{langcode}}}", description = "Wiktionary users categorized by fluency levels in {{{langname}}}."})
	return ret
end


-- Handle language categories of the form e.g. [[:Category:French language]] and
-- [[:Category:British Sign Language]].
table.insert(raw_handlers, function(data)
	local lang = m_languages.getByCanonicalName(data.category)
	if not lang then
		return nil
	end
	local params = {
		[4] = {list = true},
		["setwiki"] = {},
		["setwikt"] = {},
		["setsister"] = {},
		["entryname"] = {},
		["extinct"] = {type = "boolean"},
	}
	local args = require("Module:parameters").process(data.args, params)
	-- If called from inside, don't require any arguments, as they can't be known
	-- in general and aren't needed just to generate the first parent (used for
	-- breadcrumbs).
	if #args[4] == 0 and not data.called_from_inside then
		-- At least one country must be specified unless the language is constructed (e.g. Esperanto) or reconstructed (e.g. Proto-Indo-European).
		local fam = lang:getFamily()
		if lang:getType() ~= "reconstructed" and not (fam and fam:getCode() == "art") then
			error("At least one country (param 1=) must be specified for language '" .. lang:getCanonicalName() .. "' (code '" .. lang:getCode() .. "'). " ..
				"Use the value UNKNOWN if the language's location is truly unknown.")
		end
	end
	local description, intro, additional = "", "", ""
	-- If called from inside the category tree system, it's called when generating
	-- parents or children, and we don't need to generate the description or additional
	-- text (which is very expensive in terms of memory because it calls [[Module:family tree]],
	-- which calls [[Module:languages/alldata]]).
	if not data.called_from_inside then
		description, intro, additional = get_description_intro_additional(
			lang, args[4], args.extinct, args.setwiki, args.setwikt, args.setsister, args.entryname
		)
	end
	return {
		description = description,
		lang = lang:getCode(),
		intro = intro,
		additional = additional,
		breadcrumb = lang:getCanonicalName(),
		parents = get_parents(lang, args[4], args.extinct),
		extra_children = get_children(lang),
		umbrella = false,
		can_be_empty = true,
	}, true
end)


-- Handle categories such as [[:Category:Regional French]] and [[:Category:Regional Ancient Greek]].
table.insert(raw_handlers, function(data)
	local langname = data.category:match("^(.*)方言$")
	if langname then
		local lang = require("Module:languages").getByCanonicalName(langname)
		if lang then
			return {
				lang = lang:getCode(),
				description = lang:makeCategoryLink() .. "各個地區的方言的分類。",
				additional = "本分類也可能包含使用地區不明的詞語。此類詞語通常應根據其使用的地區重新分類。",
				parents = {
					"{{{langcat}}}",
					{name = "方言", sort = langname},
				},
				breadcrumb = "方言",
			}
		end
	end
end)


return {RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers}