From f2ee19f15a78125a1dc2ba8b9c175dd9831e5700 Mon Sep 17 00:00:00 2001 From: INOUE Daisuke Date: Thu, 20 Mar 2025 22:54:38 +0900 Subject: hidden attendees (? people) --- src/app.ts | 6 ------ src/routes/frontend.ts | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/app.ts b/src/app.ts index 9828905..9301484 100755 --- a/src/app.ts +++ b/src/app.ts @@ -125,12 +125,6 @@ async function initializeApp() { console.error('handlebars-i18next helper is not properly loaded'); } - - (hbsInstance.handlebars as typeof Handlebars).registerHelper('pluralize', function(count: number, key: string, options: any) { - const translation = i18next.t(key, { count: count }); - return translation; - }); - app.engine("handlebars", hbsInstance.engine); app.set("view engine", "handlebars"); app.set("hbsInstance", hbsInstance); diff --git a/src/routes/frontend.ts b/src/routes/frontend.ts index 96d7587..40b5393 100644 --- a/src/routes/frontend.ts +++ b/src/routes/frontend.ts @@ -19,6 +19,7 @@ import MagicLink from "../models/MagicLink.js"; import { getConfigMiddleware } from "../lib/middleware.js"; import { getMessage } from "../util/messages.js"; import { EventListEvent, bucketEventsByMonth } from "../lib/event.js"; +import i18next from "i18next"; const router = Router(); @@ -257,7 +258,7 @@ router.get("/:eventID", async (req: Request, res: Response) => { el.id = el._id; } if (el.number && el.number > 1) { - el.name = `${el.name} (${el.number} people)`; + el.name = `${el.name} ${i18next.t("frontend.elnumber", { count: el.number })}`; } return { ...el, -- cgit v1.2.3