Files
greeneclipse 8580c996c3 Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
2026-08-09 22:47:43 +02:00

26 lines
862 B
JavaScript

import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const enPath = path.resolve(__dirname, "../src/lib/i18n/messages/en.ts");
const outPath = path.resolve(__dirname, "_en-dump.json");
function parseMessageDict(source) {
const dict = {};
const re = /"([^"\\]+)"\s*:\s*((?:"(?:\\.|[^"\\])*")|(?:`(?:\\.|[^`\\])*`))/gs;
let m;
while ((m = re.exec(source))) {
const key = m[1];
const raw = m[2];
dict[key] = raw.startsWith("`")
? raw.slice(1, -1).replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\n/g, "\n")
: JSON.parse(raw);
}
return dict;
}
const en = parseMessageDict(fs.readFileSync(enPath, "utf8"));
fs.writeFileSync(outPath, JSON.stringify(en, null, 2), "utf8");
console.log(`keys=${Object.keys(en).length} -> ${outPath}`);