verbaly 0.1.0 → 0.2.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 (2) hide show
  1. package/README.md +100 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/AronSoto/verbaly/develop/assets/logo.png" alt="Verbaly" width="340" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <em>Effortless i18n — write natural text, ship type-safe, tree-shakeable translations.</em>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/verbaly"><img src="https://img.shields.io/npm/v/verbaly?logo=npm&color=cb3837" alt="npm version" /></a>
11
+ <a href="https://bundlephobia.com/package/verbaly"><img src="https://img.shields.io/bundlephobia/minzip/verbaly?label=gzip" alt="bundle size" /></a>
12
+ <img src="https://img.shields.io/badge/dependencies-0-3fb950" alt="zero dependencies" />
13
+ <img src="https://img.shields.io/badge/types-included-3178C6?logo=typescript&logoColor=white" alt="TypeScript" />
14
+ <a href="https://github.com/AronSoto/verbaly/blob/develop/LICENSE"><img src="https://img.shields.io/npm/l/verbaly?color=blue" alt="Apache-2.0" /></a>
15
+ </p>
16
+
17
+ ---
18
+
19
+ Most i18n tools make you maintain key files by hand — keys drift from the code, no type-safety, heavy setup. **Verbaly inverts the flow:** write the source text in your code, a build plugin extracts stable keys, types and per-locale modules. Compiler-grade safety, a runtime under **~3KB**, zero dependencies.
20
+
21
+ ```ts
22
+ // You write this:
23
+ t`Hello ${name}, you have ${count} messages`
24
+
25
+ // The compiler generates: a stable key + inferred types + per-locale entries.
26
+ t('EMo3ph4u', { name, count }); // ← fully typed, tree-shakeable
27
+ ```
28
+
29
+ Missing a translation? **The build fails** — raw keys never reach production.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pnpm add verbaly @verbaly/vite
35
+ ```
36
+
37
+ ```ts
38
+ // vite.config.ts
39
+ import verbaly from '@verbaly/vite';
40
+
41
+ export default { plugins: [verbaly({ locales: ['en', 'es', 'pt'] })] };
42
+ ```
43
+
44
+ ```ts
45
+ // anywhere in your app — extracted + typed on save
46
+ import { t, setLocale } from 'virtual:verbaly';
47
+
48
+ t`Hello ${name}`;
49
+ await setLocale('es'); // per-locale bundle loaded on demand
50
+ ```
51
+
52
+ ### Standalone runtime (no compiler)
53
+
54
+ `verbaly` also works on its own for dynamic/CMS content:
55
+
56
+ ```ts
57
+ import { createVerbaly } from 'verbaly';
58
+
59
+ const v = createVerbaly({
60
+ locale: 'en',
61
+ messages: { en: { greeting: 'Hello {name}' } },
62
+ });
63
+
64
+ v.t('greeting', { name: 'Aron' }); // "Hello Aron"
65
+ ```
66
+
67
+ ### Plain HTML
68
+
69
+ ```html
70
+ <h1 data-verbaly="home.title"></h1>
71
+ ```
72
+ ```ts
73
+ import { createVerbaly } from 'verbaly';
74
+ createVerbaly({ /* … */ }).bindDom(); // textContent-only, re-renders on locale change
75
+ ```
76
+
77
+ ## What you get
78
+
79
+ - **Hybrid compiler + runtime** — static text compiled (types + tree-shaking), dynamic content via a real runtime path.
80
+ - **Type-safe params** — `{name}`, plurals, currency and dates inferred from the message; wrong/missing params fail to compile.
81
+ - **`Intl`-powered format** — number/currency/date/time + CLDR plurals and select/gender, tiny surface.
82
+ - **Plain, portable JSON catalogs** — no proprietary format, no lock-in.
83
+ - **DOM interpreter** for framework-less HTML.
84
+
85
+ ## Ecosystem
86
+
87
+ | Package | Description |
88
+ |---------|-------------|
89
+ | `verbaly` | Core runtime (this package) |
90
+ | `@verbaly/vite` | Zero-config Vite plugin |
91
+ | `@verbaly/compiler` | Extraction + codegen + CLI |
92
+ | `@verbaly/react` · `@verbaly/vue` | Framework adapters |
93
+
94
+ 📖 **Docs & live playground:** https://verbaly-web.vercel.app
95
+
96
+ > ⚠️ Early development (`0.x`) — API not stable yet.
97
+
98
+ ## License
99
+
100
+ [Apache-2.0](https://github.com/AronSoto/verbaly/blob/develop/LICENSE) © Aron Soto
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verbaly",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Effortless i18n — write natural text, ship type-safe, tree-shakeable translations.",
5
5
  "keywords": [
6
6
  "i18n",