Skip to content

Commit

Permalink
chore: update i18n plugin docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Dec 2, 2024
1 parent 27aa5b7 commit 1562bbb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/plugins/official/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,20 @@ import {

const en = {
greeting: (name: string) => format`Hello, ${name}!`,
and: {
some: {
nested: "Hi!!!",
},
},
} satisfies LanguageMap;

const ru = {
greeting: (name: string) => format`Привет, ${name}!`,
and: {
some: {
nested: "Hi!!!",
},
},
} satisfies ShouldFollowLanguage<typeof en>;

// Strict will show error on missing keys
Expand All @@ -68,6 +78,7 @@ const i18n = defineI18n({
});

i18n.t("en", "greeting", "World"); // Hello, World!
i18n.t("en", "and.some.nested"); // Hi!!!

const bot = new Bot(process.env.BOT_TOKEN as string)
.derive("message", (context) => {
Expand Down

0 comments on commit 1562bbb

Please sign in to comment.