Polish polski

BCP 47 language tag: pl

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

Additional modeled concepts for Polish: grammatical case; grammatical gender.

Polish is most often spoken in Poland, the United Kingdom, Ukraine, Germany, and Canada.

Cardinalities

  • CARDINALITY_ONE

    Matches i = 1 and v = 0

    Example Integers: 1

  • CARDINALITY_FEW

    Matches v = 0 and i % 10 = 2..4 and i % 100 != 12..14

    Example Integers: 2, 4, 22, 24, 32, 34, 42, 44, 52, 54, 62, 102, 1002, …

  • CARDINALITY_MANY

    Matches v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14

    Example Integers: 0, 5, 19, 100, 1000, 10000, 100000, 1000000, …

  • CARDINALITY_OTHER

    Matches all other values

    Example Decimals: 0.0, 1.5, 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 pl locale data.

Sample localized strings file
pl.json Localized Strings File (Polish)
{
  "Cardinality.MinimalPair": {
    "commentary": "Demonstrates every CLDR cardinal category defined for this locale.",
    "translation": "{{cardinalityExample}}",
    "placeholders": {
      "cardinalityExample": {
        "value": "cardinalityValue",
        "translations": {
          "CARDINALITY_ONE": "{{formattedCardinalityValue}} miesiąc",
          "CARDINALITY_FEW": "{{formattedCardinalityValue}} miesiące",
          "CARDINALITY_MANY": "{{formattedCardinalityValue}} miesięcy",
          "CARDINALITY_OTHER": "{{formattedCardinalityValue}} miesiąca"
        }
      }
    }
  }
}
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("pl");

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 miesiąc
assertEquals(oneFormattedCardinalityValue + " miesiąc", 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 miesiące
assertEquals(fewFormattedCardinalityValue + " miesiące", strings.get(
  "Cardinality.MinimalPair",
  Map.of(
    "cardinalityValue", fewCardinalityValue,
    "formattedCardinalityValue", fewFormattedCardinalityValue
  )
));

// CARDINALITY_MANY
Number manyCardinalityValue = 0;
String manyFormattedCardinalityValue = numberFormat.format(manyCardinalityValue);

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

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

// CARDINALITY_OTHER
Number otherCardinalityValue = new java.math.BigDecimal("0.0");
NumberFormat otherCardinalityValueFormat = NumberFormat.getNumberInstance(locale);
otherCardinalityValueFormat.setMinimumFractionDigits(1);
otherCardinalityValueFormat.setMaximumFractionDigits(1);
String otherFormattedCardinalityValue = otherCardinalityValueFormat.format(otherCardinalityValue);

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

// Expected: 0,0 miesiąca
assertEquals(otherFormattedCardinalityValue + " miesiąca", 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_FEW

    Matches CARDINALITY_FEW

  • CARDINALITY_ONE - CARDINALITY_MANY

    Matches CARDINALITY_MANY

  • CARDINALITY_ONE - CARDINALITY_OTHER

    Matches CARDINALITY_OTHER

  • 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
pl.json Localized Strings File (Polish)
{
  "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}} dzień",
          "CARDINALITY_FEW": "{{formattedDayRange}} dni",
          "CARDINALITY_MANY": "{{formattedDayRange}} dni",
          "CARDINALITY_OTHER": "{{formattedDayRange}} dnia"
        }
      }
    }
  }
}
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("pl");

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

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

// Expected: 1-2 dni
assertEquals(formattedDayRange + " dni", 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: Skręć w 2. w prawo..

Language-Specific Examples

These examples show how Lokalized models grammatical choices and translation behavior that commonly affect Polish application copy. Each example identifies the Lokalized language forms and other library features it uses.

A personal name in three grammatical cases

One reusable localized name carries the forms needed when Anna is the subject, an indirect object, or a direct object.

Language reference: University of Warsaw Language Advice: declension of Anna

Lokalized forms used: GrammaticalCase

Sample localized strings file
pl.json Localized Strings File (Polish)
{
  "Anna": {
    "translation": "{{person}}",
    "placeholders": {
      "person": {
        "value": "grammaticalCase",
        "translations": {
          "CASE_NOMINATIVE": "Anna",
          "CASE_DATIVE": "Annie",
          "CASE_ACCUSATIVE": "Annę"
        }
      }
    }
  }
}
Usage and expected results
Locale locale = Locale.forLanguageTag("pl");

Strings strings = Strings.withFallbackLocale(locale)
  .localizedStringSupplier(() -> LocalizedStringLoader.loadFromFilesystem(Paths.get("strings")))
  .localeSupplier((matcher) -> matcher.bestMatchFor(locale))
  .build();

assertEquals("Anna", strings.get(
  "Anna", Map.of("grammaticalCase", GrammaticalCase.NOMINATIVE)
));

assertEquals("Annie", strings.get(
  "Anna", Map.of("grammaticalCase", GrammaticalCase.DATIVE)
));

assertEquals("Annę", strings.get(
  "Anna", Map.of("grammaticalCase", GrammaticalCase.ACCUSATIVE)
));

Singular subject and adjective agreement

For singular human referents, this example covers masculine and feminine personal names plus the grammatically neuter noun dziecko. Polish plural agreement and masculine subgenders require separate modeling.

Language reference: Polish Language Council: grammatical gender in Polish

Lokalized forms used: Gender

Sample localized strings file
pl.json Localized Strings File (Polish)
{
  "{{person}} is ready.": {
    "translation": "{{person}} jest {{ready}}.",
    "placeholders": {
      "ready": {
        "value": "gender",
        "translations": {
          "GENDER_MASCULINE": "gotowy",
          "GENDER_FEMININE": "gotowa",
          "GENDER_NEUTER": "gotowe"
        }
      }
    }
  }
}
Usage and expected results
Locale locale = Locale.forLanguageTag("pl");

Strings strings = Strings.withFallbackLocale(locale)
  .localizedStringSupplier(() -> LocalizedStringLoader.loadFromFilesystem(Paths.get("strings")))
  .localeSupplier((matcher) -> matcher.bestMatchFor(locale))
  .build();

assertEquals("Marek jest gotowy.", strings.get(
  "{{person}} is ready.", Map.of("person", "Marek", "gender", Gender.MASCULINE)
));

assertEquals("Anna jest gotowa.", strings.get(
  "{{person}} is ready.", Map.of("person", "Anna", "gender", Gender.FEMININE)
));

assertEquals("Dziecko jest gotowe.", strings.get(
  "{{person}} is ready.", Map.of("person", "Dziecko", "gender", Gender.NEUTER)
));

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