ShadcnLocalizationsExtensions extension

Formatting helpers layered on top of the translated strings in ShadcnLocalizations.

ShadcnLocalizations is generated from lib/l10n/shadcn_en.arb and holds only individual strings. Everything that has to combine those strings — naming a month from its number, laying out a date, rendering a duration — lives here instead, so that the generated class stays a pure string table.

What a translation can and cannot change

The lookups route through members of ShadcnLocalizations itself, so a subclass controls them: override ShadcnLocalizations.monthJanuary and getMonth follows. Component strings work the same way.

The members declared here are a different matter. Dart resolves extension members against the static type, and widgets hold their localizations as ShadcnLocalizations — so declaring datePartsOrder or formatDateTime on a subclass does not override anything, and these defaults apply to every locale:

Widgets that need a different order or layout take it as a parameter rather than reading it from here.

on

Properties

dateDayAbbreviation → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

The abbreviation for the day component (e.g., 'DD').
no setter
dateMonthAbbreviation → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

The abbreviation for the month component (e.g., 'MM').
no setter
datePartsOrder → List<DatePart>

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

The order of date parts for the current locale.
no setter
dateYearAbbreviation → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

The abbreviation for the year component (e.g., 'YYYY').
no setter

Methods

formatDateTime(DateTime dateTime, {bool showDate = true, bool showTime = true, bool showSeconds = false, bool use24HourFormat = true}) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Formats a DateTime object into a string.
formatDuration(Duration duration, {bool showDays = true, bool showHours = true, bool showMinutes = true, bool showSeconds = true}) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Formats a Duration into a string.
formatNumber(double value) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Formats a number as a string, removing decimal point if it's an integer.
formatTimeOfDay(TimeOfDay time, {bool use24HourFormat = true, bool showSeconds = false}) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Formats a TimeOfDay object into a string.
getAbbreviatedMonth(int month) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Gets the abbreviated month name for a given month index (1-12).
getAbbreviatedWeekday(int weekday) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Gets the abbreviated weekday name for a given weekday index (1-7).
getColorPickerMode(ColorPickerMode mode) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Gets the localized label for a ColorPickerMode.
getDatePartAbbreviation(DatePart part) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Gets the abbreviation for a specific DatePart.
getDurationPartAbbreviation(DurationPart part) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Gets the abbreviation for a DurationPart.
getMonth(int month) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Gets the full month name for a given month index (1-12).
getTimePartAbbreviation(TimePart part) → String

Available on ShadcnLocalizations, provided by the ShadcnLocalizationsExtensions extension

Gets the abbreviation for a TimePart.