Module:category tree/poscatboiler/data/lang-specific/fi

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module handles generating the descriptions and categorization for Finnish category pages of the format "Finnish LABEL" where LABEL can be any text. Examples are Category:Bulgarian conjugation 2.1 verbs and Category:Russian velar-stem neuter-form nouns. This module is part of the poscatboiler system, which is a general framework for generating the descriptions and categorization of category pages.

For more information, see Module:category tree/poscatboiler/data/lang-specific/documentation.

NOTE: If you add a new language-specific module, you must add the language code to the list at the top of Module:category tree/poscatboiler/data/lang-specific in order for the module to be recognized.


local labels = {}
local handlers = {}

------- Nominal categories -------

labels["nominals by declension"] = {
	description = "{{{langname}}} nouns and adjectives categorized by their declension type.",
	breadcrumb = "by declension",
	preceding = "{{mainapp|Finnish declension}}",
	parents = {
		{name = "nouns", sort = "declension"},
		{name = "adjectives", sort = "declension"},
	},
}

table.insert(handlers, function(data)
	local nomtype = data.label:match("^(.*)%-type nominals$")
	if nomtype then
		return {
			description = ("{{{langname}}} ''%s''-type nominals."):format(nomtype),
			preceding = ("{{mainapp|Finnish declension/%s}}"):format(nomtype),
			breadcrumb = {name = ("''%s''-type"):format(nomtype), nocap = true},
			parents = {"nominals by declension"},
		}
	end
end)

------- Verbal categories -------

labels["verbs by conjugation"] = {
	description = "{{{langname}}} verbs categorized by their conjugation type.",
	breadcrumb = "by conjugation",
	preceding = "{{mainapp|Finnish conjugation}}",
	parents = {
		{name = "verbs", sort = "conjugation"},
	},
}

labels["verbs that lack conjugation type"] = {
	description = "{{{langname}}} verbs that lack conjugation type.",
	parents = {"entry maintenance"},
	hidden = true,
	can_be_empty = true,
}

local ordinal_to_number = {
	first = 1,
	second = 2,
	third = 3,
	fourth = 4,
	fifth = 5,
}

for ordinal, number in pairs(ordinal_to_number) do
	labels[ordinal .. " infinitives"] = {
		description = "{{{langname}}} " .. ordinal .. " infinitives.",
		breadcrumb = ordinal,
		parents = {{name = "infinitives", sort = number}},
		can_be_empty = true,
	}
	labels["long first infinitives"] = {
		description = "{{{langname}}} long first infinitives.",
		additional = "See [[Appendix:Finnish verb forms#First infinitive|this appendix]] for more information.",
		breadcrumb = "long first",
		parents = {{name = "infinitives", sort = 1}},
	}
	labels["active " .. ordinal .. " infinitives"] = {
		description = "{{{langname}}} active " .. ordinal .. " infinitives.",
		breadcrumb = "active",
		parents = {ordinal .. " infinitives"},
	}
	labels["passive " .. ordinal .. " infinitives"] = {
		description = "{{{langname}}} passive " .. ordinal .. " infinitives.",
		breadcrumb = "passive",
		parents = {ordinal .. " infinitives"},
	}
end

labels["verbs by aspect"] = {
	description = "{{{langname}}} verbs categorized by their aspect.",
	breadcrumb = "by aspect",
	preceding = "{{mainapp|Finnish verb aspects}}",
	parents = {
		{name = "verbs", sort = "aspect"},
	},
}

local aspect_spec = {
	{"automative", see_also = {"reflexive", "translative"}},
	{"captative"},
	{"causative", see_also = {"curative", "factive"}},
	{"continuative", see_also = {"frequentative"}},
	{"curative", see_also = {"causative", "factive"}, parent = "causative verbs"},
	{"factive", see_also = {"causative", "curative"}},
	{"frequentative", see_also = {"continuative"}},
	{"momentane"},
	{"reflexive"},
	{"semelfactive"},
	{"translative"},
}

for _, spec in ipairs(aspect_spec) do
	local spectype = spec[1]
	local capfirst = mw.getContentLanguage():ucfirst(spectype)
	local additional
	local parents = {}
	if spec.see_also then
		local additional_cats = {}
		for _, other_aspect in ipairs(spec.see_also) do
			table.insert(additional_cats, ("* [[:Category:Finnish %s verbs]]\n"):format(other_aspect))
		end
		additional = "See also:\n" .. table.concat(additional_cats)
	end
	if spec.parent then
		table.insert(parents, spec.parent)
	end
	table.insert(parents, "verbs by aspect")
	labels[spectype .. " verbs"] = {
		description = ("{{{langname}}} %s verbs."):format(spectype),
		preceding = ("{{also|[[Appendix:Finnish verb aspects#%s|Appendix:Finnish verb aspects § %s]]}}"):format(
			capfirst, capfirst),
		additional = additional,
		breadcrumb = spectype,
		parents = parents,
	}
end

local defective_types = {
	["kaikaa"] = true,
}

table.insert(handlers, function(data)
	local verbtype = data.label:match("^(.*)%-type verbs$")
	if verbtype then
		local parents = {"verbs by conjugation"}
		local addl
		if defective_types[verbtype] then
			table.insert(parents, "defective verbs")
		end
		if verbtype == "kumajaa" then
			addl = "Some ''rohkaista'' -type verbs have a partially alternative conjugation, which is regarded as a poetic variant to the main conjugation. This category contains the entries where this alternative conjugation is indicated to exist."
		end
		return {
			description = ("{{{langname}}} ''%s''-type verbs."):format(verbtype),
			preceding = ("{{mainapp|Finnish conjugation/%s}}"):format(verbtype),
			additional = addl,
			breadcrumb = {name = ("''%s''-type"):format(verbtype), nocap = true},
			parents = parents,
		}
	end
end)

labels["colloquial verb forms"] = {
	description = "{{{langname}}} colloquial verb forms.",
	breadcrumb = "colloquial",
	parents = {"verb forms"},
}

------- Misc categories -------

labels["entries with inflection not matching pagename"] = {
	description = "{{{langname}}} entries which have an inflection table whose lemma form does not match the page name.",
	additional = "This is usually the result of incorrect or missing parameters.",
	breadcrumb = "inflection not matching pagename",
	parents = {{name = "entry maintenance", sort = "inflection not matching pagename"}},
	hidden = true,
	can_be_empty = true,
}

labels["Latinate surnames"] = {
	description = "{{{langname}}} surnames that are formed as if they were names from Latin (often with a suffix like {{m|fi||-(i)us}}).",
	breadcrumb = "Latinate",
	parents = {"surnames"},
}

labels["case suffixes"] = {
	description = "{{{langname}}} case suffixes.",
	breadcrumb = "case",
	parents = {"suffixes"},
}

return {LABELS = labels, HANDLERS = handlers}