@ndnci/translify 0.0.1-alpha.0 → 0.0.1-alpha.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.
Files changed (2) hide show
  1. package/README.md +233 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,233 @@
1
+ <div align="center">
2
+ <h1>⚡ Translify</h1>
3
+ <p><strong>Intelligent i18n CLI — extract, sync, detect, translate.</strong></p>
4
+ <p>Automate your entire internationalization workflow from a single terminal command.</p>
5
+
6
+ <a href="https://www.npmjs.com/package/@ndnci/translify">
7
+ <img alt="npm version" src="https://img.shields.io/npm/v/@ndnci/translify?style=flat-square&color=0070f3" />
8
+ </a>
9
+ <a href="https://www.npmjs.com/package/@ndnci/translify">
10
+ <img alt="npm downloads" src="https://img.shields.io/npm/dm/@ndnci/translify?style=flat-square&color=0070f3" />
11
+ </a>
12
+ <a href="https://github.com/ndnci/translify/blob/main/LICENSE">
13
+ <img alt="License" src="https://img.shields.io/github/license/ndnci/translify?style=flat-square&color=0070f3" />
14
+ </a>
15
+ <a href="https://github.com/ndnci/translify/actions">
16
+ <img alt="CI" src="https://img.shields.io/github/actions/workflow/status/ndnci/translify/ci.yml?style=flat-square&label=CI&color=0070f3" />
17
+ </a>
18
+ <img alt="Node.js" src="https://img.shields.io/node/v/@ndnci/translify?style=flat-square&color=0070f3" />
19
+ </div>
20
+
21
+ ---
22
+
23
+ ## What is Translify?
24
+
25
+ **Translify** is a professional, framework-agnostic CLI that automates the
26
+ hardest parts of i18n:
27
+
28
+ - **Extract** all translation keys used in your source code
29
+ - **Sync** translation files across languages — add missing keys, remove stale
30
+ ones
31
+ - **Detect** unused, missing, and duplicate translation entries
32
+ - **Translate** automatically via AI providers (OpenAI GPT-4)
33
+ - **Audit** your entire i18n health in one command
34
+ - **Optimize** translation files (sort, deduplicate, format)
35
+
36
+ Built for teams that care about DX and translation quality.
37
+
38
+ ---
39
+
40
+ ## Quick Start
41
+
42
+ ```bash
43
+ # Install globally
44
+ npm install -g @ndnci/translify
45
+
46
+ # Or run directly without installing
47
+ npx translify@latest init
48
+ ```
49
+
50
+ ### Initialize a config
51
+
52
+ ```bash
53
+ translify init
54
+ ```
55
+
56
+ Creates a `translify.config.ts` in your project root with full TypeScript
57
+ autocompletion.
58
+
59
+ ### Extract translation keys
60
+
61
+ ```bash
62
+ translify extract
63
+ ```
64
+
65
+ Scans your source files for all `t()`, `i18n.t()`, `translate()` calls and
66
+ reports which keys are in use.
67
+
68
+ ### Sync translation files
69
+
70
+ ```bash
71
+ translify sync
72
+ ```
73
+
74
+ Adds missing keys to all language files, keeping them in sync with your base
75
+ language.
76
+
77
+ ### Find unused keys
78
+
79
+ ```bash
80
+ translify unused
81
+ ```
82
+
83
+ Finds translation keys defined in your JSON files but never referenced in code.
84
+
85
+ ### Run a full audit
86
+
87
+ ```bash
88
+ translify audit
89
+ ```
90
+
91
+ Runs all checks (missing, unused, duplicates) in one pass — great for CI.
92
+
93
+ ---
94
+
95
+ ## Configuration
96
+
97
+ Create a `translify.config.ts` at your project root:
98
+
99
+ ```typescript
100
+ import { defineConfig } from '@ndnci/translify/config';
101
+
102
+ export default defineConfig({
103
+ source: {
104
+ include: ['src/**/*.{ts,tsx,js,jsx}'],
105
+ exclude: ['**/*.test.*', '**/node_modules/**'],
106
+ },
107
+
108
+ translations: {
109
+ default_language: 'en',
110
+ files: ['messages/*.json'],
111
+ },
112
+
113
+ extraction: {
114
+ translation_functions: ['t', 'i18n.t', 'translate'],
115
+ ignored_words: ['OK', 'API'],
116
+ ignored_patterns: ['^v[0-9]+$'],
117
+ },
118
+
119
+ ai_translation: {
120
+ enabled: false,
121
+ provider: 'openai',
122
+ openai_api_key: process.env.OPENAI_API_KEY,
123
+ model: 'gpt-4.1-mini',
124
+ temperature: 0,
125
+ },
126
+ });
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Commands
132
+
133
+ | Command | Description |
134
+ | --------------------- | --------------------------------------------- |
135
+ | `translify init` | Initialize a config file |
136
+ | `translify extract` | Extract all translation keys from source code |
137
+ | `translify sync` | Sync translation files across languages |
138
+ | `translify translate` | Auto-translate missing keys via AI |
139
+ | `translify unused` | Detect unused translation keys |
140
+ | `translify missing` | Detect missing translation keys |
141
+ | `translify duplicate` | Detect duplicate translation values |
142
+ | `translify optimize` | Optimize and format translation files |
143
+ | `translify audit` | Full i18n audit (all checks combined) |
144
+ | `translify doctor` | Check your Translify setup and environment |
145
+
146
+ ### Global options
147
+
148
+ ```
149
+ -c, --config <path> Path to config file
150
+ --cwd <path> Working directory (default: process.cwd())
151
+ --dry-run Preview changes without writing files
152
+ --verbose Enable verbose output
153
+ -V, --version Print version
154
+ -h, --help Show help
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Framework Support
160
+
161
+ | Framework / Library | Status |
162
+ | ------------------- | ------------ |
163
+ | React | ✅ Supported |
164
+ | Next.js | ✅ Supported |
165
+ | TypeScript | ✅ Supported |
166
+ | JavaScript | ✅ Supported |
167
+ | i18next | ✅ Supported |
168
+ | next-intl | ✅ Supported |
169
+ | Vue | 🔜 Planned |
170
+ | Angular | 🔜 Planned |
171
+ | Svelte | 🔜 Planned |
172
+ | Laravel / PHP | 🔜 Planned |
173
+
174
+ ---
175
+
176
+ ## AI Translation
177
+
178
+ Translify integrates with OpenAI to auto-translate your keys:
179
+
180
+ ```bash
181
+ translify translate --locale fr
182
+ ```
183
+
184
+ Requires `ai_translation.enabled = true` in your config and a valid
185
+ `OPENAI_API_KEY`.
186
+
187
+ ---
188
+
189
+ ## Packages
190
+
191
+ This repository is a monorepo. The following packages are published:
192
+
193
+ | Package | Description |
194
+ | ------------------------- | ---------------------------------- |
195
+ | `@ndnci/translify` | CLI — the main tool |
196
+ | `@ndnci/translify-core` | Core logic (scanner, parser, etc.) |
197
+ | `@ndnci/translify-config` | Config loading and validation |
198
+ | `@ndnci/translify-ai` | AI translation providers |
199
+ | `@ndnci/translify-shared` | Shared types and utilities |
200
+
201
+ ---
202
+
203
+ ## Roadmap
204
+
205
+ - [x] Key extraction from TS/JS/TSX/JSX
206
+ - [x] Translation file sync
207
+ - [x] Unused / missing / duplicate detection
208
+ - [x] AI translation via OpenAI
209
+ - [x] Full audit command
210
+ - [ ] Vue SFC parser
211
+ - [ ] Angular template parser
212
+ - [ ] PHP/Laravel support
213
+ - [ ] Translation memory / TM integration
214
+ - [ ] Web dashboard
215
+ - [ ] VS Code extension
216
+
217
+ ---
218
+
219
+ ## Contributing
220
+
221
+ Contributions are welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for
222
+ guidelines.
223
+
224
+ ---
225
+
226
+ ## License
227
+
228
+ MIT License with Trademark Policy — see [LICENSE](./LICENSE) and
229
+ [TRADEMARK_POLICY.md](./TRADEMARK_POLICY.md).
230
+
231
+ The name **Translify** and the `@ndnci/translify` npm scope are trademarks of
232
+ their respective owners and may not be used for redistributed or renamed
233
+ versions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndnci/translify",
3
- "version": "0.0.1-alpha.0",
3
+ "version": "0.0.1-alpha.1",
4
4
  "description": "Intelligent i18n CLI — extract, sync, detect, and translate your app",
5
5
  "keywords": [
6
6
  "i18n",
@@ -43,10 +43,10 @@
43
43
  "chalk": "^5.4.1",
44
44
  "commander": "^13.1.0",
45
45
  "ora": "^8.1.1",
46
- "@ndnci/translify-ai": "0.0.1",
47
- "@ndnci/translify-shared": "0.0.1",
48
46
  "@ndnci/translify-config": "0.0.1",
49
- "@ndnci/translify-core": "0.0.1"
47
+ "@ndnci/translify-ai": "0.0.1",
48
+ "@ndnci/translify-core": "0.0.1",
49
+ "@ndnci/translify-shared": "0.0.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^22.10.0",