feat: per-import translation toggle and language picker in studio
CI / check (push) Successful in 28s
CI / release (push) Skipped
CI / deploy (push) Successful in 53s

Furni imports can now choose whether to translate (per import) and which
languages to build, instead of always rebuilding all 13 FurnitureData_<lang>
files. The studio header also has a global switch that persists the
furnidata_translate_enabled setting, seeding the per-import default.
This commit is contained in:
openhands committed 2026-08-24 18:16:42 +02:00
1 parent d6af754211
commit 6dced0fb54
5 files changed
+223 -10

No files matched your search

+29 -6
View File
@@ -527,11 +527,24 @@ export const POST = withAdmin(
const { catalogNameFixed, haveOfferFixed, costCreditsFixed } =
await fixDatabaseConsistencyAfterImport();
// Rebuild all localized furnidata files (best effort)
// Rebuild localized furnidata files (best effort). `translate: false`
// skips entirely; `translate: true` forces a build even when the global
// setting is off; undefined falls back to the global setting. An optional
// `langs` array restricts which languages are rebuilt.
let languages: Awaited<ReturnType<typeof buildLocalizedFurniDataFiles>> =
[];
try {
languages = await buildLocalizedFurniDataFiles();
if (body.translate !== false) {
const langs = Array.isArray(body.langs)
? (body.langs as unknown[]).filter(
(l): l is string => typeof l === "string",
)
: undefined;
languages = await buildLocalizedFurniDataFiles(
body.translate === true,
langs,
);
}
} catch (err) {
console.warn(
"[import-furni] Localized furnidata build failed:",
@@ -638,14 +651,24 @@ export const POST = withAdmin(
// Verify + fix interaction_modes_count (single consolidated pass)
const verification = await verifyAndFixInteractionModesCount();
// Patch localized furnidata files for this single furni (best effort)
// Patch localized furnidata files for this single furni (best effort).
// Same `translate` / `langs` contract as the batch path above.
let languagesPatch: Awaited<
ReturnType<typeof patchLocalizedFurniDataEntries>
> = [];
try {
languagesPatch = await patchLocalizedFurniDataEntries([
{ classname, name, description: description ?? "" },
]);
if (body.translate !== false) {
const langs = Array.isArray(body.langs)
? (body.langs as unknown[]).filter(
(l): l is string => typeof l === "string",
)
: undefined;
languagesPatch = await patchLocalizedFurniDataEntries(
[{ classname, name, description: description ?? "" }],
body.translate === true,
langs,
);
}
} catch (err) {
console.warn(
"[import-furni] Localized patch failed:",