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. + } }), );