From cbbde963dc207ac8a018f91a8274da61ec2615e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20J=C3=A4derberg?= Date: Mon, 12 May 2025 07:57:11 +0000 Subject: [PATCH] Merged in fix/my-pages-menu-not-translated (pull request #2045) fix: my pages menu not translated * fix: my pages menu not translated fix: able to pass lang to getIntl() Approved-by: Michael Zetterberg --- apps/scandic-web/i18n/index.ts | 4 ++-- .../server/routers/navigation/mypages/getPrimaryLinks.ts | 3 ++- .../server/routers/navigation/mypages/getSecondaryLinks.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/scandic-web/i18n/index.ts b/apps/scandic-web/i18n/index.ts index 6fdb994fb..8d72b208f 100644 --- a/apps/scandic-web/i18n/index.ts +++ b/apps/scandic-web/i18n/index.ts @@ -16,8 +16,8 @@ export async function getMessages(lang: Lang): Promise> { return (await import(`./dictionaries/${lang}.json`)).default } -export async function getIntl() { - const lang = getLang() +export async function getIntl(options?: { lang: Lang | undefined }) { + const lang = options?.lang || getLang() if (!instances[lang]) { const messages = await getMessages(lang) diff --git a/apps/scandic-web/server/routers/navigation/mypages/getPrimaryLinks.ts b/apps/scandic-web/server/routers/navigation/mypages/getPrimaryLinks.ts index 5f245938e..f1ab9e0c7 100644 --- a/apps/scandic-web/server/routers/navigation/mypages/getPrimaryLinks.ts +++ b/apps/scandic-web/server/routers/navigation/mypages/getPrimaryLinks.ts @@ -19,7 +19,8 @@ export const getPrimaryLinks = cache( lang: Lang userLoyalty: UserLoyalty }): Promise => { - const intl = await getIntl() + const intl = await getIntl({ lang }) + const showSASLink = isScandicXSASActive(userLoyalty) const [showTeamMemberLink] = await safeTry(showTeamMemberCard()) diff --git a/apps/scandic-web/server/routers/navigation/mypages/getSecondaryLinks.ts b/apps/scandic-web/server/routers/navigation/mypages/getSecondaryLinks.ts index d8f0d46ec..d57fce926 100644 --- a/apps/scandic-web/server/routers/navigation/mypages/getSecondaryLinks.ts +++ b/apps/scandic-web/server/routers/navigation/mypages/getSecondaryLinks.ts @@ -10,7 +10,7 @@ export async function getSecondaryLinks({ }: { lang: Lang }): Promise { - const intl = await getIntl() + const intl = await getIntl({ lang }) const menuItems: MyPagesLink[] = [ { type: "link",