From 9b411e69b45c14498ffbb9dceff3b7113dbc37c3 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Fri, 17 Jul 2026 18:43:34 +0200 Subject: [PATCH] Fix CMS translations path to src/messages. Co-authored-by: Cursor --- src/actions/translations.ts | 1 + src/app/admin/translations/cms/page.tsx | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/actions/translations.ts b/src/actions/translations.ts index d29156ab..2fc40708 100644 --- a/src/actions/translations.ts +++ b/src/actions/translations.ts @@ -46,6 +46,7 @@ export const saveTranslations = adminAction( async (ctx) => { const filePath = path.join( process.cwd(), + "src", "messages", `${ctx.data.locale}.json`, ); diff --git a/src/app/admin/translations/cms/page.tsx b/src/app/admin/translations/cms/page.tsx index 7ddcf165..fce76a0e 100644 --- a/src/app/admin/translations/cms/page.tsx +++ b/src/app/admin/translations/cms/page.tsx @@ -28,15 +28,19 @@ const LOCALES = [ ] as const; export default async function CmsTranslationsPage() { - const messagesDir = path.join(process.cwd(), "messages"); + const messagesDir = path.join(process.cwd(), "src", "messages"); const contents: Record = {}; await Promise.all( LOCALES.map(async (locale) => { - contents[locale] = await fs.readFile( - path.join(messagesDir, `${locale}.json`), - "utf-8", - ); + try { + contents[locale] = await fs.readFile( + path.join(messagesDir, `${locale}.json`), + "utf-8", + ); + } catch { + // Skip missing locale files instead of failing the whole page. + } }), );