Jump to content

Module:category tree/lang/fi

From Wiktionary, the free dictionary

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 category tree system, which is a general framework for generating the descriptions and categorization of category pages.

For more information, see Module:category tree/lang/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/lang in order for the module to be recognized.


local labels = {}
local handlers = {}

local tag_fi = require("Module:easy tag text")("fi")

------- 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(tag_fi(nomtype, "term")),
			preceding = ("{{mainapp|Finnish declension/%s}}"):format(nomtype),
			breadcrumb = {name = ("%s-type"):format(tag_fi(nomtype, "term")), 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 derivative type"] = {
	description = "{{{langname}}} verbal derivatives categorized by their derivative type.",
	breadcrumb = "by derivative type",
	preceding = "{{mainapp|Finnish verbal derivatives}}",
	parents = {
		{name = "verbs", sort = "derivative type"},
	},
}

local deriv_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(deriv_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_deriv in ipairs(spec.see_also) do
			table.insert(additional_cats, ("* [[:Category:Finnish %s verbs]]\n"):format(other_deriv))
		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 derivative type")
	labels[spectype .. " verbs"] = {
		description = ("{{{langname}}} %s verbs."):format(spectype),
		preceding = ("{{also|[[Appendix:Finnish verbal derivatives#%s|Appendix:Finnish verbal derivatives § %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 %s-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."):format(tag_fi(verbtype, "term"))
		end
		return {
			description = ("{{{langname}}} %s-type verbs."):format(tag_fi(verbtype, "term")),
			preceding = ("{{mainapp|Finnish conjugation/%s}}"):format(verbtype),
			additional = addl,
			breadcrumb = {name = ("%s-type"):format(tag_fi(verbtype, "term")), nocap = true},
			parents = parents,
		}
	end
end)

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

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

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"},
}

labels["prefixlike morphemes"] = {
	description = "{{{langname}}} [[Appendix:Finnish glossary#prefixlike|prefixlike morphemes]]; parts of words that look like prefixes, but are not true prefixes and instead act as modifiers in the compounds that they form.",
	breadcrumb = "prefixlike morphemes",
	parents = {"prefixes"},
}

labels["suffixlike morphemes"] = {
	description = "{{{langname}}} [[Appendix:Finnish glossary#suffixlike|suffixlike morphemes]]; parts of words that look like suffixes, but are not true suffixes and instead act as headwords in the compounds that they form.",
	breadcrumb = "suffixlike morphemes",
	parents = {"suffixes"},
}

return {LABELS = labels, HANDLERS = handlers}