مۆدیوول:category tree/poscatboiler/data/lang-specific/cu

"بەڵگەدارکردنی ئەم مۆدیوولە دەکرێ لە مۆدیوول:category tree/poscatboiler/data/lang-specific/cu/docدا دروست بکرێ"

local labels = {}
local handlers = {}


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

local adj_like_poses = {"adjective", "pronoun", "determiner", "numeral", "suffix"}
for _, pos in ipairs(adj_like_poses) do
	local plpos = require("Module:string utilities").pluralize(pos)
	labels["hard " .. plpos] = {
		description = "{{{langname}}} hard-stem " .. plpos .. ".",
		breadcrumb = "hard",
		parents = {{name = plpos .. " by inflection type", sort = "hard-stem"}},
	}
	labels["soft " .. plpos] = {
		description = "{{{langname}}} soft-stem " .. plpos .. ".",
		breadcrumb = "soft",
		parents = {{name = plpos .. " by inflection type", sort = "soft-stem"}},
	}
	labels[plpos .. " with short forms"] = {
		description = "{{{langname}}} " .. plpos .. " with short-form inflections.",
		breadcrumb = "with short forms",
		parents = {{name = plpos .. " by inflection type", sort = "short forms"}},
	}
end


--------------------------------- Nouns/Pronouns/Numerals --------------------------------

--[=[
Noun declension specifications. The top-level key is the stem class, and the value is an object containing properties of
the stem class. If the stem class contains the word 'GENDER' in it, it expands into labels both for a parent category
that subsumes several genders (obtained by removing the word 'GENDER' and following whitespace) as well as
gender-specific children categories (obtained by replacing the word 'GENDER' with the genders specified in the
`possible_genders` field). The fields of the property object for a given stem class are as follows:
* `gender`: The description of the gender(s) of the stem class. If preceded by ~, the description is preceded by
  "most commonly". This appears in the `additional` field of the label properties. It is not used in gender-specific
  children categories; instead the gender of that category is used.
* `possible_genders`: The possible genders this class occurs in. If this is specified, the word 'GENDER' must occur in
  the stem class, and gender-specific variants of the stem class (with GENDER replaced by the possible genders) are
  handled along with a parent category subsuming all genders. 
* `singular`: The nominative singular ending. Use <...> to enclose Old Church Slavonic text; it will be given the
  appropriate language tag and italicized.
* `GENDER_singular`: The nominative singular ending for the GENDER variant of this stem class. If not specified, the
  value of `singular` is used.
* `plural`: The nominative plural ending.
* `GENDER_singular`: The nominative plural ending for the GENDER variant of this stem class. If not specified, the
  value of `plural` is used.
* `breadcrumb`: The breadcrumb for the category, appearing in the trail of breadcrumbs at the top of the page. If this
  stem has gender-specific variants, the breadcrumb specified here is used only for the parent category, while the
  gender-specific child categories use the gender as the breadcrumb. If not specified, it defaults to `sortkey`. If that
  is also not specified, or if the breadcrumb has the value "+", the stem class (without the word 'GENDER') is used.
  (Use "+" when a sortkey is specified but the stem class should be used as the breadcrumb.)
* `parent`: The parent category. If specified, the actual category label is formed by appending the part of speech (e.g.
  "nouns"). Defaults to "POS by inflection type" where POS is the part of speech. Note that gender-specific child
  categories do not use this, but always have the gender-subsuming parent stem class category as their parent.
* `sortkey`: The sort key used for sorting this category among its parent's children. Defaults to the stem class
  (without the word 'GENDER'). Note that gender-specific child categories do nto use this, but always use the gender
  as the sort key.
]=]
local noun_decls = {
	["hard GENDER a-stem"] = {
		gender = "~feminine",
		possible_genders = {"masculine", "feminine"},
		singular = "<-а>",
		plural = "<-ꙑ>",
		breadcrumb = "+",
		sortkey = "a-stem",
	},
	["soft GENDER a-stem"] = {
		gender = "~feminine",
		possible_genders = {"masculine", "feminine"},
		singular = "<-ꙗ> (or <-а> after an unpaired palatal consonant), or <-ꙑни>, or sometimes <-ии>/<-ьи>",
		masculine_singular = "<-ꙗ> (or <-а> after an unpaired palatal consonant), or <-ии>/<-ьи>",
		plural = "<-ѩ> (or <-ѧ> after an unpaired palatal consonant)",
		breadcrumb = "+",
		sortkey = "a-stem",
	},
	["GENDER i-stem"] = {
		gender = "~feminine (sometimes masculine)",
		possible_genders = {"masculine", "feminine"},
		singular = "<-ь>",
		plural = "<-и> (usually <-ьѥ> or <-иѥ> when masculine)",
		masculine_plural = "<-ьѥ> or <-иѥ>",
		feminine_plural = "<-и>",
	},
	["GENDER ī-stem"] = {
		gender = "~feminine (masculine when referring to a person)",
		possible_genders = {"masculine", "feminine"},
		singular = "<-ии> or <-ьи>",
		plural = "<-иѭ> or <-ьѩ>",
		parent = "soft a-stem",
	},
	["hard GENDER o-stem"] = {
		gender = "masculine or neuter",
		possible_genders = {"masculine", "neuter"},
		singular = "<-ъ> when masculine, <-о> when neuter",
		masculine_singular = "<-ъ>",
		neuter_singular = "<-о>",
		plural = "<-и> when masculine, <-а> when neuter",
		masculine_plural = "<-и>",
		neuter_plural = "<-а>",
		breadcrumb = "+",
		sortkey = "o-stem",
	},
	["soft GENDER o-stem"] = {
		gender = "masculine or neuter",
		possible_genders = {"masculine", "neuter"},
		singular = "<-ь> when masculine, <-ѥ> (or <-е> after an unpaired palatal consonant) when neuter",
		masculine_singular = "<-ь>",
		neuter_singular = "<-ѥ> (or <-е> after an unpaired palatal consonant)",
		plural = "<-и> when masculine, <-ꙗ> (or <-а> after an unpaired palatal consonant) when neuter",
		masculine_plural = "<-и>",
		neuter_plural = "<-ꙗ> (or <-а> after an unpaired palatal consonant)",
		breadcrumb = "+",
		sortkey = "o-stem",
	},
	["u-stem"] = {
		gender = "~masculine",
		singular = "<-ъ>",
		plural = "<-ове>",
	},
	["GENDER n-stem"] = {
		gender = "~masculine (nouns in <-мѧ> are neuter)",
		possible_genders = {"masculine", "neuter"},
		singular = "<-ꙑ>, <-нь>, or <-мѧ>",
		masculine_singular = "<-ꙑ> or <-нь>",
		neuter_singular = "<-мѧ>",
		plural = "<-не> (or <-мена> if ending in <-мѧ)>",
		masculine_plural = "<-не>",
		neuter_plural = "<-мена>",
		parent = "consonant-stem",
	},
	["nt-stem"] = {
		gender = "~neuter",
		singular = "<-ѧ>",
		plural = "<-ѧта>",
		parent = "consonant-stem",
	},
	["r-stem"] = {
		gender = "~feminine",
		singular = "<-и>",
		plural = "<-ери>",
		parent = "consonant-stem",
	},
	["s-stem"] = {
		gender = "~neuter",
		singular = "<-о> (<-е> after a palatal consonant)",
		plural = "<-еса>",
		parent = "consonant-stem",
	},
	["v-stem"] = {
		gender = "~feminine",
		singular = "<-ꙑ>",
		plural = "<-ъви>",
		parent = "consonant-stem",
	},
}

