Cardinalities
-
CARDINALITY_ONE
Matches
n = 1Example Integers:
1Example Decimals:
1.0, 1.00, 1.000, 1.0000 -
CARDINALITY_TWO
Matches
n = 2Example Integers:
2Example Decimals:
2.0, 2.00, 2.000, 2.0000 -
CARDINALITY_OTHER
Matches
all other valuesExample Integers:
0, 3, 17, 100, 1000, 10000, 100000, 1000000, …Example Decimals:
0.0, 0.9, 1.1, 1.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …
Cardinality example
This localized strings example uses complete, page-local CLDR minimal-pair patterns to demonstrate every Cardinality category defined for the locale. Minimal-pair text contrasts grammatical forms; it is language-reference data, not reusable application copy.
Source: Unicode CLDR 48.2 sat locale data.
Sample localized strings file
{ "Cardinality.MinimalPair": { "commentary": "Demonstrates every CLDR cardinal category defined for this locale.", "translation": "{{cardinalityExample}}", "placeholders": { "cardinalityExample": { "value": "cardinalityValue", "translations": { "CARDINALITY_ONE": "{{formattedCardinalityValue}} ᱰᱟᱹᱝᱜᱽᱨᱤ", "CARDINALITY_TWO": "{{formattedCardinalityValue}} ᱰᱟᱹᱝᱜᱽᱨᱤ ᱠᱤᱱ", "CARDINALITY_OTHER": "{{formattedCardinalityValue}} ᱰᱟᱹᱝᱜᱽᱨᱤ ᱠᱚ" } } } } }
Usage and expected results
The Java code passes each raw number for cardinality selection and formats its display value separately with NumberFormat.
Locale locale = Locale.forLanguageTag("sat"); 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 // CARDINALITY_ONE Number oneCardinalityValue = 1; String oneFormattedCardinalityValue = numberFormat.format(oneCardinalityValue); assertEquals(Cardinality.ONE, Cardinality.forNumber(oneCardinalityValue, locale)); // Expected: ᱑ ᱰᱟᱹᱝᱜᱽᱨᱤ assertEquals(oneFormattedCardinalityValue + " ᱰᱟᱹᱝᱜᱽᱨᱤ", strings.get( "Cardinality.MinimalPair", Map.of( "cardinalityValue", oneCardinalityValue, "formattedCardinalityValue", oneFormattedCardinalityValue ) )); // CARDINALITY_TWO Number twoCardinalityValue = 2; String twoFormattedCardinalityValue = numberFormat.format(twoCardinalityValue); assertEquals(Cardinality.TWO, Cardinality.forNumber(twoCardinalityValue, locale)); // Expected: ᱒ ᱰᱟᱹᱝᱜᱽᱨᱤ ᱠᱤᱱ assertEquals(twoFormattedCardinalityValue + " ᱰᱟᱹᱝᱜᱽᱨᱤ ᱠᱤᱱ", strings.get( "Cardinality.MinimalPair", Map.of( "cardinalityValue", twoCardinalityValue, "formattedCardinalityValue", twoFormattedCardinalityValue ) )); // CARDINALITY_OTHER Number otherCardinalityValue = 0; String otherFormattedCardinalityValue = numberFormat.format(otherCardinalityValue); assertEquals(Cardinality.OTHER, Cardinality.forNumber(otherCardinalityValue, locale)); // Expected: ᱐ ᱰᱟᱹᱝᱜᱽᱨᱤ ᱠᱚ assertEquals(otherFormattedCardinalityValue + " ᱰᱟᱹᱝᱜᱽᱨᱤ ᱠᱚ", strings.get( "Cardinality.MinimalPair", Map.of( "cardinalityValue", otherCardinalityValue, "formattedCardinalityValue", otherFormattedCardinalityValue ) ));
Cardinality Ranges
No explicit CLDR cardinality-range mapping is defined for this language. Cardinality.forRange(...) therefore falls back to the ending cardinality for every range.
Ordinalities
All ordinal numbers use ORDINALITY_OTHER; no value selects a different form.
Example: ᱒ ᱛᱮ ᱡᱚᱡᱚᱢ ᱤᱫᱤ ᱢᱮ ᱾.
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