Spaces:
Configuration error
Configuration error
Download scripts/format-lang.js from SreejithSHR/umami: direct link, hf CLI and curl.
- Browser
- Download file 873 Bytes
-
https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/scripts/format-lang.js
- Command line
-
hf download hf://spaces/SreejithSHR/umami/scripts/format-lang.js
-
curl -L -o format-lang.js https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/scripts/format-lang.js
873 Bytes
| const fs = require('fs-extra'); | |
| const path = require('path'); | |
| const del = require('del'); | |
| const prettier = require('prettier'); | |
| const src = path.resolve(__dirname, '../src/lang'); | |
| const dest = path.resolve(__dirname, '../build/messages'); | |
| const files = fs.readdirSync(src); | |
| del.sync([path.join(dest)]); | |
| /* | |
| This script takes the files from the `lang` folder and formats them into | |
| the format that format-js expects. | |
| */ | |
| async function run() { | |
| await fs.ensureDir(dest); | |
| files.forEach(file => { | |
| const lang = require(`../src/lang/${file}`); | |
| const keys = Object.keys(lang).sort(); | |
| const formatted = keys.reduce((obj, key) => { | |
| obj[key] = { defaultMessage: lang[key] }; | |
| return obj; | |
| }, {}); | |
| const json = prettier.format(JSON.stringify(formatted), { parser: 'json' }); | |
| fs.writeFileSync(path.resolve(dest, file), json); | |
| }); | |
| } | |
| run(); | |