@botmesh/core - v2.0.0-alpha.2
    Preparing search index...
    Index
    • Apply i18n options (marks the registry as enabled). Throws TypeError on invalid values.

      Parameters

      Returns this

    • Deep-merge messages into locale code. Throws TypeError on an invalid code or tree.

      Parameters

      Returns this

    • Set the default locale WITHOUT turning on language resolution (BotConfig.lang): the built-in texts and ctx.lang use code, and no ctx.user read, provider language or detector is consulted. Throws TypeError on an empty code.

      Parameters

      • code: string

      Returns this

    • Registered locale codes (built-ins included).

      Returns string[]

    • The registered locale serving code: itself, else its base language ('es-AR' → 'es'). undefined when neither is registered, or when the locales allow-list leaves it out (the default locale is always served).

      Parameters

      • code: unknown

      Returns string | undefined

    • Translate key for lang (see the class docs for the fallback chain). Never throws: a key missing everywhere comes back as the key itself.

      Parameters

      Returns string

    • Resolve the language of an inbound context: the ctx.user preference → the provider-reported language → the detector's answer → the default. Each candidate only counts when a registered locale serves it (supported), so the result is always a registered locale or the default. Never rejects. Returns the default immediately while i18n is not enabled.

      Parameters

      Returns Promise<string>

    • The stored preference of a profile (the registered locale serving it), else the default locale. Agrees with resolve: while i18n is not enabled it is always the default. Never rejects.

      Parameters

      Returns Promise<string>

    • Forget the provider-reported language remembered for sender (subject erasure, bot.deleteSubject()). Returns whether one was remembered.

      Parameters

      • sender: string

      Returns boolean

    • get defaultLocale(): string

      The default locale (normalized).

      Returns string

    • get userKey(): string

      ctx.user key holding the language preference.

      Returns string

    • get enabled(): boolean

      True once locales were registered or options configured — language resolution is active.

      Returns boolean

    • get hasDetector(): boolean

      Whether a custom detector is configured (its answer may depend on ctx.body).

      Returns boolean