Lithuanian lietuvių

BCP 47 language tag: lt

Lokalized supports cardinality, cardinality range, and ordinality rules for Lithuanian.

Lithuanian is most often spoken in Lithuania, the United Kingdom, and Poland.

Cardinalities

  • CARDINALITY_ONE

    Matches n % 10 = 1 and n % 100 != 11..19

    Example Integers: 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, …

    Example Decimals: 1.0, 21.0, 31.0, 41.0, 51.0, 61.0, 71.0, 81.0, 101.0, 1001.0, …

  • CARDINALITY_FEW

    Matches n % 10 = 2..9 and n % 100 != 11..19

    Example Integers: 2, 9, 22, 29, 102, 1002, …

    Example Decimals: 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 22.0, 102.0, 1002.0, …

  • CARDINALITY_MANY

    Matches f != 0

    Example Decimals: 0.1, 0.9, 1.1, 1.7, 10.1, 100.1, 1000.1, …

  • CARDINALITY_OTHER

    Matches all other values

    Example Integers: 0, 10, 20, 30, 40, 50, 60, 100, 1000, 10000, 100000, 1000000, …

    Example Decimals: 0.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.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 lt locale data.

Sample localized strings file
lt.json Localized Strings File (Lithuanian)
{
  "Cardinality.MinimalPair": {
    "commentary": "Demonstrates every CLDR cardinal category defined for this locale.",
    "translation": "{{cardinalityExample}}",
    "placeholders": {
      "cardinalityExample": {
        "value": "cardinalityValue",
        "translations": {
          "CARDINALITY_ONE": "{{formattedCardinalityValue}} obuolys",
          "CARDINALITY_FEW": "{{formattedCardinalityValue}} obuoliai",
          "CARDINALITY_MANY": "{{formattedCardinalityValue}} obuolio",
          "CARDINALITY_OTHER": "{{formattedCardinalityValue}} obuolių"
        }
      }
    }
  }
}
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("lt");

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: 1 obuolys
assertEquals(oneFormattedCardinalityValue + " obuolys", strings.get(
  "Cardinality.MinimalPair",
  Map.of(
    "cardinalityValue", oneCardinalityValue,
    "formattedCardinalityValue", oneFormattedCardinalityValue
  )
));

// CARDINALITY_FEW
Number fewCardinalityValue = 2;
String fewFormattedCardinalityValue = numberFormat.format(fewCardinalityValue);

assertEquals(Cardinality.FEW, Cardinality.forNumber(fewCardinalityValue, locale));

// Expected: 2 obuoliai
assertEquals(fewFormattedCardinalityValue + " obuoliai", strings.get(
  "Cardinality.MinimalPair",
  Map.of(
    "cardinalityValue", fewCardinalityValue,
    "formattedCardinalityValue", fewFormattedCardinalityValue
  )
));

// CARDINALITY_MANY
Number manyCardinalityValue = new java.math.BigDecimal("0.1");
NumberFormat manyCardinalityValueFormat = NumberFormat.getNumberInstance(locale);
manyCardinalityValueFormat.setMinimumFractionDigits(1);
manyCardinalityValueFormat.setMaximumFractionDigits(1);
String manyFormattedCardinalityValue = manyCardinalityValueFormat.format(manyCardinalityValue);

assertEquals(Cardinality.MANY, Cardinality.forNumber(manyCardinalityValue, locale));

// Expected: 0,1 obuolio
assertEquals(manyFormattedCardinalityValue + " obuolio", strings.get(
  "Cardinality.MinimalPair",
  Map.of(
    "cardinalityValue", manyCardinalityValue,
    "formattedCardinalityValue", manyFormattedCardinalityValue
  )
));

// CARDINALITY_OTHER
Number otherCardinalityValue = 0;
String otherFormattedCardinalityValue = numberFormat.format(otherCardinalityValue);

assertEquals(Cardinality.OTHER, Cardinality.forNumber(otherCardinalityValue, locale));

