NotableDateLocalizationExtensions Class
Definition
- Namespace
- Bodu.Globalization.Calendar
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.0.1
Provides extension methods that apply an INotableDateNameLocalizer to resolved occurrences, replacing each display name with its culture-specific form.
public static class NotableDateLocalizationExtensions
- Inheritance
-
NotableDateLocalizationExtensions
- Inherited Members
Examples
IReadOnlyList<NotableDate> dates = service.Resolve(2026, "CA-QC");
// Replace display names with their French-Canadian forms where the localizer has them.
INotableDateNameLocalizer localizer = new NotableDateNameLocalizer(translations);
IReadOnlyList<NotableDate> localized = dates.Localize(localizer, CultureInfo.GetCultureInfo("fr-CA"));
Remarks
Resolution always emits the authored (invariant) display name; localization is a separate, opt-in step applied to the results. When the localizer supplies no name for an occurrence in the requested culture, that occurrence is returned unchanged so the invariant name remains as a fallback.
Methods
Localize(NotableDate, INotableDateNameLocalizer, CultureInfo)
Returns the occurrence with its display name localized for the requested culture.
public static NotableDate Localize(this NotableDate notableDate, INotableDateNameLocalizer localizer, CultureInfo culture)
Parameters
notableDateNotableDateThe resolved occurrence to localize.
localizerINotableDateNameLocalizerThe localizer that supplies the culture-specific name.
cultureCultureInfoThe culture to localize for.
Returns
- NotableDate
A copy with the localized display name, or the same occurrence when the localizer supplies no name.
Exceptions
- ArgumentNullException
notableDate,localizer, orcultureis null.
Localize(IReadOnlyList<NotableDate>, INotableDateNameLocalizer, CultureInfo)
Returns the occurrences with their display names localized for the requested culture.
public static IReadOnlyList<NotableDate> Localize(this IReadOnlyList<NotableDate> occurrences, INotableDateNameLocalizer localizer, CultureInfo culture)
Parameters
occurrencesIReadOnlyList<NotableDate>The resolved occurrences to localize.
localizerINotableDateNameLocalizerThe localizer that supplies the culture-specific names.
cultureCultureInfoThe culture to localize for.
Returns
- IReadOnlyList<NotableDate>
The occurrences with localized display names, preserving order.
Exceptions
- ArgumentNullException
occurrences,localizer, orcultureis null.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |