feat: auto-translate furnidata per import (nl/en/de/fr/es/tr/it)
CI / check (push) Successful in 29s
CI / release (push) Skipped
CI / deploy (push) Successful in 54s

Generate localized FurnitureData_<lang>.json files from the master
FurnitureData.json + official Habbo hotel translations. Fetches per-hotel
furnidata with in-memory cache (6h TTL), maps by classname (* variant
aware), and overrides name/description where a translation exists.

Full rebuild after every batch/batch-regen/clone import and as admin
GET ?action=build-languages; single imports patch incrementally via
patchLocalizedFurniDataEntries. Failures are best-effort and never fail
the import itself. Files are written to every configured gamedata write
path (primary + mirrors) so /gamedata/config/FurnitureData_<lang>.json
is available for per-language Nitro clients.

New service: src/lib/services/furni-data-i18n.ts with
buildLocalizedFurniDataFiles, patchLocalizedFurniDataEntries,
FURNIDATA_LANGUAGES (nl/en/de/fr/es/tr/it) and applyTranslationsForTest.
This commit is contained in:
openhands committed 2026-08-21 14:16:37 +02:00
1 parent 984b5bf793
commit 8bb339cc49
5 files changed
+519

No files matched your search

@@ -9,6 +9,7 @@ import {
reconcileFurniDataWithItemsBase,
verifyAndFixSpriteIds,
} from "@/lib/services/furni-data";
import { buildLocalizedFurniDataFiles } from "@/lib/services/furni-data-i18n";
import {
ensureDirectories,
ensureFurniOwnership,
@@ -232,6 +233,9 @@ export const POST = withAdmin(
let offerRebuildFixed = 0;
let spriteFixed = 0;
let interactionFixed = 0;
let languages: Awaited<
ReturnType<typeof buildLocalizedFurniDataFiles>
> = [];
try {
offerIdsFixed = (await reconcileImportedOfferIds()).fixed;
ownershipFixed = (await ensureFurniOwnership()).fixed;
@@ -246,6 +250,14 @@ export const POST = withAdmin(
offerRebuildFixed = (await rebuildCatalogOfferIds()).fixed;
spriteFixed = (await verifyAndFixSpriteIds()).fixed;
interactionFixed = (await verifyAndFixInteractionModesCount()).fixed;
try {
languages = await buildLocalizedFurniDataFiles();
} catch (err) {
console.warn(
"[import-furni] Localized furnidata build failed:",
(err as Error).message,
);
}
} catch (err) {
console.warn(
"[import-furni] Post-import reconcile/ownership failed:",
@@ -269,6 +281,7 @@ export const POST = withAdmin(
offerRebuildFixed,
spriteFixed,
interactionFixed,
languages,
duration: Date.now() - startTime,
});