// Node script: load all lang files via require and dump as JSON for Python to consume. const fs = require('fs'); const path = require('path'); const langDir = path.resolve(process.cwd(), 'lang', process.argv[2]); function walk(dir) { const out = {}; if (!fs.existsSync(dir)) return out; for (const f of fs.readdirSync(dir)) { const full = path.join(dir, f); const stat = fs.statSync(full); if (stat.isDirectory()) { Object.assign(out, walk(full)); } else if (f.endsWith('.js')) { try { const m = require(full); if (m && m.lang && typeof m.lang === 'object') { out[full] = m.lang; } } catch (e) {} } } return out; } console.log(JSON.stringify(walk(langDir), null, 2));