Cardinalities
All numbers use CARDINALITY_OTHER; no value selects a different form.
Example: 2 ມື້.
Cardinality Ranges
Every range resolves to CARDINALITY_OTHER because every endpoint is CARDINALITY_OTHER. Cardinality.forRange(...) therefore cannot select a different form.
Ordinalities
-
ORDINALITY_ONE
Matches
n = 1Example Integers:
1 -
ORDINALITY_OTHER
Matches
all other valuesExample Integers:
0, 2, 16, 100, 1000, 10000, 100000, 1000000, …
Ordinality example
This localized strings example uses complete CLDR minimal-pair patterns to demonstrate every Ordinality category defined for the locale.
Source: Unicode CLDR 48.2 lo locale data.
Sample localized strings file
{ "Ordinal.MinimalPair": { "commentary": "Demonstrates every CLDR ordinal category defined for this locale.", "translation": "{{ordinalExample}}", "placeholders": { "ordinalExample": { "value": "ordinalValue", "translations": { "ORDINALITY_ONE": "ລ້ຽວຂວາໂຕທີ {{formattedOrdinalValue}}.", "ORDINALITY_OTHER": "ລ້ຽວຂວາທີ {{formattedOrdinalValue}}." } } } } }
Usage and expected results
The Java code passes each raw number to Ordinality.forNumber(...) and formats its display value separately with NumberFormat.
Locale locale = Locale.forLanguageTag("lo"); Strings strings = Strings.withFallbackLocale(locale) .localizedStringSupplier(() -> LocalizedStringLoader.loadFromFilesystem(Paths.get("strings"))) .localeSupplier((matcher) -> matcher.bestMatchFor(locale)) .build(); NumberFormat numberFormat = NumberFormat.getNumberInstance(locale); // Raw numbers select language forms; NumberFormat produces the display values // ORDINALITY_ONE Number oneOrdinalValue = 1; String oneFormattedOrdinalValue = numberFormat.format(oneOrdinalValue); assertEquals(Ordinality.ONE, Ordinality.forNumber(oneOrdinalValue, locale)); // Expected: ລ້ຽວຂວາໂຕທີ 1. assertEquals("ລ້ຽວຂວາໂຕທີ " + oneFormattedOrdinalValue + ".", strings.get( "Ordinal.MinimalPair", Map.of("ordinalValue", oneOrdinalValue, "formattedOrdinalValue", oneFormattedOrdinalValue) )); // ORDINALITY_OTHER Number otherOrdinalValue = 2; String otherFormattedOrdinalValue = numberFormat.format(otherOrdinalValue); assertEquals(Ordinality.OTHER, Ordinality.forNumber(otherOrdinalValue, locale)); // Expected: ລ້ຽວຂວາທີ 2. assertEquals("ລ້ຽວຂວາທີ " + otherFormattedOrdinalValue + ".", strings.get( "Ordinal.MinimalPair", Map.of("ordinalValue", otherOrdinalValue, "formattedOrdinalValue", otherFormattedOrdinalValue) ));
Addendum: Language Form Rules
The language form expressions above are specified by Unicode Technical Standard #35 and use the following notation:
nabsolute value of the source number (integer and decimals)iinteger digits ofnvnumber of visible fraction digits inn, with trailing zeroswnumber of visible fraction digits inn, without trailing zerosfvisible fractional digits inn, with trailing zerostvisible fractional digits inn, without trailing zerosc/ecompact decimal exponent operands used by some CLDR compact-number rules