From 4c01f6a789fa8589f145d0a2c84558d2dd97a8ab Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Fri, 6 Mar 2026 14:39:20 +0100 Subject: [PATCH] Fix export missing localised name The change in #838 removed localised names from the exported metadata. Add it back again so that items with overriden names are translated. --- packages/host/src/export.ts | 1 + packages/lib/src/export.ts | 1 + plugins/subspace_storage/web/index.tsx | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/host/src/export.ts b/packages/host/src/export.ts index 7c12a04d..dadd34b6 100644 --- a/packages/host/src/export.ts +++ b/packages/host/src/export.ts @@ -411,6 +411,7 @@ async function exportItems( x: iconPos * SHEET_ICON_SIZE % SHEET_WIDTH, y: Math.floor(iconPos / (SHEET_WIDTH / SHEET_ICON_SIZE)) * SHEET_ICON_SIZE, size: SHEET_ICON_SIZE, + localised_name: item.localised_name, category, ...(iconPath ? { path: iconPath } : {}), }); diff --git a/packages/lib/src/export.ts b/packages/lib/src/export.ts index 71f3a18b..d461471a 100644 --- a/packages/lib/src/export.ts +++ b/packages/lib/src/export.ts @@ -113,6 +113,7 @@ export interface ExportMetadataEntry { x: number, y: number, size: number, + localised_name?: FactorioLocalisedString, category: string, path?: string, } diff --git a/plugins/subspace_storage/web/index.tsx b/plugins/subspace_storage/web/index.tsx index 0ddb3b56..9c81fb02 100644 --- a/plugins/subspace_storage/web/index.tsx +++ b/plugins/subspace_storage/web/index.tsx @@ -41,9 +41,13 @@ function StoragePage() { function getLocaleName(itemName: string) { let localeName = itemName; let meta = itemMetadata.get(itemName); - if (meta && (meta as any).localised_name) { + if (meta && meta.localised_name) { // TODO: implement the locale to name conversion. - localeName = locale.get((meta as any).localised_name[0])!; + if (typeof meta.localised_name === "string") { + localeName = meta.localised_name; + } else { + localeName = locale.get(meta.localised_name[0])!; + } } else { for (let section of ["item-name", "entity-name", "fluid-name", "equipment-name"]) { let name = locale.get(`${section}.${itemName}`);