@verbatra/sdk 0.6.4 → 0.7.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 +7 -7
- package/dist/index.cjs +718 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -16
- package/dist/index.d.ts +177 -16
- package/dist/index.js +718 -106
- package/dist/index.js.map +1 -1
- package/package.json +16 -9
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<h1 align="center">@verbatra/sdk</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
Programmatic API to automate i18n translation and keep your locale files in sync across languages
|
|
8
|
+
Programmatic API to automate i18n translation and keep your locale files in sync across languages, using OpenAI, Anthropic, Gemini, DeepL, or an openai-compatible local or self-hosted model.
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
@@ -26,9 +26,9 @@ Node.js `>=22.14.0`.
|
|
|
26
26
|
## Installation
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
+
npm install --save-dev @verbatra/sdk
|
|
30
|
+
# pnpm
|
|
29
31
|
pnpm add -D @verbatra/sdk
|
|
30
|
-
# npm
|
|
31
|
-
npm install -D @verbatra/sdk
|
|
32
32
|
# yarn
|
|
33
33
|
yarn add -D @verbatra/sdk
|
|
34
34
|
```
|
|
@@ -41,7 +41,7 @@ import { loadConfig, translate } from "@verbatra/sdk";
|
|
|
41
41
|
// Discovers and validates verbatra.config.ts (or .verbatrarc.json, or a package.json "verbatra" key).
|
|
42
42
|
const config = await loadConfig();
|
|
43
43
|
|
|
44
|
-
// The provider reads its API key from the environment (e.g.
|
|
44
|
+
// The provider reads its API key from the environment (e.g. GEMINI_API_KEY). No key is passed.
|
|
45
45
|
const summary = await translate({ config });
|
|
46
46
|
|
|
47
47
|
console.log(
|
|
@@ -64,10 +64,10 @@ export default defineConfig({
|
|
|
64
64
|
pattern: "locales/{locale}.json",
|
|
65
65
|
},
|
|
66
66
|
provider: {
|
|
67
|
-
id: "
|
|
67
|
+
id: "gemini",
|
|
68
68
|
options: {
|
|
69
|
-
model: "
|
|
70
|
-
|
|
69
|
+
model: "gemini-2.5-flash", // replace with your provider's model id
|
|
70
|
+
maxOutputTokens: 4096,
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
});
|