Swiss High German Schweizer Hochdeutsch de-CH

Lokalized supports cardinality, cardinality range, and ordinality rules for Swiss High German.

Additional modeled concepts for Swiss High German: grammatical gender; grammatical case.

Cardinalities

  • CARDINALITY_ONE

    Matches i = 1 and v = 0

    Example Integers: 1

  • CARDINALITY_OTHER

    Matches all other values

    Example Integers: 0, 2, 16, 100, 1000, 10000, 100000, 1000000, …

    Example Decimals: 0.0, 1.5, 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
de-CH.json Localized Strings File (Swiss High German)
{
  "Delivery.LeadTime": {
    "commentary": "Estimated delivery time, expressed in days.",
    "translation": "{{leadTime}}",
    "placeholders": {
      "leadTime": {
        "value": "dayCount",
        "translations": {
          "CARDINALITY_ONE": "{{formattedDayCount}} Tag",
          "CARDINALITY_OTHER": "{{formattedDayCount}} Tage"
        }
      }
    }
  }
}
Usage and expected results

The Java code passes each raw number for cardinality selection and formats its display value separately with NumberFormat. The exact-tag 1,000,000 assertion records JDK 26 output; older JDK locale data can differ.

Locale locale = Locale.forLanguageTag("de-CH");

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);

// Expected: 1 Tag
assertEquals(oneFormattedDayCount + " Tag", strings.get(
  "Delivery.LeadTime", Map.of("dayCount", oneDayCount, "formattedDayCount", oneFormattedDayCount)
));

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

// Expected: 0 Tage
assertEquals(otherFormattedDayCount + " Tage", strings.get(
  "Delivery.LeadTime", Map.of("dayCount", otherDayCount, "formattedDayCount", otherFormattedDayCount)
));

// Exact-tag formatting sample
Number localeProfileDayCount = 1_000_000;
String localeProfileFormattedDayCount = numberFormat.format(localeProfileDayCount);

assertEquals("1'000'000", localeProfileFormattedDayCount);

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

// Expected: 1'000'000 Tage
assertEquals(localeProfileFormattedDayCount + " Tage", strings.get(
  "Delivery.LeadTime",
  Map.of("dayCount", localeProfileDayCount, "formattedDayCount", localeProfileFormattedDayCount)
));

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

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
de-CH.json Localized Strings File (Swiss High German)
{
  "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}} Tag",
          "CARDINALITY_OTHER": "{{formattedDayRange}} Tage"
        }
      }
    }
  }
}
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("de-CH");

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

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

// Expected: 1-2 Tage
assertEquals(formattedDayRange + " Tage", 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. Abzweigung nach rechts nehmen.

Language-Specific Examples

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

Gendered accusative noun phrases

German article choice can depend on grammatical gender; this example fixes the sentence in accusative context and varies the selected noun phrase.

Language references: University of Kansas - accusative articles by gender, Duden - Ordner, Duden - Datei, Duden - Fenster

Lokalized forms used: Gender

Sample localized strings file
de-CH.json Localized Strings File (Swiss High German)
{
  "Open {{item}}.": {
    "translation": "Öffne {{item}}.",
    "placeholders": {
      "item": {
        "value": "gender",
        "translations": {
          "GENDER_MASCULINE": "den Ordner",
          "GENDER_FEMININE": "die Datei",
          "GENDER_NEUTER": "das Fenster"
        }
      }
    }
  }
}
Usage and expected results
Locale locale = Locale.forLanguageTag("de-CH");

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

assertEquals("Öffne den Ordner.", strings.get(
  "Open {{item}}.", Map.of("gender", Gender.MASCULINE)
));

assertEquals("Öffne die Datei.", strings.get(
  "Open {{item}}.", Map.of("gender", Gender.FEMININE)
));

assertEquals("Öffne das Fenster.", strings.get(
  "Open {{item}}.", Map.of("gender", Gender.NEUTER)
));

One noun across four grammatical cases

One reusable localized noun phrase carries all four forms of the masculine noun Kunde. Passing the grammatical case selects the complete article-and-noun phrase without duplicating partial maps across sentence keys.

Language reference: Duden - the four German cases

Lokalized forms used: GrammaticalCase

Sample localized strings file
de-CH.json Localized Strings File (Swiss High German)
{
  "Customer": {
    "translation": "{{customer}}",
    "placeholders": {
      "customer": {
        "value": "grammaticalCase",
        "translations": {
          "CASE_NOMINATIVE": "der Kunde",
          "CASE_ACCUSATIVE": "den Kunden",
          "CASE_DATIVE": "dem Kunden",
          "CASE_GENITIVE": "des Kunden"
        }
      }
    }
  }
}
Usage and expected results
Locale locale = Locale.forLanguageTag("de-CH");

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

assertEquals("der Kunde", strings.get(
  "Customer", Map.of("grammaticalCase", GrammaticalCase.NOMINATIVE)
));

assertEquals("den Kunden", strings.get(
  "Customer", Map.of("grammaticalCase", GrammaticalCase.ACCUSATIVE)
));

assertEquals("dem Kunden", strings.get(
  "Customer", Map.of("grammaticalCase", GrammaticalCase.DATIVE)
));

assertEquals("des Kunden", strings.get(
  "Customer", Map.of("grammaticalCase", GrammaticalCase.GENITIVE)
));

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