Options
All
  • Public
  • Public/Protected
  • All
Menu

Module runtime/src/main

Index

Type aliases

ArgumentRenderer

ArgumentRenderer<Result>: (locale: string, value: unknown) => Result

Type parameters

  • Result

    The type of the rendering result.

Type declaration

    • (locale: string, value: unknown): Result
    • Renders an arbitrary argument value.

      Parameters

      • locale: string

        The locale passed to the message function or a default locale.

      • value: unknown

        The argument value.

      Returns Result

      The formatted argument.

ElementRenderer

ElementRenderer<Result>: (tagName: string, attributes?: Record<string, Result> | null, ...children: Result[]) => Result

Type parameters

  • Result

    The type of the rendering result.

Type declaration

    • (tagName: string, attributes?: Record<string, Result> | null, ...children: Result[]): Result
    • Renders an element by tagName.

      Parameters

      • tagName: string

        The name of the tag to render.

      • Optional attributes: Record<string, Result> | null

        The element attributes.

      • Rest ...children: Result[]

        The element children varargs.

      Returns Result

      The rendered element.

FragmentRenderer

FragmentRenderer<Result>: (...children: Result[]) => Result

Type parameters

  • Result

    The type of the rendering result.

Type declaration

    • (...children: Result[]): Result
    • Renders a fragment.

      Parameters

      • Rest ...children: Result[]

        The fragment children varargs.

      Returns Result

      A rendered fragment.

FunctionRenderer

FunctionRenderer<Result>: (locale: string, value: unknown, name: string, param?: Result) => Result

Type parameters

  • Result

    The type of the rendering result.

Type declaration

    • (locale: string, value: unknown, name: string, param?: Result): Result
    • Renders an argument value formatted using a function.

      Parameters

      • locale: string

        The locale passed to the message function or a default locale.

      • value: unknown

        An argument value.

      • name: string

        The formatter function name.

      • Optional param: Result

        An optional additional param.

      Returns Result

      The formatted argument.

LocaleMatcher

LocaleMatcher: (locale: string, locales: string[]) => number

Type declaration

    • (locale: string, locales: string[]): number
    • Looks up a locale among locales that best fits locale.

      Parameters

      • locale: string

        The locale passed to the message function.

      • locales: string[]

        The list of locales supported by the message.

      Returns number

      The index of a locale from locales that matches locale or -1 to use the default locale.

PluralMatcher

PluralMatcher: (locale: string, value: number) => number

Type declaration

    • (locale: string, value: number): number
    • Detects the plural category that should be used for cardinal pluralization of value with the locale.

      Parameters

      • locale: string

        The locale passed to the message function or a default locale.

      • value: number

        An argument value.

      Returns number

      The index of the plural category from pluralCategories.

SelectMatcher

SelectMatcher: (value: unknown, ...caseKeys: string[]) => number

Type declaration

    • (value: unknown, ...caseKeys: string[]): number
    • Matches value with case keys.

      Parameters

      • value: unknown

        An argument value.

      • Rest ...caseKeys: string[]

        Case keys varargs.

      Returns number

      The index of a case key from caseKeys that matches value or -1 if no case was found. If -1 is returned then the case with "other" key would be used if it was provided.

SelectOrdinalMatcher

SelectOrdinalMatcher: (locale: string, value: number) => number

Type declaration

    • (locale: string, value: number): number
    • Detects the plural category that should be used for ordinal pluralization of value with the locale.

      Parameters

      • locale: string

        The locale passed to the message function or a default locale.

      • value: number

        An argument value.

      Returns number

      The index of the plural category from pluralCategories.

Variables

Const pluralCategories

pluralCategories: string[] = ...

The ordered list of plural categories.

Functions

createPluralMatcher

createRuntime

createStringRuntime

Const selectMatcher

  • selectMatcher(value: unknown, ...caseKeys: string[]): number

Generated using TypeDoc