Skip to content

Internationalization

One guide for the four separate concerns: UI strings, date locale, date parsing/formatting and time format. They all live in the Angular UI layer — the engine itself is locale-free (validator messages are your own strings), and headless bindings wire these strings to their own controls.

Built-in presets for en, it, de, fr, es cover every UI string:

bootstrapApplication(App, {
providers: [provideModyraLocale("it")],
});
// options: provideModyraLocale("it", { dateLocale: "it-CH", overrides: { noResults: "…" } })

For other languages provide MDY_I18N_MESSAGES directly — a plain object of strings and message functions (MDY_I18N_MESSAGES_DEFAULT is the English reference; every key you omit falls back to it).

provideModyraLocale also configures month/day names and the first day of the week via Intl. Without it, the datepicker detects the browser locale (navigator.language, guarded for SSR). Override explicitly:

providers: [
{ provide: MDY_DATE_LOCALE, useValue: buildDateLocale("it-IT", 1) }, // 1 = Monday
];
  • The datepicker’s stored value is an ISO calendar date ("2026-12-31"), not a Date instance and not an instant: no timezone conversions happen.
  • With the default displayFormat="localized", typed input is parsed in the locale’s numeric format — 31/12/2026 (it-IT), 12/31/2026 (en-US), 31.12.2026 (de-DE) — day/month order derived from Intl.DateTimeFormat.formatToParts. parseLocalizedDate is exported for reuse. ISO input is accepted everywhere.
  • Two-digit years map to 2000–2099; invalid dates (e.g. Feb 30) are rejected, leap years validated.
  • Default (12h): the timepicker stores "HH:mm AM/PM" strings.
  • format="24h": stores "HH:mm" ("14:30"), hides the AM/PM toggle and accepts 0–23 in the hour input.
  • The stored value is canonical and display-independent within the chosen format; parseAnyTime, to24Hour and formatTimeAs convert between the two.
Concern Built-in Overridable via
UI strings en, it, de, fr, es MDY_I18N_MESSAGES (any language)
Month/day names any Intl locale MDY_DATE_LOCALE
First day of week from preset/locale buildDateLocale(locale, firstDay)
Numeric date parsing any Intl locale (d/m/y order) displayFormat, parseLocalizedDate
Time format 12h, 24h format attribute

Not currently supported: non-Latin digit input parsing and RTL-specific layouts are untested — treat them as unsupported until the roadmap says otherwise.

The 12h period toggle currently renders literal “AM”/“PM” — they are not localized (many locales use different day-period names). Where that matters, use format="24h", which removes the toggle entirely; localized day-period labels are a known gap.