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.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import fs from "node:fs";
|
||||
import { EXTRA } from "./locale-extra-es.mjs";
|
||||
|
||||
function parse(s) {
|
||||
const d = {};
|
||||
const re = /"([^"\\]+)"\s*:\s*((?:"(?:\\.|[^"\\])*")|(?:`(?:\\.|[^`\\])*`))/gs;
|
||||
let m;
|
||||
while ((m = re.exec(s))) {
|
||||
const raw = m[2];
|
||||
d[m[1]] = raw.startsWith("`")
|
||||
? raw.slice(1, -1).replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\n/g, "\n")
|
||||
: JSON.parse(raw);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
const en = parse(fs.readFileSync("../src/lib/i18n/messages/en.ts", "utf8"));
|
||||
const map = {};
|
||||
for (const [k, es] of Object.entries(EXTRA.es)) {
|
||||
const e = en[k];
|
||||
if (e) map[e] = { ...(map[e] || {}), es };
|
||||
}
|
||||
fs.writeFileSync("_phrase-seed.json", JSON.stringify(map, null, 2));
|
||||
console.log(Object.keys(map).length);
|
||||
Reference in New Issue
Block a user