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