docs-i18n 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/assemble-IOHQYYHI.js +74 -0
- package/dist/build-4EQEL4NI.js +12 -0
- package/dist/build2-3W5WMFHZ.js +4901 -0
- package/dist/chunk-3YNFMSJH.js +30 -0
- package/dist/chunk-55MBYBVK.js +368 -0
- package/dist/chunk-7HWWVRNS.js +104 -0
- package/dist/chunk-AKLW2MUS.js +54 -0
- package/dist/chunk-FYDB7MZX.js +38944 -0
- package/dist/chunk-O35QHRY6.js +6 -0
- package/dist/chunk-PTIH4GGE.js +44 -0
- package/dist/chunk-QSVWLTGQ.js +60 -0
- package/dist/chunk-SUIDX6IZ.js +122 -0
- package/dist/chunk-VKKNQBDN.js +6487 -0
- package/dist/chunk-XEOYZUHS.js +396 -0
- package/dist/cli.js +104 -0
- package/dist/dist-6C32URTL.js +19 -0
- package/dist/dist-HOWMMQFV.js +6677 -0
- package/dist/false-JGP4AGWN.js +7 -0
- package/dist/index.d.ts +258 -0
- package/dist/index.js +545 -0
- package/dist/main-QVE5TVA3.js +2505 -0
- package/dist/node-4GLCLDJ6.js +875 -0
- package/dist/node-NUDVMOF2.js +129 -0
- package/dist/postcss-3SK7VUC2.js +5886 -0
- package/dist/postcss-import-JD46KA2Z.js +458 -0
- package/dist/prompt-BYQIwEjg-TG7DLENB.js +915 -0
- package/dist/rescan-VB2PILB2.js +74 -0
- package/dist/serve.d.ts +37 -0
- package/dist/serve.js +38 -0
- package/dist/server-ER56DGPR.js +548 -0
- package/dist/status-EWQEACVF.js +43 -0
- package/dist/translate-F3AQFN6X.js +707 -0
- package/package.json +55 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TranslationCache
|
|
3
|
+
} from "./chunk-XEOYZUHS.js";
|
|
4
|
+
import {
|
|
5
|
+
flattenSources
|
|
6
|
+
} from "./chunk-3YNFMSJH.js";
|
|
7
|
+
import "./chunk-AKLW2MUS.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/status.ts
|
|
10
|
+
import { resolve } from "path";
|
|
11
|
+
async function status(config, opts) {
|
|
12
|
+
const cacheDir = resolve(config.cacheDir ?? ".cache");
|
|
13
|
+
const cache = new TranslationCache(cacheDir);
|
|
14
|
+
const sources = flattenSources(config);
|
|
15
|
+
const langs = opts.lang ? [opts.lang] : config.languages;
|
|
16
|
+
console.log("\u{1F4CA} Translation Status\n");
|
|
17
|
+
for (const source of sources) {
|
|
18
|
+
const totalKeys = cache.db.prepare("SELECT COUNT(DISTINCT key) as count FROM source_files WHERE version = ?").get(source.versionKey);
|
|
19
|
+
const total = totalKeys?.count ?? 0;
|
|
20
|
+
if (total === 0) {
|
|
21
|
+
console.log(`${source.versionKey}: no source files (run rescan first)`);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
console.log(`${source.versionKey} (${total} keys):`);
|
|
25
|
+
for (const lang of langs) {
|
|
26
|
+
const translated = cache.db.prepare(`
|
|
27
|
+
SELECT COUNT(*) as count FROM translations t
|
|
28
|
+
JOIN source_files sf ON t.key = sf.key
|
|
29
|
+
WHERE t.lang = ? AND sf.version = ?
|
|
30
|
+
`).get(lang, source.versionKey);
|
|
31
|
+
const done = translated?.count ?? 0;
|
|
32
|
+
const pct = total > 0 ? Math.round(done / total * 100) : 0;
|
|
33
|
+
const filled = Math.max(0, Math.min(20, Math.round(pct / 5)));
|
|
34
|
+
const bar = "\u2588".repeat(filled) + "\u2591".repeat(20 - filled);
|
|
35
|
+
console.log(` ${lang.padEnd(10)} ${bar} ${pct}% (${done}/${total})`);
|
|
36
|
+
}
|
|
37
|
+
console.log("");
|
|
38
|
+
}
|
|
39
|
+
cache.db.close();
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
status
|
|
43
|
+
};
|