Base class for boolean localized formatters. Booleans are unusual in that they aren't normally shown, and when they are shown, they need words meaningful to the user, not "true" and "false". "yes" and "no", "on" and "off", "enabled" and "disabled" are better. This base class lets you supply a list of cultures and the text that you want to use for true and false. If not supplied, it defaults to "true" and "false". To provide localization of "true" and "false", set up ValidationServices.TextLocalizerService with text keys, cultures and translations. Then provide values for TrueLabel and FalseLabel when registering this class in the dataTypeFormatterService.

Hierarchy (view full)

Constructors

Accessors

  • get trueLabel(): string
  • Text shown the user for a value of true. To provide localization of "true" and "false", set up ValidationServices.TextLocalizerService with text keys, cultures and translations. Then provide values for TrueLabel and FalseLabel when registering this class in the dataTypeFormatterService.

    Returns string

  • get trueLabell10n(): null | string
  • Localization key for TrueLabel. Its value will be matched to an entry made to ValidationServices.TextLocalizerService, specific to the active culture. If setup and no entry was found in TextLocalizerService, the value from the TrueLabel property is used.

    Returns null | string

  • get falseLabel(): string
  • Text shown the user for a value of false To provide localization of "true" and "false", set up ValidationServices.TextLocalizerService with text keys, cultures and translations. Then provide values for TrueLabel and FalseLabel when registering this class in the dataTypeFormatterService.

    Returns string

  • get falseLabell10n(): null | string
  • Localization key for FalseLabel. Its value will be matched to an entry made to ValidationServices.TextLocalizerService, specific to the active culture. If setup and no entry was found in TextLocalizerService, the value from the FalseLabel property is used.

    Returns null | string

Methods

  • Evaluates the parameters to determine if its format() method should handle the value with those same parameters. It should always match the DataTypeLookupKey. It does not have to evaluate the cultureID, as there are implementations where the format() function handles eve

    Parameters

    • dataTypeLookupKey: string
    • cultureId: string

      Such as 'en-US' and 'en'

    Returns boolean

    Use its format() method when true. Do not use format() when false.

Generated using TypeDoc v0.25.12