Fix CMS translations path to src/messages.
Local Build and Deploy / deploy (push) Failing after 1m5s
Local Build and Deploy / deploy (push) Failing after 1m5s
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
d2c33145a2
commit
9b411e69b4
2 files changed
+10
-5
No files matched your search
@@ -46,6 +46,7 @@ export const saveTranslations = adminAction(
|
|||||||
async (ctx) => {
|
async (ctx) => {
|
||||||
const filePath = path.join(
|
const filePath = path.join(
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
|
"src",
|
||||||
"messages",
|
"messages",
|
||||||
`${ctx.data.locale}.json`,
|
`${ctx.data.locale}.json`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,15 +28,19 @@ const LOCALES = [
|
|||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export default async function CmsTranslationsPage() {
|
export default async function CmsTranslationsPage() {
|
||||||
const messagesDir = path.join(process.cwd(), "messages");
|
const messagesDir = path.join(process.cwd(), "src", "messages");
|
||||||
|
|
||||||
const contents: Record<string, string> = {};
|
const contents: Record<string, string> = {};
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
LOCALES.map(async (locale) => {
|
LOCALES.map(async (locale) => {
|
||||||
contents[locale] = await fs.readFile(
|
try {
|
||||||
path.join(messagesDir, `${locale}.json`),
|
contents[locale] = await fs.readFile(
|
||||||
"utf-8",
|
path.join(messagesDir, `${locale}.json`),
|
||||||
);
|
"utf-8",
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// Skip missing locale files instead of failing the whole page.
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user