Cardinalities
-
CARDINALITY_ONE
Matches
n = 1Example Integers:
1Example Decimals:
1.0, 1.00, 1.000, 1.0000 -
CARDINALITY_OTHER
Matches
all other valuesExample Integers:
0, 2, 16, 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 tr 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": "Sepetinizde {{formattedCardinalityValue}} X var. Bunu almak istiyor musunuz?", "CARDINALITY_OTHER": "Sepetinizde {{formattedCardinalityValue}} X var. Bunları almak istiyor musunuz?" } } } } }
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("tr"); 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: Sepetinizde 1 X var. Bunu almak istiyor musunuz? assertEquals( "Sepetinizde " + oneFormattedCardinalityValue + " X var. Bunu almak istiyor musunuz?", strings.get( "Cardinality.MinimalPair", Map.of( "cardinalityValue", oneCardinalityValue, "formattedCardinalityValue", oneFormattedCardinalityValue ) ) ); // CARDINALITY_OTHER Number otherCardinalityValue = 0; String otherFormattedCardinalityValue = numberFormat.format(otherCardinalityValue); assertEquals(Cardinality.OTHER, Cardinality.forNumber(otherCardinalityValue, locale)); // Expected: Sepetinizde 0 X var. Bunları almak istiyor musunuz? assertEquals( "Sepetinizde " + otherFormattedCardinalityValue + " X var. Bunları almak istiyor musunuz?", strings.get( "Cardinality.MinimalPair", Map.of( "cardinalityValue", otherCardinalityValue, "formattedCardinalityValue", otherFormattedCardinalityValue ) ) );
Cardinality Ranges
These are CLDR's explicit range mappings. For any start/end pair not listed, Cardinality.forRange(...) falls back to the ending cardinality.
-
CARDINALITY_ONE - CARDINALITY_OTHER
Matches
CARDINALITY_OTHER -
CARDINALITY_OTHER - CARDINALITY_ONE
Matches
CARDINALITY_ONE -
CARDINALITY_OTHER - CARDINALITY_OTHER
Matches
CARDINALITY_OTHER
Ordinalities
All ordinal numbers use ORDINALITY_OTHER; no value selects a different form.
Example: 2. sağdan dönün..
Language-Specific Examples
These examples show how Lokalized models grammatical choices and translation behavior that commonly affect Turkish application copy. Each example identifies the Lokalized language forms and other library features it uses.
A folder across five grammatical cases
One reusable localized noun carries the five forms needed when a folder is the subject, specific direct object, destination, location, or source.
Language reference: Türkiye Ministry of National Education: noun case suffixes
Lokalized forms used: GrammaticalCase
Sample localized strings file
{ "Folder": { "translation": "{{folder}}", "placeholders": { "folder": { "value": "grammaticalCase", "translations": { "CASE_NOMINATIVE": "Klasör", "CASE_ACCUSATIVE": "Klasörü", "CASE_DATIVE": "Klasöre", "CASE_LOCATIVE": "Klasörde", "CASE_ABLATIVE": "Klasörden" } } } } }
Usage and expected results
Locale locale = Locale.forLanguageTag("tr"); Strings strings = Strings.withFallbackLocale(locale) .localizedStringSupplier(() -> LocalizedStringLoader.loadFromFilesystem(Paths.get("strings"))) .localeSupplier((matcher) -> matcher.bestMatchFor(locale)) .build(); assertEquals("Klasör", strings.get( "Folder", Map.of("grammaticalCase", GrammaticalCase.NOMINATIVE) )); assertEquals("Klasörü", strings.get( "Folder", Map.of("grammaticalCase", GrammaticalCase.ACCUSATIVE) )); assertEquals("Klasöre", strings.get( "Folder", Map.of("grammaticalCase", GrammaticalCase.DATIVE) )); assertEquals("Klasörde", strings.get( "Folder", Map.of("grammaticalCase", GrammaticalCase.LOCATIVE) )); assertEquals("Klasörden", strings.get( "Folder", Map.of("grammaticalCase", GrammaticalCase.ABLATIVE) ));
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