Module:Wd/i18n

Uit Wiki Raamsdonks Erfgoed
Versie door Colani (overleg | bijdragen) op 21 nov 2024 om 10:09 (1 versie geïmporteerd)
(wijz) ← Oudere versie | Huidige versie (wijz) | Nieuwere versie → (wijz)

Deze submodule wordt gebruikt door Module:Wd voor internationalisatiedoeleinden (internationalization, i18n) en is afgescheiden om het mogelijk te maken de modules logica te updaten onafhankelijk van de taalinstelling.


-- The values and functions in this submodule should be localized per wiki.

local p = {}

function p.init(aliasesP)
	p = {
		["errors"] = {
			["unknown-data-type"]          = "Datatype '$1' is onbekend of wordt niet ondersteund.",
			["missing-required-parameter"] = "geen verplichte parameters gedefinieerd, ten minste één benodigd.",
			["extra-required-parameter"]   = "parameter '$1' moet worden gedefinieerd als zijnde optioneel.",
			["no-function-specified"]      = "u moet een aan te roepen functie opgeven.",  -- equal to the standard module error message
			["main-called-twice"]          = 'de functie "main" kan niet twee keer worden aangeroepen.',
			["no-such-function"]           = 'de functie "$1" bestaat niet.'  -- equal to the standard module error message
		},
		["info"] = {
			["edit-on-wikidata"] = "Bewerken op Wikidata"
		},
		["numeric"] = {
			["decimal-mark"] = ",",
			["delimiter"]    = "."
		},
		["datetime"] = {
			["prefixes"] = {
				["decade-period"] = "jaren "
			},
			["suffixes"] = {
				["decade-period"] = "",
				["millennium"]    = " millennium",
				["century"]       = " eeuw",
				["million-years"] = " miljoen jaar",
				["billion-years"] = " miljard jaar",
				["year"]          = " jaar",
				["years"]         = " jaar"
			},
			["julian-calendar"] = "Juliaanse kalender",  -- linked page title
			["julian"]          = "Juliaans",
			["BCE"]             = "v.g.j.",
			["CE"]              = "g.j.",
			["common-era"]      = "Gangbare jaartelling"  -- linked page title
		},
		["coord"] = {
			["latitude-north"] = "NB",
			["latitude-south"] = "ZB",
			["longitude-east"] = "OL",
			["longitude-west"] = "WL",
			["degrees"]        = "°",
			["minutes"]        = "'",
			["seconds"]        = '"',
			["separator"]      = ", "
		},
		["values"] = {
			["unknown"] = "onbekend",
			["none"]    = "geen"
		},
		["cite"] = {
			["version"] = "2",  -- increment this each time the below parameters are changed to avoid conflict errors
			["web"] = {
				-- <= left side: all allowed reference properties for *web page sources* per https://www.wikidata.org/wiki/Help:Sources
				-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite web]] (if non-existent, keep empty i.e. "")
				[aliasesP.statedIn]        = "website",
				[aliasesP.referenceURL]    = "url",
				[aliasesP.publicationDate] = "datum",
				[aliasesP.retrieved]       = "bezochtdatum",
				[aliasesP.title]           = "titel",
				[aliasesP.archiveURL]      = "archiefurl",
				[aliasesP.archiveDate]     = "archiefdatum",
				[aliasesP.language]        = "",
				[aliasesP.author]          = "auteur",  -- existence of author1, author2, author3, etc. is assumed
				[aliasesP.publisher]       = "uitgever",
				[aliasesP.quote]           = "citaat",
				[aliasesP.pages]           = "paginas"  -- extra option
			},
			["q"] = {
				-- <= left side: all allowed reference properties for *sources other than web pages* per https://www.wikidata.org/wiki/Help:Sources
				-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite Q]] (if non-existent, keep empty i.e. "")
				[aliasesP.statedIn]                = "",
				[aliasesP.pages]                   = "",
				[aliasesP.column]                  = "",
				[aliasesP.chapter]                 = "",
				[aliasesP.sectionVerseOrParagraph] = "",
				["external-id"]                    = "",  -- used for any type of database property ID
				[aliasesP.title]                   = "",
				[aliasesP.publicationDate]         = "",
				[aliasesP.retrieved]               = ""
			}
		}
	}

	p.getOrdinalSuffix = function(num)
		if num == 0 then
			return "de"
		end

		num = tonumber(tostring(math.abs(num)):sub(-2))

		if num == 1 or num == 8 then
			return "ste"
		end

		if num > 0 and num < 20 then
			return "de"
		end

		return "ste"
	end

	p.addDelimiters = function(n)
		local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")

		if left and num and right then
			return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. p['numeric']['delimiter']):reverse()) .. right
		else
			return n
		end
	end

	return p
end

return p