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

+13 -2
View File
@@ -433,6 +433,7 @@ function cloneFurniData(
*/
export async function buildLocalizedFurniDataFiles(
force = false,
langs?: readonly string[],
): Promise<LanguageFileResult[]> {
if (!force && !(await translationEnabled())) {
logger.debug(
@@ -440,6 +441,10 @@ export async function buildLocalizedFurniDataFiles(
);
return [];
}
const langsToBuild =
langs && langs.length > 0
? FURNIDATA_LANGUAGES.filter((l) => langs.includes(l.lang))
: FURNIDATA_LANGUAGES;
return withFurniDataLock(async () => {
const master = (await readFurniData()) as Record<
string,
@@ -448,7 +453,7 @@ export async function buildLocalizedFurniDataFiles(
// Fetch all language maps in parallel (uses per-hotel memory cache).
const maps = await Promise.all(
FURNIDATA_LANGUAGES.map(async ({ lang, hotel }) => {
langsToBuild.map(async ({ lang, hotel }) => {
const map = await fetchTranslationsForHotel(hotel);
return { lang, hotel, map };
}),
@@ -577,6 +582,7 @@ export async function buildLocalizedFurniDataFiles(
export async function patchLocalizedFurniDataEntries(
entries: Array<{ classname: string; name?: string; description?: string }>,
force = false,
langs?: readonly string[],
): Promise<LanguageFileResult[]> {
if (entries.length === 0) return [];
if (!force && !(await translationEnabled())) {
@@ -586,9 +592,14 @@ export async function patchLocalizedFurniDataEntries(
return [];
}
const langsToBuild =
langs && langs.length > 0
? FURNIDATA_LANGUAGES.filter((l) => langs.includes(l.lang))
: FURNIDATA_LANGUAGES;
return withFurniDataLock(async () => {
const maps = await Promise.all(
FURNIDATA_LANGUAGES.map(async ({ lang, hotel }) => {
langsToBuild.map(async ({ lang, hotel }) => {
const map = await fetchTranslationsForHotel(hotel);
return { lang, hotel, map };
}),