Module:Number list/data/fr

local export = {numbers = {}}

local numbers = export.numbers

-- Delete any number types that don't apply. -- template numbers[1] = {	cardinal = "",	ordinal = "",	adverbial = "",	multiplier = "",	distributive = "",	collective = "",	fractional = "", }

numbers[0] = { cardinal = "zéro", ordinal = "zéroième", }

numbers[1] = { cardinal = "un", ordinal = "premier", multiplier = "simple", }

numbers[2] = { cardinal = "deux", ordinal = {"deuxième", "second"}, fractional = {"demi", "moitié"}, multiplier = "double", }

numbers[3] = { cardinal = "trois", ordinal = "troisième", fractional = "tiers", multiplier = "triple", }

numbers[4] = { cardinal = "quatre", ordinal = "quatrième", fractional = "quart", multiplier = "quadruple", }

numbers[5] = { cardinal = "cinq", ordinal = "cinquième", multiplier = "quintuple", }

numbers[6] = { cardinal = "six", ordinal = "sixième", multiplier = "sextuple", }

numbers[7] = { cardinal = "sept", ordinal = "septième", multiplier = "septuple", }

numbers[8] = { cardinal = "huit", ordinal = "huitième", multiplier = "octuple", }

numbers[9] = { cardinal = "neuf", ordinal = "neuvième", multiplier = "nonuple", }

numbers[10] = { cardinal = "dix", ordinal = "dixième", multiplier = "décuple", }

numbers[11] = { cardinal = "onze", ordinal = "onzième", }

numbers[12] = { cardinal = "douze", ordinal = "douzième", }

numbers[13] = { cardinal = "treize", ordinal = "treizième", }

numbers[14] = { cardinal = "quatorze", ordinal = "quatorzième", }

numbers[15] = { cardinal = "quinze", ordinal = "quinzième", }

numbers[16] = { cardinal = "seize", ordinal = "seizième", }

numbers[17] = { cardinal = "dix-sept", ordinal = "dix-septième", }

numbers[18] = { cardinal = "dix-huit", ordinal = "dix-huitième", }

numbers[19] = { cardinal = "dix-neuf", ordinal = "dix-neuvième", }

numbers[20] = { cardinal = "vingt", ordinal = "vingtième", }

numbers[30] = { cardinal = "trente", ordinal = "trentième", }

numbers[40] = { cardinal = "quarante", ordinal = "quarantième", }

numbers[50] = { cardinal = "cinquante", ordinal = "cinquantième", }

numbers[60] = { cardinal = "soixante", ordinal = "soixantième", }

numbers[70] = { cardinal = {"soixante-dix", "septante"}, ordinal = {"soixante-dixième", "septantième"}, }

numbers[80] = { cardinal = {"quatre-vingts", "huitante", "octante"}, ordinal = {"quatre-vingtième", "huitantième", "octantième"}, }

numbers[90] = { cardinal = {"quatre-vingt-dix", "nonante"}, ordinal = {"quatre-vingt-dixième", "nonantième"}, }

local function first_element_if_table(t) if type(t) == "table" then return t[1] else return t	end end

local function add_subtable(t, key) local subtable = t[key] if not subtable then subtable = {} t[key] = subtable end return subtable end

-- Insert val into subtable indexed by key, creating subtable if necessary. local function insert_into_subtable(t, key, val) local subtable = add_subtable(t, key) table.insert(subtable, val) end

-- Generate the vigesimal numerals for 71-79 and 91-99 -- by adding "teens" numerals for these "twenties". local twenties_numerals = { [60] = "soixante", [80] = "quatre-vingt", } for twenties, twenties_cardinal in pairs(twenties_numerals) do	for teens = 11, 19 do		local teens_numeral = numbers[teens] local number = add_subtable(numbers, twenties + teens) if teens == 11 and twenties_cardinal ~= "quatre-vingt" then insert_into_subtable(number, "cardinal", twenties_cardinal .. "-et-onze") else insert_into_subtable(number, "cardinal", twenties_cardinal .. "-" .. first_element_if_table(teens_numeral.cardinal)) end insert_into_subtable(number, "ordinal", twenties_cardinal .. "-" .. first_element_if_table(teens_numeral.ordinal)) end end

local function tableify(val) if type(val) ~= "table" then return {val} else return val end end

-- Add the decimal numerals for 21-99, -- inserting them after the vigesimal numerals if those are present. for tens = 20, 90, 10 do	for _, tens_cardinal in ipairs(tableify(numbers[tens].cardinal)) do		if not tens_cardinal:find "%-dix$" then if tens_cardinal == "quatre-vingts" then tens_cardinal = "quatre-vingt" end for ones = 1, 9 do				local number = add_subtable(numbers, tens + ones) if ones == 1 and tens_cardinal ~= "quatre-vingt" then insert_into_subtable(number, "cardinal", tens_cardinal .. "-et-un") insert_into_subtable(number, "ordinal", tens_cardinal .. "-et-unième") else local ones_numerals = numbers[ones] local ordinal = first_element_if_table(ones_numerals.ordinal) insert_into_subtable(number, "cardinal", tens_cardinal .. "-" .. ones_numerals.cardinal) insert_into_subtable(number, "ordinal", tens_cardinal .. "-" .. ordinal) end end end end end

numbers[100] = { cardinal = "cent", ordinal = "centième", multiplier = "centuple", }

for hundreds = 2, 9 do	numbers[hundreds * 100] = { cardinal = numbers[hundreds].cardinal .. " cents", } end

numbers[1000] = { cardinal = "mille", ordinal = "millième", }

numbers[1000000] = { cardinal = "million", ordinal = "millionième", }

return export