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

Модул:number list/data/es

Документацију овог модула можете да направите на страници Модул:number list/data/es/док

local export = {numbers = {}}

local numbers = export.numbers

-- Delete any number types that don't apply.
numbers[0] = {
	cardinal = "cero",
	ordinal = { "cero", "ceroésimo" },
}

numbers[1] = {
	cardinal = "uno",
	ordinal = "primero",
	multiplier = "simple",
	-- adverbial = "",
	-- multiplier = "",
	-- distributive = "",
	-- collective = "",
}

numbers[2] = {
	cardinal = "dos",
	ordinal = "segundo",
	multiplier = "doble",
	fractional = { "medio", "mitad" },
}

numbers[3] = {
	cardinal = "tres",
	ordinal = "tercero",
	multiplier = "triple",
	fractional = "tercio",
}

numbers[4] = {
	cardinal = "cuatro",
	ordinal = "cuarto",
	multiplier = "cuádruple",
	fractional = "cuarto",
}

numbers[5] = {
	cardinal = "cinco",
	ordinal = "quinto",
	multiplier = "quíntuple",
	fractional = "quinto",
}

numbers[6] = {
	cardinal = "seis",
	ordinal = "sexto",
	multiplier = "séxtuple",
	fractional = { "sexto", "seisavo" },
}

numbers[7] = {
	cardinal = "siete",
	ordinal = "séptimo",
	multiplier = "séptuple",
	fractional = "séptimo",
}

numbers[8] = {
	cardinal = "ocho",
	ordinal = "octavo",
	multiplier = "óctuple",
	fractional = "octavo",
}

numbers[9] = {
	cardinal = "nueve",
	ordinal = "noveno",
	multiplier = "nónuple",
	fractional = "noveno",
}

numbers[10] = {
	cardinal = "diez",
	ordinal = "décimo",
	multiplier = "décuplo",
	fractional = "décimo",
}

numbers[11] = {
	cardinal = "once",
	ordinal = { "undécimo", "decimoprimero" },
	multiplier = "undécuple",
	fractional = "onceavo",
}

numbers[12] = {
	cardinal = "doce",
	ordinal = { "duodécimo", "decimosegundo" },
	multiplier = "duodécuple",
	fractional = "doceavo",
}

local compose, decompose = mw.ustring.toNFC, mw.ustring.toNFD

local acute = mw.ustring.char(0x301)
local function remove_accent(word)
	return decompose(word):gsub(acute, "")
end

local ten_ordinal_without_accent = remove_accent(numbers[10].ordinal)
for i, cardinal in ipairs {
	"trece", "catorce", "quince", "dieciséis", "diecisiete", "dieciocho", "diecinueve"
} do
	local num = i + 13 - 1
	local ones = num - 10
	numbers[num] = {
		cardinal = cardinal,
		ordinal = ten_ordinal_without_accent .. numbers[ones].ordinal:gsub("^[aeiou]", ""),
		fractional = remove_accent(cardinal) .. "avo",
	}
end

local function unpack_ipairs(t)
	local i = 0
	return function()
		i = i + 1
		if t[i] then
			return i, unpack(t[i])
		end
	end
end

local function accent_finally(word)
	return compose(decompose(word):gsub(
			"([aeiou])([iu]?[ns]?)$", "%1" .. acute .. "%2"))
end

for i, tens_cardinal, tens_ordinal in unpack_ipairs {
	{ "veinte", "vigésimo" },
	{ "treinta", "trigésimo" },
	{ "cuarenta", "cuadragésimo" },
	{ "cincuenta", "quincuagésimo" },
	{ "sesenta", "sexagésimo" },
	{ "setenta", "septuagésimo" },
	{ "ochenta", "octogésimo" },
	{ "noventa", "nonagésimo" },
} do
	local tens = (i + 1) * 10
	numbers[tens] = {
		cardinal = tens_cardinal,
		ordinal = tens_ordinal,
		fractional = (tens_cardinal .. "avo"):gsub("aa", "a"),
	}
	local prefix = (tens_cardinal .. " y "):gsub("e y $", "i")
	local one_word_cardinal = prefix:sub(-1) ~= " "
	for ones = 1, 9 do
		local ones_cardinal = numbers[ones].cardinal
		local ones_ordinal = numbers[ones].ordinal
		local cardinal = prefix .. ones_cardinal
		local number = {}
		numbers[tens + ones] = number
		number.cardinal = cardinal
		if one_word_cardinal and number.cardinal:sub(-1) == "s" then
			number.cardinal = accent_finally(cardinal)
		end
		number.ordinal = tens_ordinal .. " " .. ones_ordinal
		number.fractional = cardinal:gsub("uno$", "un"):gsub("a y ", "ai") .. "avo"
	end
end

numbers[100] = {
	cardinal = {"cien", "ciento"},
	ordinal = "centésimo",
	multiplier = "céntuplo",
	fractional = {"centésimo", "centavo", "céntimo"},
}

numbers[200] = {
	cardinal = "doscientos",
	ordinal = "ducentésimo",
	fractional = {"doscientosavo", "ducentésimo"},
}

numbers[300] = {
	cardinal = "trescientos",
	ordinal = "tricentésimo",
	fractional = {"trescientosavo", "tricentésimo"},
}

numbers[400] = {
	cardinal = "cuatrocientos",
	ordinal = "cuadringentésimo",
	fractional = {"cuatrocientosavo", "cuadringentésimo"},
}

numbers[500] = {
	cardinal = "quinientos",
	ordinal = "quingentésimo",
	fractional = {"quinientosavo", "quingentésimo"},
}

numbers[600] = {
	cardinal = "seiscientos",
	ordinal = "sexcentésimo",
	fractional = {"seiscientosavo", "sexcentésimo"},
}

numbers[700] = {
	cardinal = "setecientos",
	ordinal = "septingentésimo",
	fractional = {"setecientosavo", "septingentésimo"},
}

numbers[800] = {
	cardinal = "ochocientos",
	ordinal = "octingentésimo",
	fractional = {"ochocientosavo", "octingentésimo"},
}

numbers[900] = {
	cardinal = "novecientos",
	ordinal = "noningentésimo",
	fractional = {"novecientosavo", "noningentésimo"},
}

numbers[1000] = {
	cardinal = "mil",
	ordinal = "milésimo",
	fractional = "milésimo",
}

--[[
numbers[] = {
	cardinal = "",
	ordinal = "",
	fractional = "",
}

numbers[] = {
	cardinal = "",
	ordinal = "",
	fractional = "",
}
--]]

return export