ai-i18n-tools 1.8.2 → 1.8.3
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
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<img src="docs/public/ai-i18n-tools_logo.png" alt="ai-i18n-tools logo" width="128" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
+
<a id="ai-i18n-tools"></a>
|
|
5
6
|
# ai-i18n-tools
|
|
6
7
|
|
|
7
8
|
<small id="lang-list">[English (UK)](./README.md) · [Deutsch](./translated-docs/README.de.md) · [Español](./translated-docs/README.es.md) · [Français](./translated-docs/README.fr.md) · [हिन्दी](./translated-docs/README.hi.md) · [日本語](./translated-docs/README.ja.md) · [한국어](./translated-docs/README.ko.md) · [Português (Brasil)](./translated-docs/README.pt-BR.md) · [简体中文](./translated-docs/README.zh-Hans.md) · [繁體中文](./translated-docs/README.zh-Hant.md)</small>
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
|
|
13
14
|
CLI and toolkit for internationalizing JavaScript/TypeScript apps and documentation sites (VitePress, Starlight, Docusaurus, Nextra, Fumadocs, Astro, plain Markdown/MDX). Use built-in presets for OpenAI, Anthropic, Gemini, OpenRouter, Ollama, and more — or any OpenAI-compatible API. Switch provider or model per project or per locale without changing your codebase.
|
|
14
15
|
|
|
16
|
+
<a id="features"></a>
|
|
15
17
|
## Features
|
|
16
18
|
|
|
17
19
|
| | |
|
|
@@ -23,6 +25,7 @@ CLI and toolkit for internationalizing JavaScript/TypeScript apps and documentat
|
|
|
23
25
|
| **Smart cache** | Shared SQLite cache — only new or changed segments hit the model |
|
|
24
26
|
| **One `sync`** | Runs extract → UI → SVG → docs → JSON in the right order from one config |
|
|
25
27
|
|
|
28
|
+
<a id="which-pipeline"></a>
|
|
26
29
|
## Which pipeline?
|
|
27
30
|
|
|
28
31
|
| Your content | Command |
|
|
@@ -33,6 +36,7 @@ CLI and toolkit for internationalizing JavaScript/TypeScript apps and documentat
|
|
|
33
36
|
|
|
34
37
|
See [What is ai-i18n-tools?](docs/guide/what-is-ai-i18n-tools.md) for a full comparison.
|
|
35
38
|
|
|
39
|
+
<a id="install"></a>
|
|
36
40
|
## Install
|
|
37
41
|
|
|
38
42
|
ESM-only. Requires Node.js `>=22.16.0`.
|
|
@@ -50,6 +54,7 @@ export OPENROUTER_API_KEY=sk-or-v1-your-key-here
|
|
|
50
54
|
|
|
51
55
|
Configure the bare `ai-i18n-tools` command (direnv, PATH, `package.json` scripts, or `npx`) — see [Installation](docs/guide/installation.md).
|
|
52
56
|
|
|
57
|
+
<a id="quick-start"></a>
|
|
53
58
|
## Quick start
|
|
54
59
|
|
|
55
60
|
```bash
|
|
@@ -61,6 +66,7 @@ Docs-oriented scaffolds: `-t ui-docusaurus`, `ui-starlight`, `ui-vitepress`, `ui
|
|
|
61
66
|
|
|
62
67
|
Prefer `sync` over chaining individual translate commands. Full walkthrough: [Quick start](docs/guide/quick-start.md).
|
|
63
68
|
|
|
69
|
+
<a id="documentation"></a>
|
|
64
70
|
## Documentation
|
|
65
71
|
|
|
66
72
|
- [Documentation site](https://wsj-br.github.io/ai-i18n-tools/) — guides, integrations, and reference
|
|
@@ -71,10 +77,12 @@ Prefer `sync` over chaining individual translate commands. Full walkthrough: [Qu
|
|
|
71
77
|
- [Examples](https://github.com/wsj-br/ai-i18n-tools/tree/main/examples/) — runnable demos (`npx degit …`)
|
|
72
78
|
- [AI Agent Context](https://github.com/wsj-br/ai-i18n-tools/blob/main/docs/ai-i18n-tools-context.md) — integration guide for assistants in consumer repos
|
|
73
79
|
|
|
80
|
+
<a id="contributing"></a>
|
|
74
81
|
## Contributing
|
|
75
82
|
|
|
76
83
|
Issues and pull requests are welcome. Maintainer workflows for this repository: [`AGENTS.md`](https://github.com/wsj-br/ai-i18n-tools/blob/main/AGENTS.md) and [`dev/DEVEL.md`](https://github.com/wsj-br/ai-i18n-tools/blob/main/dev/DEVEL.md).
|
|
77
84
|
|
|
85
|
+
<a id="license"></a>
|
|
78
86
|
## License
|
|
79
87
|
|
|
80
88
|
MIT — see [LICENSE](https://github.com/wsj-br/ai-i18n-tools/blob/main/LICENSE).
|
package/bin/ai-i18n-tools.mjs
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Stable package.json "bin" entry. pnpm links this file during install before
|
|
4
4
|
* dist/ exists; the compiled CLI is emitted to dist/cli/index.js by `pnpm build`.
|
|
5
|
+
*
|
|
6
|
+
* Dynamic import must use a file:// URL — on Windows, bare absolute paths like
|
|
7
|
+
* `C:\...\dist\cli\index.js` are rejected by Node's ESM loader
|
|
8
|
+
* (ERR_UNSUPPORTED_ESM_URL_SCHEME).
|
|
5
9
|
*/
|
|
6
10
|
import fs from "node:fs";
|
|
7
11
|
import path from "node:path";
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
12
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
13
|
|
|
10
14
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
11
15
|
const cliEntry = path.join(root, "dist", "cli", "index.js");
|
|
@@ -17,4 +21,4 @@ if (!fs.existsSync(cliEntry)) {
|
|
|
17
21
|
process.exit(1);
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
await import(cliEntry);
|
|
24
|
+
await import(pathToFileURL(cliEntry).href);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import masterJson from "./ui-languages-complete.json" with { type: "json" };
|
|
2
2
|
import { normalizeManifestLocaleKey } from "../core/locale-utils.js";
|
|
3
|
-
/** Compile-time bundle of `data/ui-languages-complete.json` (symlink under `src/runtime/`). */
|
|
3
|
+
/** Compile-time bundle of `data/ui-languages-complete.json` (symlink or sync'd copy under `src/runtime/`). */
|
|
4
4
|
const master = masterJson;
|
|
5
5
|
const DIRECTION_BY_KEY = new Map();
|
|
6
6
|
for (const item of master) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-languages-master-direction.js","sourceRoot":"","sources":["../../src/runtime/ui-languages-master-direction.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,8BAA8B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE
|
|
1
|
+
{"version":3,"file":"ui-languages-master-direction.js","sourceRoot":"","sources":["../../src/runtime/ui-languages-master-direction.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,8BAA8B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,8GAA8G;AAC9G,MAAM,MAAM,GAAG,UAAuB,CAAC;AAEvC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAyB,CAAC;AAE1D,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;IAC1B,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,SAAS;IACxD,MAAM,CAAC,GAAG,IAA+B,CAAC;IAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,IAAI,CAAC,IAAI;QAAE,SAAS;IACpB,MAAM,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC;IACxB,MAAM,SAAS,GAAkB,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,gBAAgB,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kCAAkC,CAAC,GAAW;IAC5D,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,gBAAgB,CAAC,GAAG,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-i18n-tools",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"packageManager": "pnpm@11.
|
|
3
|
+
"version": "1.8.3",
|
|
4
|
+
"packageManager": "pnpm@11.17.0",
|
|
5
5
|
"description": "Unified internationalization toolkit for Node.js apps and documentation with AI translation",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"prepare": "node scripts/ensure-built.mjs",
|
|
34
|
-
"build": "node scripts/write-build-info.mjs && echo '1/5' && tsc && echo '2/5' && node scripts/chmod-cli-bin.mjs && echo '3/5' && node scripts/copy-runtime-ui-languages-json.mjs && echo '4/5' && node scripts/copy-dashboard-app.mjs && echo '5/5' && node scripts/copy-i18n-locales.mjs && echo 'Build completed successfully\n'",
|
|
35
|
-
"dev": "node scripts/copy-runtime-ui-languages-json.mjs && node scripts/copy-dashboard-app.mjs && node scripts/copy-i18n-locales.mjs && tsc --watch",
|
|
34
|
+
"build": "node scripts/ensure-src-ui-languages-json.mjs && node scripts/write-build-info.mjs && echo '1/5' && tsc && echo '2/5' && node scripts/chmod-cli-bin.mjs && echo '3/5' && node scripts/copy-runtime-ui-languages-json.mjs && echo '4/5' && node scripts/copy-dashboard-app.mjs && echo '5/5' && node scripts/copy-i18n-locales.mjs && echo 'Build completed successfully\n'",
|
|
35
|
+
"dev": "node scripts/ensure-src-ui-languages-json.mjs && node scripts/copy-runtime-ui-languages-json.mjs && node scripts/copy-dashboard-app.mjs && node scripts/copy-i18n-locales.mjs && tsc --watch",
|
|
36
36
|
"test": "vitest run --coverage",
|
|
37
37
|
"test:watch": "vitest",
|
|
38
|
-
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json",
|
|
38
|
+
"typecheck": "node scripts/ensure-src-ui-languages-json.mjs && tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json",
|
|
39
39
|
"lint": "eslint . && pnpm run typecheck",
|
|
40
40
|
"lint:fix": "eslint . --fix",
|
|
41
41
|
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"clean": "rm -rf dist/",
|
|
44
44
|
"clean:workspace": "bash scripts/clean-workspace.sh",
|
|
45
45
|
"prepublishOnly": "pnpm run clean && pnpm run build && pnpm test",
|
|
46
|
-
"pre-release": "
|
|
46
|
+
"pre-release": "node scripts/pre-release.mjs",
|
|
47
47
|
"docs:dev": "node scripts/escape-vue-braces-in-docs.mjs && vitepress dev docs --host",
|
|
48
48
|
"docs:build": "node scripts/escape-vue-braces-in-docs.mjs && vitepress build docs",
|
|
49
49
|
"docs:preview": "vitepress preview docs",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"i18n:cleanup": "node bin/ai-i18n-tools.mjs cleanup",
|
|
59
59
|
"update-all": "bash scripts/update-all.sh",
|
|
60
60
|
"clean-temp": "node bin/ai-i18n-tools.mjs clean-temp",
|
|
61
|
-
"release:github": "
|
|
62
|
-
"release:github:dry": "
|
|
61
|
+
"release:github": "node scripts/release.mjs",
|
|
62
|
+
"release:github:dry": "node scripts/release.mjs --dry-run",
|
|
63
63
|
"notices:write": "node scripts/write-third-party-notices.js"
|
|
64
64
|
},
|
|
65
65
|
"keywords": [
|