Merge branch 'main' of https://gitlab.epicnabbo.nl/remco/EpicNext-Cms
This commit is contained in:
commit
2fead134e6
1 file changed
+22
@@ -292,6 +292,9 @@ export async function translateCatalogItems(input: {
|
||||
"@/lib/services/catalog-items-loader"
|
||||
);
|
||||
const { patchFurniEntryNames } = await import("@/lib/services/furni-data");
|
||||
const { patchLocalizedFurniDataEntries } = await import(
|
||||
"@/lib/services/furni-data-i18n"
|
||||
);
|
||||
|
||||
let namesUpdated = 0;
|
||||
let descriptionsUpdated = 0;
|
||||
@@ -303,6 +306,11 @@ export async function translateCatalogItems(input: {
|
||||
spriteId?: number;
|
||||
createIfMissing?: boolean;
|
||||
}> = [];
|
||||
const localizedEntries: Array<{
|
||||
classname: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
}> = [];
|
||||
|
||||
for (const item of items) {
|
||||
const [base] = await db
|
||||
@@ -356,6 +364,7 @@ export async function translateCatalogItems(input: {
|
||||
|
||||
if (nextDesc !== "" || nameChanged) {
|
||||
descriptionsUpdated += nextDesc !== "" ? 1 : 0;
|
||||
const englishName = base.publicName?.trim() || base.itemName || "";
|
||||
furniPatches.push({
|
||||
classname: base.itemName,
|
||||
itemType: base.type || "s",
|
||||
@@ -364,6 +373,11 @@ export async function translateCatalogItems(input: {
|
||||
spriteId: base.spriteId,
|
||||
createIfMissing: true,
|
||||
});
|
||||
localizedEntries.push({
|
||||
classname: base.itemName,
|
||||
name: englishName,
|
||||
description: nextDesc || undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,6 +389,14 @@ export async function translateCatalogItems(input: {
|
||||
invalidateFurniDataCache();
|
||||
}
|
||||
|
||||
if (localizedEntries.length > 0) {
|
||||
try {
|
||||
await patchLocalizedFurniDataEntries(localizedEntries, true);
|
||||
} catch {
|
||||
// Best-effort: localized files update is non-critical
|
||||
}
|
||||
}
|
||||
|
||||
await sendCatalogUpdate();
|
||||
await logAudit({
|
||||
userId: staff.id,
|
||||
|
||||
Reference in new issue
Block a user