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

+18
View File
@@ -1,6 +1,7 @@
"use server";
import { z } from "zod";
import { db, WebsiteSetting } from "@/lib/db";
import { PERMS } from "@/lib/permissions";
import { adminAction } from "@/lib/safe-action";
import { actionOk } from "@/lib/safe-action-shared";
@@ -8,6 +9,7 @@ import {
cleanupConvertedSwfs,
deleteImportedItem,
} from "@/lib/services/furni-import";
import { siteSettings } from "@/lib/services/site-settings";
export const cleanSwfFiles = adminAction(
{ permission: PERMS.ASSETS_IMPORT },
@@ -29,3 +31,19 @@ export const deleteImportedFurni = adminAction(
>,
),
);
const translateToggleSchema = z.object({ enabled: z.boolean() });
/** Persist the global "translate furniture names" setting from the studio. */
export const setFurnidataTranslateEnabled = adminAction(
{ permission: PERMS.ASSETS_IMPORT, schema: translateToggleSchema },
async (ctx) => {
const value = ctx.data.enabled ? "1" : "0";
await db
.insert(WebsiteSetting)
.values({ key: "furnidata_translate_enabled", value })
.onDuplicateKeyUpdate({ set: { value } });
await siteSettings.reload();
return actionOk({ enabled: ctx.data.enabled });
},
);