A service for formatting data types used within tokens of error messages using IDataTypeFormatter instances.

Formatting uses localization. It uses IDataTypeFormatter classes, which may handle multiple cultures. When searching for a formatter, it tries the CultureService.activeCultureID first and if no formatter is supplied for that culture, it has a chain of fallback cultures that you supply in the constructor.

This class is available on ValidationServices.dataTypeFormatterService.

Hierarchy (view full)

Implements

Constructors

Accessors

Methods

  • Converts the native value to a string that can be shown to the user. Result includes the successfully converted value or validation error information.

    Formatting uses localization. It uses IDataTypeFormatter classes, which may handle multiple cultures. When searching for a formatter, it tries the ValidationServices.activeCultureID first and if no formatter is supplied for that culture, it has a chain of fallback cultures that you supply in the constructor.

    Parameters

    • value: any
    • Optional lookupKey: null | string

      If not supplied, a lookup key is created based on the native value type. If you need alternative formatting or are supporting a user defined type, always pass in the associated lookup key. They can be found in the LookupKeys module.

    Returns DataTypeResolution<string>

    successfully converted value or validation error information.

Generated using TypeDoc v0.25.12