// Expected: 0 obuolių
assertEquals(otherFormattedCardinalityValue + " obuolių", 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_ONE

    Matches CARDINALITY_ONE

  • CARDINALITY_ONE - CARDINALITY_FEW

    Matches CARDINALITY_FEW

  • CARDINALITY_ONE - CARDINALITY_MANY

    Matches CARDINALITY_MANY

  • CARDINALITY_ONE - CARDINALITY_OTHER

    Matches CARDINALITY_OTHER

  • CARDINALITY_FEW - CARDINALITY_ONE

    Matches CARDINALITY_ONE

  • CARDINALITY_FEW - CARDINALITY_FEW

    Matches CARDINALITY_FEW

  • CARDINALITY_FEW - CARDINALITY_MANY

    Matches CARDINALITY_MANY

  • CARDINALITY_FEW - CARDINALITY_OTHER

    Matches CARDINALITY_OTHER

  • CARDINALITY_MANY - CARDINALITY_ONE

    Matches CARDINALITY_ONE

  • CARDINALITY_MANY - CARDINALITY_FEW

    Matches CARDINALITY_FEW

  • CARDINALITY_MANY - CARDINALITY_MANY

    Matches CARDINALITY_MANY

  • CARDINALITY_MANY - CARDINALITY_OTHER

    Matches CARDINALITY_OTHER

  • CARDINALITY_OTHER - CARDINALITY_ONE

    Matches CARDINALITY_ONE

  • CARDINALITY_OTHER - CARDINALITY_FEW

    Matches CARDINALITY_FEW

  • CARDINALITY_OTHER - CARDINALITY_MANY

    Matches CARDINALITY_MANY

  • CARDINALITY_OTHER - CARDINALITY_OTHER

    Matches CARDINALITY_OTHER

Cardinality range example

The start and end cardinalities select the locale's CLDR range result. The selected form wraps a separately formatted display range.

Sample localized strings file
lt.json Localized Strings File (Lithuanian)
{
  "Delivery.Window": {
    "commentary": "Estimated delivery window, expressed as a range of days.",
    "translation": "{{window}}",
    "placeholders": {
      "window": {
        "range": {
          "start": "minDays",
          "end": "maxDays"
        },
        "translations": {
          "CARDINALITY_ONE": "{{formattedDayRange}} diena",
          "CARDINALITY_FEW": "{{formattedDayRange}} dienos",
          "CARDINALITY_MANY": "{{formattedDayRange}} dienos",
          "CARDINALITY_OTHER": "{{formattedDayRange}} dienų"
        }
      }
    }
  }
}
Usage and expected results

The Java code passes raw range endpoints for selection. Because NumberFormat formats one number at a time, it formats both endpoints separately and joins them for display; choose range punctuation appropriate to your application.

Locale locale = Locale.forLanguageTag("lt");

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 range
Number minDays = 1;
String formattedMinDays = numberFormat.format(minDays);
Number maxDays = 21;
String formattedMaxDays = numberFormat.format(maxDays);
String formattedDayRange = formattedMinDays + "-" + formattedMaxDays;

assertEquals(Cardinality.ONE, Cardinality.forRange(
  Cardinality.forNumber(minDays, locale),
  Cardinality.forNumber(maxDays, locale),
  locale
));

// Expected: 1-21 diena
assertEquals(formattedDayRange + " diena", strings.get(
  "Delivery.Window",
  Map.of("minDays", minDays, "maxDays", maxDays, "formattedDayRange", formattedDayRange)
));

Ordinalities

All ordinal numbers use ORDINALITY_OTHER; no value selects a different form.

Example: 2-ame posūkyje sukite į dešinę..

Addendum: Language Form Rules

The language form expressions above are specified by Unicode Technical Standard #35 and use the following notation:

  • n absolute value of the source number (integer and decimals)
  • i integer digits of n
  • v number of visible fraction digits in n, with trailing zeros
  • w number of visible fraction digits in n, without trailing zeros
  • f visible fractional digits in n, with trailing zeros
  • t visible fractional digits in n, without trailing zeros
  • c/e compact decimal exponent operands used by some CLDR compact-number rules