Пређи на садржај

Модул:category tree/topic cat/data/Места

Документацију овог модула можете да направите на страници Модул:category tree/topic cat/data/Места/док

local labels = {}
local handlers = {}

local m_shared = require("Модул:place/shared-data")
local m_strutils = require("Модул:string utilities")

--[=[

This module contains specifications that are used to create labels that allow {{auto cat}} and
{{topic cat}} to create the appropriate definitions for topic categories for places (e.g.re
'en:Waterfalls', 'de:Hokkaido', 'es:Cities in France', 'pt:Municipalities of Tocantins, Brazil',
etc.). Note that this module doesn't actually create the categories; that must be done manually,
with the text "{{auto cat}}" as the definition of the category. (This process should automatically
happen periodically for non-empty categories, because they will appear in [[Special:WantedCategories]]
and a bot will periodically examine that list and create any needed category.)

There are two ways that such labels are created: (1) by manually adding an entry to the 'labels'
table, keyed by the label (minus the language code) with a value consisting of a Lua table
specifying the description text and the category's parents; (2) through handlers (pieces of
Lua code) added to the 'handlers' list, which recognize labels of a specific type (e.g.
'Cities in France') and generate the appropriate specification for that label on-the-fly.
]=]

local function lcfirst(label)
	return mw.getContentLanguage():lcfirst(label)
end

labels["места"] = {
	type = "name",
	description = "{{{langname}}} names for geographical [[place]]s; [[toponym]]s.",
	parents = {"имена"},
}

local general_labels = {
		{"брда", {"места"}},
		{"градови", {"полиси"}},
		{"главни градови", {"градови"}, "[[capital]] [[city|cities]]: the [[seat of government|seats of government]] for a country or [[political]] [[subdivision]] of a country"},
		{"континенти", {"места"}, "the [[continent]]s of the world"},
		{"полиси", {"места"}, "[[polity|polities]] or [[political]] [[division]]s"}
}
-- Generate bare labels in 'label' for all "general labels" (see above).
for _, label_spec in ipairs(general_labels) do
	local label, parents, desc, commonscat, wpcat = unpack(label_spec)
	desc = m_shared.format_description(desc, label)
	labels[label] = {
		type = "name",
		description = "{{{langname}}} names of " .. desc .. ".",
		parents = parents,
		commonscat = commonscat == nil and true or commonscat,
		wpcat = wpcat == nil and true or wpcat,
	}
end


return {LABELS = labels, HANDLERS = handlers}