@termun/core - v0.0.0
    Preparing search index...
    Index

    Constructors

    • Creates a new Label for translations.

      Parameters

      • name: string

        Translation key string (e.g., "plugin.action.title").

      • Optionalcallback: (
            value: string | undefined,
            translate: (value: string) => string | undefined,
        ) => string

        Optional interpolation function applied during translation lookup.

      Returns Label

    Methods

    • Returns the translation key name.

      Returns string

    • Sets the translation key name.

      Parameters

      • name: string

        Translation key (e.g., "plugin.menu.question").

      Returns this

    • Returns the optional interpolation callback, or undefined if not set.

      Returns
          | (
              (
                  value: string | undefined,
                  translate: (value: string) => string | undefined,
              ) => string
          )
          | undefined

    • Sets the optional interpolation callback applied during translation lookup.

      Parameters

      • callback:
            | (
                (
                    value: string | undefined,
                    translate: (value: string) => string | undefined,
                ) => string
            )
            | undefined

        Function receiving translated value and translate helper.

      Returns this

    • Returns the translated value of this label. Applies the optional interpolation callback if configured.

      Parameters

      • Optionallanguage: string

        Optional language override.

      Returns string

    • Renders and returns the translated label as a styled string.

      Parameters

      • Optionaloptions: { prefix?: string; color?: ColorName; language?: string; append?: string }

      Returns string

    • Renders and logs the translated label to console.

      Parameters

      • Optionaloptions: { prefix?: string; color?: ColorName; language?: string; append?: string }

      Returns void

    • Serialises the label to a plain JSON object with translation key and current value.

      Returns { name: string; value: string }

    Properties

    name: string
    callback?: (
        value: string | undefined,
        translate: (value: string) => string | undefined,
    ) => string