From 1b16657a21f27139423097f117636503fe43cb96 Mon Sep 17 00:00:00 2001 From: strbit Date: Thu, 29 Aug 2024 12:20:25 +0500 Subject: [PATCH] fix: small changes --- README.md | 1 + examples/deno.ts | 4 ++++ examples/locales/ckb.ftl | 6 ++++++ examples/locales/de.ftl | 7 +++++++ examples/locales/en.ftl | 7 +++++++ examples/locales/ku.ftl | 6 ++++++ examples/locales/ru/multiline.ftl | 5 +++++ examples/node.ts | 6 +++++- 8 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 examples/locales/ru/multiline.ftl diff --git a/README.md b/README.md index d6f662b4..f6fec036 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ import { I18n, I18nFlavor } from "https://deno.land/x/grammy_i18n/mod.ts"; An example project structure, you can also seperate your translations into different files to make it easier to maintain large projects. Nested translations don't change how you use translation keys, so nothing should break if you decide to use them. + ``` . ├── locales/ diff --git a/examples/deno.ts b/examples/deno.ts index f1b8701d..4ba57873 100644 --- a/examples/deno.ts +++ b/examples/deno.ts @@ -62,4 +62,8 @@ bot.command("checkout", async (ctx) => { await ctx.reply(ctx.t("checkout")); }); +bot.command("multiline", async (ctx) => { + await ctx.reply(ctx.t("multiline")); +}); + bot.start(); diff --git a/examples/locales/ckb.ftl b/examples/locales/ckb.ftl index c495dd15..8f2f11bb 100644 --- a/examples/locales/ckb.ftl +++ b/examples/locales/ckb.ftl @@ -2,3 +2,9 @@ greeting = سڵاو، { $first_name }! cart = سڵاو، { $first_name }، لە سەبەتەکەتدا{ $apples } سێو هەن. checkout = سپاس بۆ بازاڕیکردنەکەت! language-set = کوردی هەڵبژێردرا! +multiline = + ئەمەش نموونەی... + ئە + فرە هێڵی + پەیام + بۆ ئەوەی بزانین چۆن فۆرمات کراون! diff --git a/examples/locales/de.ftl b/examples/locales/de.ftl index c99062ec..19db75e7 100644 --- a/examples/locales/de.ftl +++ b/examples/locales/de.ftl @@ -10,3 +10,10 @@ cart = { $first_name }, es { checkout = Danke für deinen Einkauf! language-set = Die Sprache wurde zu Deutsch geändert! + +multiline = + Dies ist ein Beispiel für + eine + mehrzeilige + Nachricht, + um zu sehen, wie sie formatiert sind! diff --git a/examples/locales/en.ftl b/examples/locales/en.ftl index fb1350e9..ba84c8a2 100644 --- a/examples/locales/en.ftl +++ b/examples/locales/en.ftl @@ -10,3 +10,10 @@ cart = { $first_name }, there { checkout = Thank you for purchasing! language-set = Language has been set to English! + +multiline = + This is an example of + a + multiline + message + to see how they are formatted! diff --git a/examples/locales/ku.ftl b/examples/locales/ku.ftl index 06419c44..b05ee8da 100644 --- a/examples/locales/ku.ftl +++ b/examples/locales/ku.ftl @@ -2,3 +2,9 @@ greeting = Silav, { $first_name }! cart = { $first_name }, di sepeta te de { $apples } sêv hene. checkout = Spas bo kirîna te! language-set = Kurdî hate hilbijartin! +multiline = + Ev mînakek e + yek + multiline + agah + da ku bibînin ka ew çawa têne format kirin! diff --git a/examples/locales/ru/multiline.ftl b/examples/locales/ru/multiline.ftl new file mode 100644 index 00000000..d2cc6c53 --- /dev/null +++ b/examples/locales/ru/multiline.ftl @@ -0,0 +1,5 @@ +multiline = + Это пример + многострочных + сообщений + чтобы увидеть, как они отформатированы! diff --git a/examples/node.ts b/examples/node.ts index 126e41c9..77b9ad66 100644 --- a/examples/node.ts +++ b/examples/node.ts @@ -33,7 +33,7 @@ bot.command("start", async (ctx) => { await ctx.reply(ctx.t("greeting")); }); -bot.command(["en", "de", "ku", "ckb"], async (ctx) => { +bot.command(["en", "de", "ku", "ckb", "ru"], async (ctx) => { const locale = ctx.msg.text.substring(1).split(" ")[0]; await ctx.i18n.setLocale(locale); await ctx.reply(ctx.t("language-set")); @@ -58,4 +58,8 @@ bot.command("checkout", async (ctx) => { await ctx.reply(ctx.t("checkout")); }); +bot.command("multiline", async (ctx) => { + await ctx.reply(ctx.t("multiline")); +}); + bot.start();