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


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 rfind = mw.ustring.find
local rmatch = mw.ustring.match

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

labels["adjectives by stem type and stress"] = {
	description = "Carpathian Rusyn adjectives categorized by stem type and stress. " ..
		"Unlike for nouns, adjectives are consistently either stem-stressed or ending-stressed.",
	parents = {{name = "adjectives by inflection type", sort = "stem type and stress"}},
}


local adj_stem_expl = {
	["soft-stem"] = "a soft consonant",
	["hard-stem"] = "a hard consonant",
	["possessive"] = "-їв, -ів or -ин",
}

local adj_decl_endings = {
	["hard stem-stressed"] = {"-ый", "-а", "-е", "-ы"},
	["hard ending-stressed"] = {"-ы́й", "-а́", "-е́", "-ы́"},
	["soft"] = {"-їй/ій", "-я", "-є", "-ї"},
	["possessive"] = {"-", "-а", "-е", "-ы"},
}

table.insert(handlers, function(data)
	-- FIXME! Harmonize stem types here with stem types in 'adj_decl_endings' (used
	-- directly in adjectival nouns).
	local function stem_to_ending_type(stem, stress)
		if stem == "hard-stem" and stress == "stem" then
			return "hard stem-stressed"
		elseif stem == "hard-stem" and stress == "ending" then
			return "hard ending-stressed"
		elseif stress == "" then
			if stem == "soft-stem" then
				return "soft"
			elseif stem == "possessive" then
				return "possessive"
			end
		end
		return nil
	end

	local breadcrumb, stem, stress = rmatch(data.label, "^(([^ ]*) ([^ *]*)-stressed) adjectives")
	if not breadcrumb then
		breadcrumb, stem = rmatch(data.label, "^(([^ ]*)) adjectives")
		stress = ""
	end
	if breadcrumb then
		local ending_type = stem_to_ending_type(stem, stress)
		if ending_type and adj_stem_expl[stem] then
			local m, f, n, p = unpack(adj_decl_endings[ending_type])
			local stresstext = stress == "stem" and
				"The adjectives in this category have stress on the stem." or
				stress == "ending" and
				"The adjectives in this category have stress on the endings." or
				"All adjectives of this type have stress on the stem."
			local endingtext = "ending in the nominative in masculine singular " .. m ..
				", feminine singular " .. f .. ", neuter singular " .. p .. " and plural " ..
				p .. "."
			local stemtext = " The stem ends in " .. adj_stem_expl[stem] .. "."
			return {
				description = "Carpathian Rusyn " .. stem .. " adjectives, " .. endingtext .. stemtext .. " " .. stresstext,
				breadcrumb = breadcrumb,
				parents = {"adjectives by stem type and stress"},
			}
		end
	end
end)


return {LABELS = labels, HANDLERS = handlers}