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."
	},
	
	["datetime"] =
	{
		-- $1 is a placeholder for the actual number, or use the format of #time parser function
		["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
		
		[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
		[6] = 'xrY". milurtekoa"',		-- precision: millennium
		[7] = 'xrY". mendea"',			-- precision: century
		[8] = "$1(e)ko hamarkada",		-- precision: decade
		[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,
		
		["hms"] = {["hours"] = " h", ["minutes"] = " m", ["seconds"] = " s"},	-- duration: x h x m x s			
	},
	
	["years-old"] = {
		["singular"] = "year old",	-- year old, as in {{PLURAL:$1|singular|plural}}
		["plural"] = "years old",	-- years old
		["paucal"] = "",			-- for languages with 3 plural forms as in {{PLURAL:$1|singular|paucal|plural}}
	},
	
	["cite"] = {					-- cite parameters of local templates
		["title"] = "izenburua",
		["author"] = "egilea",
		["date"] = "data",
		["pages"] = "orrialdea",
		["language"] = "hizkuntza",
		-- cite web parameters
		["url"] = "url",
		["website"] = "lana",
		["access-date"] = "sarrera-data",
		["archive-url"] = "artxibo-url",
		["archive-date"] = "artxibo-data",
		["publisher"] = "editorea",
		["quote"] = "aipua",
		-- cite journal parameters
		["work"] = "work",
		["issue"] = "issue",
		["issn"] = "issn",
		["doi"] = "doi"
	},

	-- local wiki settings
	["addpencil"] = false, -- adds a pencil icon linked to Wikidata statement, planned to overwrite by Wikidata Bridge
	["categorylabels"] = "", -- Category:Pages with Wikidata labels not translated (void for no local category)
	["addfallback"] = {} -- additional fallback language codes, i.e. {'sv', 'de'}
}

-- 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,
	["infoboxdata"] = function(word) return require("Module:Wikidata/labels").fixInfoboxData(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,
	["lokatibo"] = function(word, ...) if arg[1] == "eu" then return require("Module:Declension").locative(word) end return word end
}

return {
	i18n = i18n,
	cases = cases
}