# =============================================================================
# MBROLA NG - Español (es) - numcontext.txt
# Copyright (c) 2026 Darko Milošević
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Numbers in context: ordinals, roman numerals, ranges, fractions.
# Syntax: see dates.txt. (Plain numbers, decimals "3,14", negative numbers,
# thousands separators and number + unit are handled by the engine with
# the options of language.txt and units.txt.)
# =============================================================================

@list century-nouns = siglo siglos milenio capítulo tomo volumen
# the letter endings of written ordinals: 1er, 1.er, 2do, 3ro, 4to, 7mo,
# 8vo, 9no, 1o, 1.o  (the masculine and feminine ordinal indicators º and
# ª are letters, so "1.º" is matched through these lists as well)
@list ord-suffix-er = er
@list ord-suffix-m = do ro to mo vo no o º
@list ord-suffix-f = da ra ta ma va na a ª

# --- ranges 5-10 -> cinco a diez
( num - num ) => $1 a $2

# --- 1er / 1.er / 2do / 4to / 1.º / 2.ª
( num1-3 . @ord-suffix-er ) => $1:%spellout-ordinal-masculine-apocopated
( num1-3 @ord-suffix-er ) => $1:%spellout-ordinal-masculine-apocopated
( num1-3 . @ord-suffix-m ) => $1:%spellout-ordinal-masculine
( num1-3 @ord-suffix-m ) => $1:%spellout-ordinal-masculine
( num1-3 . @ord-suffix-f ) => $1:%spellout-ordinal-feminine
( num1-3 @ord-suffix-f ) => $1:%spellout-ordinal-feminine

# --- roman numerals: "siglo XX" is a cardinal, "Juan Pablo II" an ordinal
@century-nouns _ ( roman ) => $1:%spellout-cardinal-masculine
cap _ ( roman ) => $1:%spellout-ordinal-masculine

# --- simple fractions
( num[1] / num[2] ) => un medio
( num[1] / num[3] ) => un tercio
( num[1] / num[4] ) => un cuarto
( num[3] / num[4] ) => tres cuartos
