📖 API Reference
Internationalization library built with TypeScript and mtcute in mind.
// i18n/en.ts
export const en = {
hello: (name: string) => `Hello, ${name}!`,
}
// i18n/ru.ts
export const ru: OtherLanguageWrap<typeof en> = {
hello: (name: string) => `Привет, ${name}!`,
}
// i18n/index.ts
export const tr = createMtcuteI18n({
primaryLanguage: {
name: 'en',
strings: en,
},
otherLanguages: { ru },
})
// main.ts
dp.onNewMessage(async (upd) => {
await upd.replyText(tr(upd, 'hello', upd.sender.displayName))
})