Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordinal numbers plural selector are not working #44

Open
8549 opened this issue Dec 10, 2023 · 0 comments
Open

Ordinal numbers plural selector are not working #44

8549 opened this issue Dec 10, 2023 · 0 comments

Comments

@8549
Copy link

8549 commented Dec 10, 2023

The third example on the Fluent docs page "Selectors" does not work with grammY's i18n plugin.

MWE

# en.ftl
request-success = You are { NUMBER($queueLength, type:"ordinal") ->
  [1] next
  [one] the {$queueLength}st
  [two] the {$queueLength}nd
  [few] the {$queueLength}rd
  *[other] the {$queueLength}th
} in queue!
// main.ts
import { load } from "dotenv";
import { Bot, Context } from "grammy";
import { I18n, I18nFlavor } from "@grammyjs/i18n";

const env = await load();

const i18n = new I18n({
  defaultLocale: "it",
  directory: "locales",
});

const bot = new Bot<Context & I18nFlavor>(env["BOT_TOKEN"]);
bot.use(i18n);
bot.command(
  "example",
  (ctx) => ctx.reply(ctx.t("request-success", { queueLength: 2 })),
);
bot.start();

Expected result

Bot replies with "You are 2nd in queue!"

Actual result

Bot replies with "Your are 2th in queue!"
Same result if queueLength = 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant