0.19.0 • Published 10 months ago
@mtcute/i18n v0.19.0
@mtcute/i18n
Internationalization library built with TypeScript and mtcute in mind.
Features
- Type-safe: All string keys and parameters are type-checked
 - Plurals: Supports pluralization
 - Customizable: Supports custom locales and customizing existing ones
 - Pluggable: Can be used with any library, not just mtcute. Can also be used with other i18n libraries.
 
Usage
// 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))
})0.18.0-rc.5
11 months ago
0.19.0
10 months ago
0.18.0
10 months ago
0.17.0
1 year ago
0.16.9
1 year ago
0.16.7
1 year ago
0.13.0
1 year ago
0.14.0
1 year ago
0.15.0
1 year ago
0.16.0
1 year ago
0.12.0
1 year ago
0.11.0
2 years ago
0.10.0
2 years ago
0.9.0
2 years ago
0.8.0
2 years ago
0.7.0
2 years ago
0.5.0
2 years ago
0.6.0
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago