From 1daada076c6f59c76e62db6d177ccc8c621b4111 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 9 Sep 2026 19:08:39 +0200 Subject: [PATCH] fix(catalog): sync localized FurniData files when translating items via admin UI translateCatalogItems previously only patched the master FurnitureData.json via patchFurniEntryNames but never updated the per-language files (FurnitureData_nl.json, etc.). Custom/imported furniture translated through the catalog Translate tab was therefore invisible in localized builds. After patching the master file, the action now also calls patchLocalizedFurniDataEntries so LibreTranslate translates the English names into all 13 supported languages. --- src/actions/catalog-items.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/actions/catalog-items.ts b/src/actions/catalog-items.ts index f4a5ee4104..2c9c8d3b64 100644 --- a/src/actions/catalog-items.ts +++ b/src/actions/catalog-items.ts @@ -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,