vite-plugin-lingo 0.1.2 → 0.1.3
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 +110 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,17 +98,30 @@ lingo({
|
|
|
98
98
|
// For other frameworks, './locales' at project root is typical
|
|
99
99
|
localesDir: './locales',
|
|
100
100
|
|
|
101
|
+
// ⚠️ NUCLEAR OPTION - Only use if another plugin conflicts with .po file changes
|
|
101
102
|
// Restart the dev server when a .po file is updated (default: false)
|
|
102
|
-
//
|
|
103
|
+
// Advanced: Use this only when reloadOnPoChange is insufficient and another
|
|
104
|
+
// plugin (like wuchale) stops reacting to changes. Most users won't need this.
|
|
103
105
|
restartOnPoChange: false,
|
|
104
106
|
|
|
105
107
|
// Trigger a full page reload when a .po file is updated (default: true)
|
|
106
|
-
//
|
|
108
|
+
// Ensures UI stays in sync with backend translation files
|
|
107
109
|
reloadOnPoChange: true,
|
|
108
110
|
|
|
109
111
|
// Enable in production (default: false)
|
|
110
112
|
// ⚠️ Only enable with proper authentication!
|
|
111
113
|
production: false,
|
|
114
|
+
|
|
115
|
+
// 🔒 PREMIUM FEATURE (Coming Soon)
|
|
116
|
+
// License key for premium features
|
|
117
|
+
// licenseKey: 'your-license-key',
|
|
118
|
+
|
|
119
|
+
// 🔒 PREMIUM FEATURE (Coming Soon)
|
|
120
|
+
// AI configuration for translation assistance
|
|
121
|
+
// ai: {
|
|
122
|
+
// provider: 'openai' | 'anthropic' | 'google',
|
|
123
|
+
// apiKey: 'your-api-key'
|
|
124
|
+
// },
|
|
112
125
|
})
|
|
113
126
|
```
|
|
114
127
|
|
|
@@ -120,10 +133,104 @@ lingo({
|
|
|
120
133
|
|--------|------|---------|-------------|
|
|
121
134
|
| `route` | `string` | `'/_translations'` | URL path where the editor is served |
|
|
122
135
|
| `localesDir` | `string` | `'./locales'` | Directory containing `.po` files. For SvelteKit projects, commonly `'./src/locales'`. Relative to project root. |
|
|
123
|
-
| `
|
|
136
|
+
| `restartOnPoChange` | `boolean` | `false` | **Nuclear Option** ⚠️ - Only use when another plugin conflicts with `.po` file changes (e.g., wuchale). Restarts the dev server when a `.po` file is updated. Most users won't need this. |
|
|
137
|
+
| `reloadOnPoChange` | `boolean` | `true` | Trigger a full page reload when a `.po` file is updated. Ensures UI stays in sync with backend translation files. |
|
|
138
|
+
| `production` | `boolean` | `false` | Enable editor in production builds. ⚠️ Only enable with proper authentication! |
|
|
139
|
+
| `licenseKey` | `string` | `undefined` | **Coming Soon** 🔒 - License key for premium features (not yet available). |
|
|
140
|
+
| `ai` | `object` | `undefined` | **Coming Soon** 🔒 - AI configuration for translation assistance (not yet available). Will support `'openai'`, `'anthropic'`, or `'google'` as provider with optional `apiKey`. |
|
|
141
|
+
|
|
142
|
+
### Premium Features (Coming Soon)
|
|
143
|
+
|
|
144
|
+
The following premium features are currently in development and will be available in future releases:
|
|
145
|
+
|
|
146
|
+
#### License Key System (`licenseKey`)
|
|
147
|
+
- **Status**: Under development
|
|
148
|
+
- **Purpose**: Enable premium features with license validation
|
|
149
|
+
- **Expected**: Q1 2026
|
|
150
|
+
|
|
151
|
+
#### AI-Powered Translation (`ai`)
|
|
152
|
+
- **Status**: Under development
|
|
153
|
+
- **Purpose**: Assist with translations using your preferred AI provider
|
|
154
|
+
- **Supported Providers**: OpenAI, Anthropic, Google
|
|
155
|
+
- **Expected**: Q1 2026
|
|
156
|
+
|
|
157
|
+
### Advanced Configuration Notes
|
|
158
|
+
|
|
159
|
+
#### `restartOnPoChange` - Nuclear Option
|
|
160
|
+
This is an **advanced fallback option** that should only be used in specific situations:
|
|
161
|
+
|
|
162
|
+
- ✅ **Use when**: Another plugin (like [wuchale](https://wuchale.dev/)) doesn't respond to `.po` file changes
|
|
163
|
+
- ❌ **Don't use**: As your primary reload strategy (use `reloadOnPoChange` instead)
|
|
164
|
+
- ⚠️ **Impact**: Full dev server restart is slower than page reload
|
|
165
|
+
|
|
166
|
+
**Example scenario** where this might be needed:
|
|
167
|
+
```ts
|
|
168
|
+
lingo({
|
|
169
|
+
localesDir: './locales',
|
|
170
|
+
restartOnPoChange: true, // Only if wuchale or other plugins conflict
|
|
171
|
+
reloadOnPoChange: false, // Disable the default fast reload
|
|
172
|
+
})
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Type Definitions
|
|
176
|
+
|
|
177
|
+
#### PluginOptions
|
|
178
|
+
Main configuration interface for the Vite plugin. See **Plugin Options** table above.
|
|
179
|
+
|
|
180
|
+
#### Translation
|
|
181
|
+
Represents a single translation entry in a `.po` file:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
interface Translation {
|
|
185
|
+
msgid: string; // Message ID (original text)
|
|
186
|
+
msgstr: string; // Message string (translated text)
|
|
187
|
+
context?: string; // Optional context for disambiguation
|
|
188
|
+
comments?: { // Optional metadata
|
|
189
|
+
reference?: string; // File reference where string is used
|
|
190
|
+
translator?: string; // Translator notes
|
|
191
|
+
extracted?: string; // Extracted comments
|
|
192
|
+
flag?: string; // Fuzzy or other flags
|
|
193
|
+
};
|
|
194
|
+
fuzzy?: boolean; // Whether translation is marked as fuzzy
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### Language
|
|
199
|
+
Represents a language with all its translations:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
interface Language {
|
|
203
|
+
code: string; // Language code (e.g., 'en', 'es', 'fr')
|
|
204
|
+
name: string; // Language name (e.g., 'English', 'Spanish')
|
|
205
|
+
path: string; // Path to the .po file
|
|
206
|
+
translations: Translation[]; // Array of translation entries
|
|
207
|
+
progress: {
|
|
208
|
+
total: number; // Total number of strings
|
|
209
|
+
translated: number; // Number of translated strings
|
|
210
|
+
fuzzy: number; // Number of fuzzy translations
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### LanguageStats
|
|
216
|
+
Statistics for language translation progress:
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
interface LanguageStats {
|
|
220
|
+
code: string; // Language code
|
|
221
|
+
name: string; // Language name
|
|
222
|
+
total: number; // Total number of strings
|
|
223
|
+
translated: number; // Number of translated strings
|
|
224
|
+
fuzzy: number; // Number of fuzzy translations
|
|
225
|
+
untranslated: number; // Number of untranslated strings
|
|
226
|
+
progress: number; // Progress percentage (0-100)
|
|
227
|
+
}
|
|
228
|
+
```
|
|
124
229
|
|
|
125
230
|
### Exported Types
|
|
126
231
|
|
|
232
|
+
All types are exported from the main package:
|
|
233
|
+
|
|
127
234
|
```ts
|
|
128
235
|
import type {
|
|
129
236
|
PluginOptions,
|