transduck 0.1.1 → 0.1.2

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 (2) hide show
  1. package/README.md +88 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # TransDuck
2
+
3
+ AI-powered translation for apps and websites. Fast. Cheap. No keys to manage.
4
+
5
+ TransDuck translates your app's strings using AI, then caches them locally in DuckDB so you never pay for the same translation twice. No translation files. No key naming. No sync headaches.
6
+
7
+ ```typescript
8
+ import { initialize, setLanguage, ait, aitPlural } from 'transduck';
9
+
10
+ await initialize();
11
+ setLanguage('DE');
12
+
13
+ await ait('Welcome to Mallorca'); // → "Willkommen auf Mallorca"
14
+ await ait('Hello {name}', undefined, { name: 'Tim' }); // → "Hallo Tim"
15
+ await aitPlural('{count} night', '{count} nights', 7); // → "7 Nächte"
16
+ ```
17
+
18
+ ## Why TransDuck?
19
+
20
+ - **No keys to manage** — your source text is the key
21
+ - **No translation files** — translations live in a single in-memory database file
22
+ - **Translate once, pay once** — cached lookups take ~1.5ms, zero API costs after first call
23
+ - **AI that understands context** — project and per-string context for accurate translations
24
+ - **Pluralization that works everywhere** — handles Russian (4 forms), Arabic (6 forms) automatically
25
+ - **Built for vibe coding** — AI coding tools read the docs and wrap strings with `ait()` across your project
26
+ - **Dirt cheap** — 1,000 strings x 5 languages costs about $0.10 with gpt-4.1-mini
27
+
28
+ ## Quick Start
29
+
30
+ ```bash
31
+ npm install transduck
32
+ transduck init
33
+ ```
34
+
35
+ ## React / Next.js
36
+
37
+ TransDuck includes a first-party React integration with synchronous `t()` for client components:
38
+
39
+ ```tsx
40
+ // app/api/translations/route.ts (one-time setup)
41
+ import { createTransDuckHandler } from 'transduck';
42
+ export const POST = createTransDuckHandler();
43
+ ```
44
+
45
+ ```tsx
46
+ // layout.tsx
47
+ import { TransDuckProvider } from 'transduck/react';
48
+
49
+ <TransDuckProvider language="DE">
50
+ <App />
51
+ </TransDuckProvider>
52
+ ```
53
+
54
+ ```tsx
55
+ // Any client component
56
+ 'use client';
57
+ import { t, tPlural, useTransDuck } from 'transduck/react';
58
+
59
+ function Dashboard() {
60
+ useTransDuck();
61
+ return (
62
+ <h1>{t("Dashboard")}</h1>
63
+ <p>{tPlural("{count} property", "{count} properties", 5)}</p>
64
+ );
65
+ }
66
+ ```
67
+
68
+ ## CLI
69
+
70
+ ```bash
71
+ transduck scan --warm --langs DE,ES,IT # scan codebase and translate everything
72
+ transduck translate "Hello" --to DE # translate a single string
73
+ transduck stats # check your translation database
74
+ ```
75
+
76
+ ## Also available for Python
77
+
78
+ ```bash
79
+ pip install transduck
80
+ ```
81
+
82
+ Works with Django, Flask, FastAPI, and Jinja. Same DuckDB database format — share translations between Python and JS.
83
+
84
+ ## Links
85
+
86
+ - [GitHub](https://github.com/timnilson/transduck)
87
+ - [Full Documentation](https://github.com/timnilson/transduck/blob/main/DOCUMENTATION.md)
88
+ - [PyPI Package](https://pypi.org/project/transduck/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transduck",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "AI-native translation tool using source text as keys",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",