@translate-local/tl 0.3.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.
Files changed (3) hide show
  1. package/README.md +14 -0
  2. package/bin/tl.js +51 -0
  3. package/package.json +27 -0
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @translate-local/tl
2
+
3
+ CLI-first translation tool with glossary enforcement and local models.
4
+
5
+ ```sh
6
+ # Install globally
7
+ npm install -g @translate-local/tl
8
+
9
+ # Or run without installing
10
+ bunx @translate-local/tl "hello" --to ar
11
+ npx @translate-local/tl "hello" --to ar
12
+ ```
13
+
14
+ Full documentation: https://github.com/its-magdy/Translate-Local
package/bin/tl.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { spawnSync } = require('child_process');
5
+ const path = require('path');
6
+
7
+ const PLATFORMS = {
8
+ 'darwin arm64': ['@translate-local/tl-darwin-arm64', 'bin/tl'],
9
+ 'darwin x64': ['@translate-local/tl-darwin-x64', 'bin/tl'],
10
+ 'linux x64': ['@translate-local/tl-linux-x64', 'bin/tl'],
11
+ 'linux arm64': ['@translate-local/tl-linux-arm64', 'bin/tl'],
12
+ 'win32 x64': ['@translate-local/tl-win32-x64', 'bin/tl.exe'],
13
+ };
14
+
15
+ const key = `${process.platform} ${process.arch}`;
16
+ const entry = PLATFORMS[key];
17
+
18
+ if (!entry) {
19
+ console.error(`[tl] Unsupported platform: ${key}`);
20
+ console.error(`[tl] Supported: ${Object.keys(PLATFORMS).join(', ')}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ const [pkg, sub] = entry;
25
+
26
+ let binPath;
27
+ try {
28
+ const pkgJson = require.resolve(`${pkg}/package.json`);
29
+ binPath = path.join(path.dirname(pkgJson), sub);
30
+ } catch {
31
+ console.error(`[tl] Could not find the "${pkg}" package.`);
32
+ console.error(`[tl] This usually means npm was run with --no-optional.`);
33
+ console.error(`[tl] Try: npm install -g @translate-local/tl --force`);
34
+ process.exit(1);
35
+ }
36
+
37
+ const result = spawnSync(binPath, process.argv.slice(2), {
38
+ stdio: 'inherit',
39
+ windowsHide: true,
40
+ });
41
+
42
+ if (result.error) {
43
+ console.error(`[tl] Failed to run binary at ${binPath}:`, result.error.message);
44
+ process.exit(1);
45
+ }
46
+
47
+ if (result.signal) {
48
+ process.kill(process.pid, result.signal);
49
+ }
50
+
51
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@translate-local/tl",
3
+ "version": "0.3.0",
4
+ "description": "CLI-first translation tool with glossary enforcement and local models",
5
+ "bin": {
6
+ "tl": "bin/tl.js"
7
+ },
8
+ "files": [
9
+ "bin/tl.js",
10
+ "README.md"
11
+ ],
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/its-magdy/Translate-Local.git"
18
+ },
19
+ "license": "MIT",
20
+ "optionalDependencies": {
21
+ "@translate-local/tl-darwin-arm64": "0.3.0",
22
+ "@translate-local/tl-darwin-x64": "0.3.0",
23
+ "@translate-local/tl-linux-x64": "0.3.0",
24
+ "@translate-local/tl-linux-arm64": "0.3.0",
25
+ "@translate-local/tl-win32-x64": "0.3.0"
26
+ }
27
+ }