scripts: add full build/translate scripts for furnidata i18n
This commit is contained in:
1 parent
2339485e9a
commit
e66b2c1a5a
3 files changed
+351
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import "./load-env";
|
||||
import { buildLocalizedFurniDataFiles } from "../src/lib/services/furni-data-i18n";
|
||||
|
||||
async function main() {
|
||||
const args = process.argv.slice(2);
|
||||
const maxPerLang = args.includes("--full")
|
||||
? undefined
|
||||
: args.includes("--limit")
|
||||
? parseInt(args[args.indexOf("--limit") + 1] || "2000", 10)
|
||||
: 1500;
|
||||
const full = args.includes("--full");
|
||||
console.log(
|
||||
`[translate-furnidata] Starting ${full ? "FULL" : `limited ${maxPerLang} per lang`} build...`,
|
||||
);
|
||||
const start = Date.now();
|
||||
try {
|
||||
const results = await buildLocalizedFurniDataFiles(
|
||||
full ? {} : { maxPerLang },
|
||||
);
|
||||
const elapsed = ((Date.now() - start) / 1000).toFixed(1);
|
||||
console.log(`[translate-furnidata] Done in ${elapsed}s`);
|
||||
for (const r of results) {
|
||||
console.log(
|
||||
` ${r.lang} (${r.hotel}): ${r.translatedRoom + r.translatedWall}/${r.total} translated -> ${r.file} ${r.ok ? "OK" : `FAIL ${r.error}`}`,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed", e);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
main();
|
||||
Reference in new issue
Block a user