for _, pos in ipairs({"nouns"}) do
	local sgpos = pos:gsub("s$", "")
	labels["consonant-stem " .. pos] = {
		description = "{{{langname}}} consonant-stem " .. pos .. ".",
		additional = "This is not a single declension class, but a set of related declension classes, with endings that are"
			.. " largely identical outside of the nominative, accusative and vocative.",
		breadcrumb = "consonant-stem",
		parents = pos .. " by inflection type",
	}
	local function mark_ending(ending)
		return (ending:gsub("<(.-)>", "{{m|cu||%1|tr=-}}"))
	end
	for full_decl, spec in pairs(noun_decls) do
		local most_commonly, gender = spec.gender:match("^(~)(.*)$")
		gender = gender or spec.gender
		local subgenders = spec.possible_genders
		local decl
		if subgenders then
			if not full_decl:find("GENDER") then
				error(("Internal error: Declension spec '%s' needs to have the word 'GENDER' in it, in all caps"):format(full_decl))
			end
			decl = full_decl:gsub("GENDER ", "")
		else
			decl = full_decl
		end
		local breadcrumb = spec.breadcrumb or spec.sortkey or "+"
		if breadcrumb == "+" then
			breadcrumb = decl
		end
		labels[decl .. " " .. pos] = {
			description = "{{{langname}}} " .. decl .. " " .. pos .. ".",
			additional = ("These %s normally end in the singular in %s; in the plural in %s; and are %s%s."):format(
				pos, mark_ending(spec.singular), mark_ending(spec.plural), most_commonly and "most commonly " or "",
				mark_ending(gender)),
			breadcrumb = breadcrumb,
			parents = {{
				name = spec.parent and spec.parent .. " " .. pos or pos .. " by inflection type",
				sort = spec.sortkey or decl,
			}},
		}
		if subgenders then
			for _, subgender in ipairs(subgenders) do
				local gender_decl = full_decl:gsub("GENDER", subgender)
				labels[gender_decl .. " " .. pos] = {
					description = "{{{langname}}} " .. gender_decl .. " " .. pos .. ".",
					additional = ("These %s normally end in the singular in %s; in the plural in %s; and are %s."):format(
						pos, mark_ending(spec[subgender .. "_singular"] or spec.singular),
						mark_ending(spec[subgender .. "_plural"] or spec.plural), subgender),
					breadcrumb = subgender,
					parents = {{
						name = decl .. " " .. pos,
						sort = subgender,
					}},
				}
			end
		end
	end
end


return {LABELS = labels, HANDLERS = handlers}