gptrans 1.1.0 → 1.1.4
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 +17 -17
- package/isoAssoc.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,15 @@ Whether you're building a multilingual website, a mobile app, or a localization
|
|
|
20
20
|
npm install gptrans
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
### 🌐 Environment Setup
|
|
24
|
+
|
|
25
|
+
GPTrans uses dotenv for environment configuration. Create a `.env` file in your project root and add your API keys:
|
|
26
|
+
|
|
27
|
+
```env
|
|
28
|
+
OPENAI_API_KEY=your_openai_api_key
|
|
29
|
+
ANTHROPIC_API_KEY=your_anthropic_api_key
|
|
30
|
+
```
|
|
31
|
+
|
|
23
32
|
## 🚀 Quick Start
|
|
24
33
|
|
|
25
34
|
Here's a simple example to get you started:
|
|
@@ -28,8 +37,8 @@ Here's a simple example to get you started:
|
|
|
28
37
|
import GPTrans from 'gptrans';
|
|
29
38
|
|
|
30
39
|
const gptrans = new GPTrans({
|
|
31
|
-
target: 'es-AR',
|
|
32
40
|
from: 'en-US',
|
|
41
|
+
target: 'es-AR',
|
|
33
42
|
model: 'claude-3-5-sonnet-20241022'
|
|
34
43
|
});
|
|
35
44
|
|
|
@@ -52,13 +61,13 @@ console.log(gptrans.t('Card'));
|
|
|
52
61
|
|
|
53
62
|
## ⚙️ Configuration Options
|
|
54
63
|
|
|
55
|
-
When creating a new instance of
|
|
64
|
+
When creating a new instance of GPTrans, you can customize:
|
|
56
65
|
|
|
57
66
|
| Option | Description | Default |
|
|
58
67
|
|--------|-------------|---------|
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `model` | Translation model key | - |
|
|
68
|
+
| `from` | Source language locale | `es-AR` |
|
|
69
|
+
| `target` | Target language locale | `en-US` |
|
|
70
|
+
| `model` | Translation model key | `gpt-4o-mini` |
|
|
62
71
|
| `batchThreshold` | Maximum number of characters to accumulate before triggering batch processing | `1000` |
|
|
63
72
|
| `debounceTimeout` | Time in milliseconds to wait before processing translations | `500` |
|
|
64
73
|
|
|
@@ -82,25 +91,16 @@ When creating a new instance of Gptrans, you can customize:
|
|
|
82
91
|
}
|
|
83
92
|
```
|
|
84
93
|
|
|
85
|
-
##
|
|
86
|
-
|
|
87
|
-
Gptrans uses dotenv for environment configuration. Create a `.env` file in your project root and add your API keys:
|
|
88
|
-
|
|
89
|
-
```env
|
|
90
|
-
OPENAI_API_KEY=your_openai_api_key
|
|
91
|
-
ANTHROPIC_API_KEY=your_anthropic_api_key
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## 🎉 Why Choose Gptrans?
|
|
94
|
+
## 🎉 Why Choose GPTrans?
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
GPTrans stands out by combining advanced AI capabilities with efficient batching and caching. This means:
|
|
97
97
|
|
|
98
98
|
- **Speed:** Reduced API calls and instant retrieval of cached translations
|
|
99
99
|
- **Quality:** Leverage state-of-the-art models for precise and context-aware translations
|
|
100
100
|
- **Flexibility:** Tailor the tool to your specific localization needs with minimal effort
|
|
101
101
|
- **Zero Maintenance:** Set it up once and forget about it - automatic updates and self-healing capabilities keep everything running smoothly
|
|
102
102
|
|
|
103
|
-
If you're looking to streamline your translation workflow and bring your applications to a global audience effortlessly,
|
|
103
|
+
If you're looking to streamline your translation workflow and bring your applications to a global audience effortlessly, GPTrans is the perfect choice!
|
|
104
104
|
|
|
105
105
|
## Contributing
|
|
106
106
|
|
package/isoAssoc.js
CHANGED
|
@@ -173,6 +173,6 @@ export function isoAssoc(iso, prefix = '') {
|
|
|
173
173
|
[prefix + 'ISO']: iso,
|
|
174
174
|
[prefix + 'LANG']: langName[lang],
|
|
175
175
|
[prefix + 'COUNTRY']: country ? countryName[country] : langName[lang],
|
|
176
|
-
[prefix + 'DENONYM']: country ? countryDenonym[country] : '
|
|
176
|
+
[prefix + 'DENONYM']: country ? countryDenonym[country] : 'Neutral',
|
|
177
177
|
};
|
|
178
178
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gptrans",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"description": "🚆 GPTrans - The smarter AI-powered way to translate.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"translate",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"deepbase": "^1.3.2",
|
|
35
35
|
"dotenv": "^16.4.7",
|
|
36
|
-
"modelmix": "^2.8.
|
|
36
|
+
"modelmix": "^2.8.6",
|
|
37
37
|
"string-hash": "^1.1.3"
|
|
38
38
|
}
|
|
39
39
|
}
|