feat(insights): fix DBSCAN, Persian embeddings crash, D3 physics layouts, and D3 node not found runtime error
This commit is contained in:
31
memento-note/extension/scripts/build-extension-locales.mjs
Normal file
31
memento-note/extension/scripts/build-extension-locales.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Genere extension/_locales/<lang>/messages.json depuis i18n/translations.json
|
||||
* Usage: node scripts/build-extension-locales.mjs
|
||||
*/
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const extRoot = path.resolve(__dirname, '..')
|
||||
const srcPath = path.join(extRoot, 'i18n', 'translations.json')
|
||||
const outRoot = path.join(extRoot, '_locales')
|
||||
|
||||
const { version, strings } = JSON.parse(fs.readFileSync(srcPath, 'utf8'))
|
||||
const langs = Object.keys(strings)
|
||||
|
||||
for (const lang of langs) {
|
||||
const dir = path.join(outRoot, lang)
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
const messages = {}
|
||||
for (const [key, def] of Object.entries(strings[lang])) {
|
||||
const entry = { message: def.message.replace(/\{version\}/g, version) }
|
||||
if (def.description) entry.description = def.description
|
||||
if (def.placeholders) entry.placeholders = def.placeholders
|
||||
messages[key] = entry
|
||||
}
|
||||
fs.writeFileSync(path.join(dir, 'messages.json'), JSON.stringify(messages, null, 2) + '\n')
|
||||
}
|
||||
|
||||
console.log(`Generated ${langs.length} locales in ${outRoot}`)
|
||||
Reference in New Issue
Block a user