telebot-ts API Documentation - v1.0.0
    Preparing search index...

    Interface I18nSession

    Per-update translation session attached to the CallbackContext by the i18n middleware.

    interface I18nSession {
        locale: string;
        setLocale(locale: string): void;
        t(key: string, params?: Record<string, string | number>): string;
    }
    Index
    locale: string

    Locale code resolved for the current update.

    • Persists the user's locale preference for all future updates.

      Parameters

      • locale: string

        Locale code to use from now on.

      Returns void

    • Translates a message key for the resolved locale, falling back to the default locale, then to the key itself. {placeholder} tokens are replaced from params.

      Parameters

      • key: string

        Message key in the translation tables.

      • Optionalparams: Record<string, string | number>

        Optional placeholder values.

      Returns string

      The translated string.