Syriac ܣܘܪܝܝܐ

BCP 47 language tag: syr

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

Syriac is most often spoken in Iraq and Syria.

Cardinalities

  • CARDINALITY_ONE

    Matches n = 1

    Example Integers: 1

    Example Decimals: 1.0, 1.00, 1.000, 1.0000

  • CARDINALITY_OTHER

    Matches all other values

    Example 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 file selects the localized form of “day” for a delivery estimate. Raw numbers choose the CLDR category; values formatted with the JDK NumberFormat are interpolated for display.

Sample localized strings file
syr.json Localized Strings File (Syriac)
{
  "Delivery.LeadTime": {
    "commentary": "Estimated delivery time, expressed in days.",
    "translation": "{{leadTime}}",
    "placeholders": {
      "leadTime": {
        "value": "dayCount",
        "translations": {
          "CARDINALITY_ONE": "ܚܕ ܝܘܡܐ",
          "CARDINALITY_OTHER": "{{formattedDayCount}} ܝܘܡܢ̈ܐ"
        }
      }
    }
  }
}
Usage and expected results

The Java code passes each raw number for cardinality selection and formats its display value separately with NumberFormat. For this right-to-left locale, Lokalized's default BidiIsolation.RTL_LOCALES wraps caller-supplied formatted values with U+2068 FIRST STRONG ISOLATE and U+2069 POP DIRECTIONAL ISOLATE; the expected expressions below show those escapes.

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

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 oneDayCount = 1;
String oneFormattedDayCount = numberFormat.format(oneDayCount);

assertEquals(Cardinality.ONE, Cardinality.forNumber(oneDayCount, locale));

assertEquals("ܚܕ ܝܘܡܐ", strings.get(
  "Delivery.LeadTime", Map.of("dayCount", oneDayCount, "formattedDayCount", oneFormattedDayCount)
));

// CARDINALITY_OTHER
Number otherDayCount = 0;
String otherFormattedDayCount = numberFormat.format(otherDayCount);

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

// Expected: <FSI>0<PDI> ܝܘܡܢ̈ܐ
// U+2068 FIRST STRONG ISOLATE begins bidirectional isolation around a caller-supplied value in right-to-left text
// U+2069 POP DIRECTIONAL ISOLATE ends bidirectional isolation around a caller-supplied value in right-to-left text
assertEquals("\u2068" + otherFormattedDayCount + "\u2069 ܝܘܡܢ̈ܐ", strings.get(
  "Delivery.LeadTime", Map.of("dayCount", otherDayCount, "formattedDayCount", otherFormattedDayCount)
));

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.

Cardinality range example

Because CLDR defines no explicit range mapping for this locale, the ending cardinality selects the result. The selected form wraps a separately formatted display range.

Sample localized strings file
syr.json Localized Strings File (Syriac)
{
  "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}} ܚܕ ܝܘܡܐ",
          "CARDINALITY_OTHER": "{{formattedDayRange}} ܝܘܡܢ̈ܐ"
        }
      }
    }
  }
}
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. For this right-to-left locale, Lokalized's default BidiIsolation.RTL_LOCALES wraps caller-supplied formatted values with U+2068 FIRST STRONG ISOLATE and U+2069 POP DIRECTIONAL ISOLATE; the expected expressions below show those escapes.

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

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_OTHER range (ending-cardinality fallback)
Number minDays = 0;
String formattedMinDays = numberFormat.format(minDays);
Number maxDays = new java.math.BigDecimal("0.9");
NumberFormat maxDaysFormat = NumberFormat.getNumberInstance(locale);
maxDaysFormat.setMinimumFractionDigits(1);
maxDaysFormat.setMaximumFractionDigits(1);
String formattedMaxDays = maxDaysFormat.format(maxDays);
String formattedDayRange = formattedMinDays + "-" + formattedMaxDays;

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

// Expected: <FSI>0-0.9<PDI> ܝܘܡܢ̈ܐ
// U+2068 FIRST STRONG ISOLATE begins bidirectional isolation around a caller-supplied value in right-to-left text
// U+2069 POP DIRECTIONAL ISOLATE ends bidirectional isolation around a caller-supplied value in right-to-left text
assertEquals("\u2068" + formattedDayRange + "\u2069 ܝܘܡܢ̈ܐ", 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.

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