Skip to main content
Version: 3.0.8

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

IDateOnlyHumanizeStrategy

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

IDateTimeHumanizeStrategy

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

ITimeOnlyHumanizeStrategy

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>

Methods

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>