translatex 0.0.0-stage → 0.1.1
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 +42 -2
- package/bin/translatex.js +62 -0
- package/package.json +50 -4
package/README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# translatex
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Free translation for your agent — no API key, no signup, no config.**
|
|
4
|
+
|
|
5
|
+
`npm install -g translatex` puts a 6 MB static binary on `PATH`. 26 translation
|
|
6
|
+
providers raced in parallel, structured JSON out, one skill file for 24 coding
|
|
7
|
+
agents. The binary ships in a per-platform package (`translatex-win32-x64`,
|
|
8
|
+
`translatex-darwin-arm64`, …) pulled in as an optional dependency, so the
|
|
9
|
+
install runs no scripts at all.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g translatex
|
|
13
|
+
translatex translate "Hello world" -t zh
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Agent setup
|
|
17
|
+
|
|
18
|
+
The integration is the CLI plus a skill. Give your agent the skill from
|
|
19
|
+
[`integrations/skill/translatex/SKILL.md`](https://github.com/w21180239/translatex/blob/main/integrations/skill/translatex/SKILL.md),
|
|
20
|
+
or the short block in
|
|
21
|
+
[`integrations/guidance/AGENTS.md`](https://github.com/w21180239/translatex/blob/main/integrations/guidance/AGENTS.md)
|
|
22
|
+
for harnesses that read a project instructions file.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
translatex translate "Hello world" -t zh --format json
|
|
26
|
+
translatex roundtrip "In today's landscape, …" --from en --format json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Full harness matrix: https://github.com/w21180239/translatex/tree/main/integrations
|
|
30
|
+
|
|
31
|
+
## Offline install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
TRANSLATEX_BINARY_PATH=/path/to/translatex npm install -g translatex
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or skip npm entirely:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cargo install translatex --locked
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Full documentation: https://github.com/w21180239/translatex
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// The native binary ships in a per-platform package declared as an optional
|
|
5
|
+
// dependency, so nothing runs at install time. That matters because npm 12
|
|
6
|
+
// blocks dependency install scripts by default: a download-on-install shim
|
|
7
|
+
// would silently install nothing.
|
|
8
|
+
|
|
9
|
+
const { spawn } = require('node:child_process');
|
|
10
|
+
const fs = require('node:fs');
|
|
11
|
+
const path = require('node:path');
|
|
12
|
+
|
|
13
|
+
const exe = process.platform === 'win32' ? 'translatex.exe' : 'translatex';
|
|
14
|
+
|
|
15
|
+
// npm blocks package names that look machine-generated, and "win32" trips its
|
|
16
|
+
// spam filter, so the Windows package is published as translatex-windows-x64.
|
|
17
|
+
const platformName = process.platform === 'win32' ? 'windows' : process.platform;
|
|
18
|
+
const platformPackage = `translatex-${platformName}-${process.arch}`;
|
|
19
|
+
|
|
20
|
+
function binaryFromPlatformPackage() {
|
|
21
|
+
let packageJson;
|
|
22
|
+
try {
|
|
23
|
+
packageJson = require.resolve(`${platformPackage}/package.json`);
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const candidate = path.join(path.dirname(packageJson), exe);
|
|
28
|
+
return fs.existsSync(candidate) ? candidate : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const binary = process.env.TRANSLATEX_BINARY_PATH || binaryFromPlatformPackage();
|
|
32
|
+
|
|
33
|
+
if (!binary) {
|
|
34
|
+
process.stderr.write(
|
|
35
|
+
[
|
|
36
|
+
`translatex: no binary for ${process.platform}/${process.arch}.`,
|
|
37
|
+
'',
|
|
38
|
+
`The package ${platformPackage} is missing. Reinstall, or install from source:`,
|
|
39
|
+
' npm install -g translatex --force',
|
|
40
|
+
' cargo install translatex --locked',
|
|
41
|
+
'',
|
|
42
|
+
'If your platform has no prebuilt binary, cargo is the way.',
|
|
43
|
+
'',
|
|
44
|
+
].join('\n')
|
|
45
|
+
);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
50
|
+
|
|
51
|
+
child.on('error', (err) => {
|
|
52
|
+
process.stderr.write(`translatex: failed to start ${binary}: ${err.message}\n`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
child.on('exit', (code, signal) => {
|
|
57
|
+
if (signal) {
|
|
58
|
+
process.kill(process.pid, signal);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
process.exit(code === null ? 1 : code);
|
|
62
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "translatex",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Free translation CLI for AI agents: no API key, no signup, no config. 26 providers, JSON output, one 6 MB binary.",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"author": "w21180239",
|
|
7
|
+
"homepage": "https://github.com/w21180239/translatex",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/w21180239/translatex.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/w21180239/translatex/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"translation",
|
|
17
|
+
"translator",
|
|
18
|
+
"translate",
|
|
19
|
+
"cli",
|
|
20
|
+
"agent",
|
|
21
|
+
"agent-native",
|
|
22
|
+
"ai",
|
|
23
|
+
"llm",
|
|
24
|
+
"i18n",
|
|
25
|
+
"localization",
|
|
26
|
+
"free",
|
|
27
|
+
"no-api-key",
|
|
28
|
+
"humanizer",
|
|
29
|
+
"deai",
|
|
30
|
+
"mcp-alternative"
|
|
31
|
+
],
|
|
32
|
+
"bin": {
|
|
33
|
+
"translatex": "bin/translatex.js"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"bin/translatex.js",
|
|
37
|
+
"README.md"
|
|
38
|
+
],
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"translatex-darwin-arm64": "0.1.1",
|
|
41
|
+
"translatex-darwin-x64": "0.1.1",
|
|
42
|
+
"translatex-linux-arm64": "0.1.1",
|
|
43
|
+
"translatex-linux-x64": "0.1.1",
|
|
44
|
+
"translatex-windows-x64": "0.1.1"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
}
|
|
52
|
+
}
|