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


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 = {}


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

labels["irregularly declined borrowed nouns"] = {
	description = "{{{langname}}} loanwords with irregular declension.",
	breadcrumb = "borrowed nouns",
	parents = {{name = "irregular nouns", sort = "borrowed nouns"}},
}

labels["n-stem nouns"] = {
	description = "{{{langname}}} ''n''-stem nouns, deriving from Proto-Indo-European ''n''-stem nouns.",
	displaytitle = "{{{langname}}} ''n''-stem nouns",
	additional = "This is not a single class in Gothic, but several related gender-differentiated classes.",
	breadcrumb = "''n''-stem",
	parents = {"nouns by inflection type"},
}

--[=[
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 stem class can contain literal Latin-script text (e.g. suffixes), which will be
italicized in breadcrumbs and titles. 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. 
* `nom_sg`: The nominative singular ending. Use <...> to enclose literal Latin-script text (e.g. suffixes), which will
  be italicized. Prefix with an ! to replace the entire text with the specified text; otherwise the ending will be
  prefixed with "end in the nominative singular in ".
* `GENDER_nom_sg`: The nominative singular ending for the GENDER variant of this stem class. If not specified, the
  value of `nom_sg` is used.
* `gen_sg`: The genitive singular ending. Conventions are the same as for `nom_sg`.
* `GENDER_gen_sg`: The genitive singular ending for the GENDER variant of this stem class. If not specified, the value
  of `gen_sg` is used.
* `nom_pl`: The nominative plural ending. Conventions are the same as for `nom_sg`.
* `GENDER_nom_pl`: The nominative plural ending for the GENDER variant of this stem class. If not specified, the value
  of `nom_pl` 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 or categories. 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 = {
	["GENDER <a>-stem"] = {
		gender = "masculine or neuter",
		possible_genders = {"masculine", "neuter"},
		nom_sg = "<-s> when masculine, the bare stem when neuter",
		masculine_nom_sg = "<-s>",
		neuter_nom_sg = "the bare stem",
		gen_sg = "<-is>",
		nom_pl = "<-ōs> when masculine, <-a> when neuter",
		masculine_nom_pl = "<-ōs>",
		neuter_nom_pl = "<-a>",
	},
	["GENDER <i>-stem"] = {
		gender = "masculine or feminine",
		possible_genders = {"masculine", "feminine"},
		nom_sg = "<-s>",
		gen_sg = "<-is> when masculine, <-ais> when feminine",
		masculine_gen_sg = "<-is>",
		feminine_gen_sg = "<-ais>",
		nom_pl = "<-eis>",
	},
	["GENDER <an>-stem"] = {
		gender = "masculine or neuter",
		possible_genders = {"masculine", "neuter"},
		nom_sg = "<-a> when masculine, <-ō> when neuter",
		masculine_nom_sg = "<-a>",
		neuter_nom_sg = "<-ō>",
		gen_sg = "<-ins>",
		nom_pl = "<-ans> when masculine, <-ōna> when neuter",
		masculine_nom_pl = "<-ans>",
		neuter_nom_pl = "<-ōna>",
		parent = "n-stem",
	},
	["<īn>-stem"] = {
		gender = "feminine",
		nom_sg = "<-ei>",
		gen_sg = "<-eins>",
		nom_pl = "<-eins>",
		parent = "n-stem",
	},
	["<ōn>-stem"] = {
		gender = "feminine",
		nom_sg = "<-ō>",
		gen_sg = "<-ōns>",
		nom_pl = "<-ōns>",
		parent = "n-stem",
	},
	["<nd>-stem"] = {
		gender = "masculine",
		nom_sg = "<-nds>",
		gen_sg = "<-ndis>",
		nom_pl = "<-nds>",
	},
	["GENDER <u>-stem"] = {
		gender = "masculine/feminine or neuter",
		possible_genders = {"masculine/feminine", "neuter"},
		nom_sg = "<-us> when masculine or feminine, <-u> when neuter",
		["masculine/feminine_nom_sg"] = "<-us>",
		neuter_nom_sg = "<-u>",
		gen_sg = "<-aus>",
		nom_pl = "<-jus> when masculine or feminine and are unattested in the plural when neuter",
		["masculine/feminine_nom_pl"] = "<-jus>",
		neuter_nom_pl = "!are unattested in the plural",
	},
	["consonant stem"] = {
		gender = "masculine or feminine",
		nom_sg = "<-s>",
		gen_sg = "<-s>",
		nom_pl = "<-s>",
	},
	["<r>-stem"] = {
		gender = "masculine or feminine",
		nom_sg = "<-ar>",
		gen_sg = "<-rs>",
		nom_pl = "<-rjus>",
	},
	["<ō>-stem"] = {
		gender = "feminine",
		nom_sg = "<-a> (<-i> for <jō>-stems with heavy roots)",
		gen_sg = "<-ōs>",
		nom_pl = "<-ōs>",
	},
	["<i>/<ō>-stem"] = {
		gender = "feminine",
		nom_sg = "<-eins>",
		gen_sg = "<-einais>",
		nom_pl = "<-einōs>",
		parent = {"feminine i-stem", "ō-stem"},
	},
}

for _, pos in ipairs({"nouns"}) do
	local sgpos = pos:gsub("s$", "")
	local function mark_spec_with_literal_text(ending_spec)
		return ending_spec:gsub("<(.-)>", "''%1''")
	end
	local function make_spec_bare(ending_spec)
		return ending_spec:gsub("<(.-)>", "%1")
	end
	local function process_ending(ending_spec, slot)
		local no_prefix, bare_ending = ending_spec:match("^(!?)(.*)$")
		if no_prefix == "!" then
			pretext = ""
		else
			pretext = ("end in the %s in "):format(slot)
		end
		return pretext .. mark_spec_with_literal_text(bare_ending)
	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
		local marked_up_desc = "{{{langname}}} " .. mark_spec_with_literal_text(decl) .. " " .. pos
		local parents = {}
		local spec_parents = spec.parent
		if type(spec_parents) == "string" then
			spec_parents = {spec_parents}
		end
		local parent_sort = make_spec_bare(spec.sortkey or decl)
		if spec_parents then
			for _, parent in ipairs(spec_parents) do
				table.insert(parents, {name = parent .. " " .. pos, sort = parent_sort})
			end
		else
			table.insert(parents, {name = pos .. " by inflection type", sort = parent_sort})
		end
		labels[make_spec_bare(decl) .. " " .. pos] = {
			description = marked_up_desc .. ".",
			displaytitle = marked_up_desc,
			additional = ("These %s normally %s; %s; %s; and are %s%s."):format(pos,
				process_ending(spec.nom_sg, "nominative singular"),
				process_ending(spec.gen_sg, "genitive singular"),
				process_ending(spec.nom_pl, "nominative plural"),
				most_commonly and "most commonly " or "", mark_spec_with_literal_text(gender)),
			breadcrumb = mark_spec_with_literal_text(breadcrumb),
			parents = parents,
		}
		if subgenders then
			for _, subgender in ipairs(subgenders) do
				local gender_decl = full_decl:gsub("GENDER", subgender)
				local marked_up_gender_desc = "{{{langname}}} " .. mark_spec_with_literal_text(gender_decl) .. " " ..
					pos
				labels[make_spec_bare(gender_decl) .. " " .. pos] = {
					description = marked_up_gender_desc .. ".",
					displaytitle = marked_up_gender_desc,
					additional = ("These %s normally %s; %s; %s; and are %s."):format(pos,
						process_ending(spec[subgender .. "_nom_sg"] or spec.nom_sg, "nominative singular"),
						process_ending(spec[subgender .. "_gen_sg"] or spec.gen_sg, "genitive singular"),
						process_ending(spec[subgender .. "_nom_pl"] or spec.gen_sg, "nominative plural"),
						subgender),
					breadcrumb = subgender,
					parents = {{
						name = make_spec_bare(decl) .. " " .. pos,
						sort = subgender,
					}},
				}
			end
		end
	end
end


return {LABELS = labels}