Documentation for this module may be created at Modulu:Wikidata/i18n/dok

-- Translations, local configuration and local specific functions

local function timeYearGenitive(year)
	local bc = string.sub(year, 1, 1) == '-'
	year = string.sub(year, 2)
	local year_suffix = '"ko"'
	if math.fmod(year, 20) == 1 or math.fmod(year, 20) == 10 or math.fmod(year, 20) == 5 or math.fmod(year, 20) == 15  or math.fmod(year, 200) == 100 then
		year_suffix = '"eko"'
	end
	return (bc and 'Y' or '"[["Y"]]"') .. year_suffix
end

-- Please translate to local language
local i18n = {
	["errors"] = {
		["property-not-found"] = "Propietatea ez da aurkitu.",
		["qualifier-not-found"] = "Kualifikatzailea ez da aurkitu.",
		['not-from-content-page'] = "Ez inbokatu eduki orrialde batetik. Erabili txantiloi bat edo modulu azpi orrialde bat, edo proba orri bat saiakerak egiteko."
	},
	["datetime"] =
	{
		-- $1 is a placeholder for the actual number
		[0] = "$1 mila milioi urte",	-- precision: billion years
		[1] = "$100 milioi urte",		-- precision: hundred million years
		[2] = "$10 milioi urte",		-- precision: ten million years
		[3] = "$1 milioi urte",			-- precision: million years
		[4] = "$100000 urte",			-- precision: hundred thousand years; thousand separators added afterwards
		[5] = "$10000 urte",			-- precision: ten thousand years; thousand separators added afterwards
		[8] = "$1(e)ko hamarkada",		-- precision: decade
		-- the following use the format of #time parser function
		[6] = 'xrY". milurtekoa"',		-- precision: millennium
		[7] = 'xrY". mendea"',			-- precision: century
		[9]  = "Y",						-- precision: year
		[10] = function (ts)			-- precision: month
					-- format 'Y F' with year in genitive
					local year = string.match(ts, "([+-]%d+)")
					return timeYearGenitive(year) .. ' "[["F"]]"'
				end,
		[11] = function (ts)			-- precision: day
					-- format 'Y F j' with declension suffixes
					local year, day = string.match(ts, "([+-]%d+)\-%d+\-(%d+)T") -- timestamp: "+1582-10-04T00:00:00Z"
					local day_suffix = '"a"'
					if day == '11' or day == '31' then
						day_suffix = ''
					end
					return timeYearGenitive(year) .. ' "[["F"ren" j"]]"' .. day_suffix
				end,
		["beforenow"] = "duela $1",		-- how to format negative numbers for precisions 0 to 5
		["afternow"] = "$1 barru",		-- how to format positive numbers for precisions 0 to 5
		["bc"] = 'K. a. $1',			-- how print negative years
		["ad"] = "$1",					-- how print 1st century AD dates
	},
	["monolingualtext"] = '<span lang="%language">%text</span>',
	
	["cite"] = {					-- Cite web parameters
		["url"]          = "url",
		["title"]        = "izenburua",
		["website"]      = "lana",
		["access-date"]  = "sarrera-data",
		["archive-url"]  = "artxibo-url",
		["archive-date"] = "artxibo-data",
		["author"]       = "egilea",
		["publisher"]    = "editorea",
		["quote"]        = "aipua",
		["language"]     = "hizkuntza",
		["date"]         = "data",
		["pages"]        = "orrialdea"
	}
}

-- Functions for local grammatical cases
-- three dots syntax: ...=arg{}, arg[1]=lang, arg[2]=other
local cases = {
	["infoboxlabel"] = function(word) return require("Module:Wikidata/labels").fixInfoboxLabel(word) end,
	["singularra"] = function(word, ...) if arg[1] == "eu" then return require("Module:Declension").absolutive_singular(word) end return word end,
	["plurala"] = function(word, ...) if arg[1] == "eu" then return require("Module:Declension").absolutive_plural(word) end return word end,
	["ergatiboa"] = function(word, ...) if arg[1] == "eu" then return require("Module:Declension").ergative(word) end return word end,
	["genitiboa"] = function(word, ...) if arg[1] == "eu" then return require("Module:Declension").genitive(word) end return word end,
	["zerekiko"] = function(word, ...) if arg[1] == "eu" then return require("Module:Declension").zerekiko(word) end return word end
}

return {
	i18n = i18n,
	cases = cases
}