模組:Category tree/poscatboiler/data/lang-specific/hi


This module handles generating the descriptions and categorization for 印地語 category pages of the format "印地語 LABEL" where LABEL can be any text. Examples are Category:Bulgarian conjugation 2.1 verbs and Category:Russian velar-stem neuter-form nouns. 該模块是 poscatboiler 系統的一部分,該系統是用於生成分類頁面的描述和分類的通用框架。

有關更多資訊,請參閱Module:category tree/poscatboiler/data/lang-specific/doc

注意:如果您新增了特定語言的模块,請將語言代碼新增至 Module:category tree/poscatboiler/data/lang-specific 頂部的清單中,使程式碼能識別該模块。


local labels = {}
local handlers = {}

local u = mw.ustring.char
local match = mw.ustring.match


for _, pos in ipairs({"名詞", "動詞", "形容詞"}) do
	labels[pos .. " with phonetic respelling"] = {
		description = "{{{langname}}} " .. pos .. " using phonetic respelling in their " ..
			(pos == "動詞" and "變位" or "變格") ..
			" tables due to irregular or unpredictable pronunciations.",
		additional = [=[
===另見===
* [[Wiktionary:印地語轉寫]]
* [[Module:Hi-translit]]]=],
		parents = {
			"依正字法屬性分類的詞", 
			"依音位屬性分類的詞", 
			{name = pos, sort = "phonetic respelling"},
		},
	}
end

--------------------------------- Verbs --------------------------------

labels["compound verbs by base verb"] = {
	description = "{{{langname}}} compound verbs categorized by base verb.",
	parents = {"verbs"},
}

table.insert(handlers, function(data)
	local base_verb = data.label:match("^compound verbs with base verb (.*)$")
	if base_verb then
		local altlink = "{{m|hi||" .. base_verb .. "}}"
		local altlink_no_tr = "{{m|hi||" .. base_verb .. "|tr=-}}"
		return {
			description = "{{{langname}}} compound verbs formed with the base verb {{m|hi|" .. base_verb .. "}}.",
			displaytitle = "{{{langname}}} compound verbs with base verb " .. altlink_no_tr,
			parents = {
				{name = "compound verbs by base verb", sort = base_verb}
			},
			breadcrumb = altlink,
		}
	end
end)


--------------------------------- Nouns --------------------------------

labels["依性別和詞幹分類的名詞"] = {
	description = "{{{langname}}}名詞按照性別和詞幹進行分類。",
	parents = {{name = "名詞", sort = "性別和詞幹"}},
	breadcrumb = "依性別和詞幹分類",
}

labels["有不規則複數詞幹的名詞"] = {
	description = "{{{langname}}} nouns with an irregular plural stem.",
	parents = {{name = "名詞", sort = "irregular plural stem"}},
	breadcrumb = "有不規則複數詞幹",
}

table.insert(handlers, function(data)
	local gender, stem, pos
	gender, stem, pos = data.label:match("^([a-z]+ine) (independent unmarked [^ %-]*%-stem) (.*)s$")
	if not gender then
		gender, stem, pos = data.label:match("^([a-z]+ine) (independent [^ %-]*%-stem) (.*)s$")
	end
	if not gender then
		gender, stem, pos = data.label:match("^([a-z]+ine) (unmarked [^ %-]*%-stem) (.*)s$")
	end
	if not gender then
		gender, stem, pos = match(data.label, "^([陰陽]性)([^ %-]*%-詞幹)(.*)$")
	end
	if gender and pos == "名詞" then
		local desc = "{{{langname}}}" .. gender .. stem .. pos .. "。"
		local additional
		if stem:find("independent") then
			additional = "* Here, 'independent' means that the stem ending directly " ..
			"follows a vowel and so uses the independent Devanagari form of the vowel that begins the ending."
		end
		if stem:find("unmarked") then
			additional = additional and additional .. "\n" or ""
			additional = additional .. "* Here, 'unmarked' means that the endings are added onto the full direct singular form " ..
			"without removing the stem ending (although final nasalization, if present, will move to the ending)."
		end
		return {
			description = desc,
			additional = additional,
			parents = {
				{name = "依性別和詞幹分類的" .. pos, sort = stem:gsub("independent ", ""):gsub("unmarked ", "")}
			},
			breadcrumb = gender .. stem,
		}
	end
end)


--------------------------------- Adjectives --------------------------------

-- vowel diacritics; don't display nicely on their own
local M = u(0x0901)
local N = u(0x0902)
local AA = u(0x093e)
local AAM = AA .. M
local E = u(0x0947)
local EN = E .. N
local II = u(0x0940)
local IIN = II .. N


local adj_decl_endings = {
	["ā-詞幹"] = {AA, E, II},
	["獨立ā-詞幹"] = {"आ", "ए", "ई"},
	["ā̃-詞幹"] = {AAM, EN, IIN},
	["獨立ā̃-詞幹"] = {"आँ", "एँ", "ईं"},
}

labels["依詞幹分類的形容詞"] = {
	description = "{{{langname}}} adjectives categorized by stem type.",
	parents = {{name = "形容詞", sort = "stem type"}},
	breadcrumb = "依詞幹分類",
}

table.insert(handlers, function(data)
	local stem
	stem = data.label:match("^(獨立[^ %-]*%-詞幹)形容詞$")
	if not stem then
		stem = data.label:match("^([^ %-]*%-詞幹)形容詞")
	end
	if stem and adj_decl_endings[stem] then
		local mdir, mop, f = unpack(adj_decl_endings[stem])
		local desc = "{{{langname}}} " .. stem .. " adjectives, ending in " .. mdir ..
			" in the direct masculine singular, in " .. mop .. " in the remaining masculine forms, and in " .. f ..
			" in all feminine forms."
		local additional
		if stem:find("獨立") then
			additional = "* Here, 'independent' means that the stem ending directly " ..
			"follows a vowel and so uses the independent Devanagari form of the vowel that begins the ending."
		end
		return {
			description = desc,
			additional = additional,
			parents = {
				{name = "依詞幹分類的形容詞", sort = stem:gsub("independent ", "")}
			},
			breadcrumb = stem,
		}
	end
end)

return {LABELS = labels, HANDLERS = handlers}