Humanizer.Configurator
Configurator Class
Provides a configuration point for Humanizer
public static class Configurator
Inheritance System.Object → Configurator
Properties
Configurator.CollectionFormatters Property
A registry of formatters used to format collections based on the current locale
public static Humanizer.LocaliserRegistry<Humanizer.ICollectionFormatter> CollectionFormatters { get; }
Property Value
Humanizer.LocaliserRegistry<ICollectionFormatter>
Configurator.DateOnlyHumanizeStrategy Property
The strategy to be used for DateOnly.Humanize
public static Humanizer.IDateOnlyHumanizeStrategy DateOnlyHumanizeStrategy { get; set; }
Property Value
Remarks
This property should be set only once during application startup before any humanization operations occur. For thread-safety, use volatile reads or appropriate synchronization when accessing this property in multi-threaded scenarios. In production applications, avoid changing this value after the application has started serving requests.
Configurator.DateOnlyToOrdinalWordsConverters Property
A registry of ordinalizers used to localise Ordinalize method
public static Humanizer.LocaliserRegistry<Humanizer.IDateOnlyToOrdinalWordConverter> DateOnlyToOrdinalWordsConverters { get; }
Property Value
Humanizer.LocaliserRegistry<IDateOnlyToOrdinalWordConverter>
Configurator.DateTimeHumanizeStrategy Property
The strategy to be used for DateTime.Humanize
public static Humanizer.IDateTimeHumanizeStrategy DateTimeHumanizeStrategy { get; set; }
Property Value
Remarks
This property should be set only once during application startup before any humanization operations occur. For thread-safety, use volatile reads or appropriate synchronization when accessing this property in multi-threaded scenarios. In production applications, avoid changing this value after the application has started serving requests.
Configurator.DateTimeOffsetHumanizeStrategy Property
The strategy to be used for DateTimeOffset.Humanize
public static Humanizer.IDateTimeOffsetHumanizeStrategy DateTimeOffsetHumanizeStrategy { get; set; }
Property Value
IDateTimeOffsetHumanizeStrategy
Remarks
This property should be set only once during application startup before any humanization operations occur. For thread-safety, use volatile reads or appropriate synchronization when accessing this property in multi-threaded scenarios. In production applications, avoid changing this value after the application has started serving requests.
Configurator.DateToOrdinalWordsConverters Property
A registry of ordinalizers used to localise Ordinalize method
public static Humanizer.LocaliserRegistry<Humanizer.IDateToOrdinalWordConverter> DateToOrdinalWordsConverters { get; }
Property Value
Humanizer.LocaliserRegistry<IDateToOrdinalWordConverter>
Configurator.Formatters Property
A registry of formatters used to format strings based on the current locale
public static Humanizer.LocaliserRegistry<Humanizer.IFormatter> Formatters { get; }
Property Value
Humanizer.LocaliserRegistry<IFormatter>
Configurator.NumberToWordsConverters Property
A registry of number to words converters used to localise ToWords and ToOrdinalWords methods
public static Humanizer.LocaliserRegistry<Humanizer.INumberToWordsConverter> NumberToWordsConverters { get; }
Property Value
Humanizer.LocaliserRegistry<INumberToWordsConverter>
Configurator.Ordinalizers Property
A registry of ordinalizers used to localise Ordinalize method
public static Humanizer.LocaliserRegistry<Humanizer.IOrdinalizer> Ordinalizers { get; }
Property Value
Humanizer.LocaliserRegistry<IOrdinalizer>
Configurator.TimeOnlyHumanizeStrategy Property
The strategy to be used for TimeOnly.Humanize
public static Humanizer.ITimeOnlyHumanizeStrategy TimeOnlyHumanizeStrategy { get; set; }
Property Value
Remarks
This property should be set only once during application startup before any humanization operations occur. For thread-safety, use volatile reads or appropriate synchronization when accessing this property in multi-threaded scenarios. In production applications, avoid changing this value after the application has started serving requests.
Configurator.TimeOnlyToClockNotationConverters Property
A registry of time to clock notation converters used to localise ToClockNotation methods
public static Humanizer.LocaliserRegistry<Humanizer.ITimeOnlyToClockNotationConverter> TimeOnlyToClockNotationConverters { get; }
Property Value
Humanizer.LocaliserRegistry<ITimeOnlyToClockNotationConverter>
Configurator.TimeSpanHumanizeStrategy Property
The strategy used by the System.TimeSpan humanization extension methods.
public static Humanizer.ITimeSpanHumanizeStrategy TimeSpanHumanizeStrategy { get; set; }
Property Value
Remarks
This property should be set only once during application startup before any humanization operations occur. For thread-safety, use volatile reads or appropriate synchronization when accessing this property in multi-threaded scenarios. In production applications, avoid changing this value after the application has started serving requests.
Methods
Configurator.IsCultureSupported(CultureInfo) Method
Determines whether Humanizer includes complete generated locale support for the specified culture.
public static bool IsCultureSupported(System.Globalization.CultureInfo culture);
Parameters
culture System.Globalization.CultureInfo
The culture to check.
Returns
System.Boolean
true when the culture or one of its named parents has generated locale support; otherwise, false.
Exceptions
System.ArgumentNullException
Thrown when culture is null.
Remarks
This considers parent-culture fallback, but does not report support merely because Humanizer can fall back to its default English localizers.
Configurator.UseEnumDescriptionPropertyLocator(Func<PropertyInfo,bool>) Method
Use a predicate function for description property of attribute to use for Enum.Humanize
public static void UseEnumDescriptionPropertyLocator(System.Func<System.Reflection.PropertyInfo,bool> func);
Parameters
func System.Func<System.Reflection.PropertyInfo,System.Boolean>