Creates the built-in internationalization Plugin.
The middleware resolves a locale per update (stored preference, then Telegram language_code, then default_locale) and attaches an I18nSession readable through i18nFor.
language_code
default_locale
Translation tables and locale configuration.
A Plugin to install with app.usePlugin(...).
app.usePlugin(...)
import { plugins, i18nFor } from "telebot-ts";app.usePlugin( plugins.i18n({ default_locale: "en", locales: { en: { hello: "Hello!" }, vi: { hello: "Xin chào!" } }, }),);app.on("message", async (update, context) => { await context.reply(i18nFor(context)!.t("hello"));}); Copy
import { plugins, i18nFor } from "telebot-ts";app.usePlugin( plugins.i18n({ default_locale: "en", locales: { en: { hello: "Hello!" }, vi: { hello: "Xin chào!" } }, }),);app.on("message", async (update, context) => { await context.reply(i18nFor(context)!.t("hello"));});
Creates the built-in internationalization Plugin.
The middleware resolves a locale per update (stored preference, then Telegram
language_code, thendefault_locale) and attaches an I18nSession readable through i18nFor.