@ng-linguo/linguo 0.9.1 → 0.9.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.
- package/README.md +23 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -231,10 +231,11 @@ The strings above are also your source catalog. Use the
|
|
|
231
231
|
JSON your loader serves:
|
|
232
232
|
|
|
233
233
|
```bash
|
|
234
|
-
|
|
235
|
-
linguo-extract
|
|
236
|
-
linguo-extract
|
|
237
|
-
linguo-extract
|
|
234
|
+
npm i -D @ng-linguo/extract # one-time: install the CLI
|
|
235
|
+
npx linguo-extract init --locales en,pl,de # create linguo.config.json
|
|
236
|
+
npx linguo-extract extract # scan source → en/pl/de .po catalogs
|
|
237
|
+
npx linguo-extract translate --all # fill missing entries with AI (optional)
|
|
238
|
+
npx linguo-extract compile # .po → runtime JSON
|
|
238
239
|
```
|
|
239
240
|
|
|
240
241
|
That's the whole loop. See [Translation workflow](#translation-workflow) for the
|
|
@@ -275,13 +276,15 @@ they can render.
|
|
|
275
276
|
`@ng-linguo/extract` is a pure-Node CLI (no Angular dependency, so it never
|
|
276
277
|
drags the framework into your tooling) that turns your source into translation
|
|
277
278
|
files and back. It reads a `linguo.config.json` — auto-discovered — listing your
|
|
278
|
-
locales and paths.
|
|
279
|
+
locales and paths. Install it once as a dev dependency; its bin is
|
|
280
|
+
`linguo-extract`, so you invoke it with `npx` (or from an npm script):
|
|
279
281
|
|
|
280
282
|
```bash
|
|
281
|
-
linguo
|
|
282
|
-
linguo-extract
|
|
283
|
-
linguo-extract
|
|
284
|
-
linguo-extract
|
|
283
|
+
npm i -D @ng-linguo/extract # install once; the bin is `linguo-extract`
|
|
284
|
+
npx linguo-extract init # create/edit linguo.config.json
|
|
285
|
+
npx linguo-extract extract # scan source → <locale>.po catalogs (additive)
|
|
286
|
+
npx linguo-extract translate # fill missing entries with AI (needs a translator)
|
|
287
|
+
npx linguo-extract compile # .po catalogs → runtime <locale>.json
|
|
285
288
|
```
|
|
286
289
|
|
|
287
290
|
### The interactive menu
|
|
@@ -314,11 +317,11 @@ their source text plus `context`. Re-running it is safe and idempotent.
|
|
|
314
317
|
Adding a locale is a couple of steps — or a couple of clicks in the menu:
|
|
315
318
|
|
|
316
319
|
```bash
|
|
317
|
-
linguo-extract init --locales en,pl,de,fr # add `fr` to the config
|
|
318
|
-
linguo-extract extract
|
|
319
|
-
linguo-extract translate --locale fr
|
|
320
|
-
# …or: linguo-extract copyprompt fr
|
|
321
|
-
linguo-extract compile
|
|
320
|
+
npx linguo-extract init --locales en,pl,de,fr # add `fr` to the config
|
|
321
|
+
npx linguo-extract extract # seeds fr.po with the source strings
|
|
322
|
+
npx linguo-extract translate --locale fr # fill it in with AI…
|
|
323
|
+
# …or: npx linguo-extract copyprompt fr # …or copy a prompt for any chat model
|
|
324
|
+
npx linguo-extract compile # produce fr.json
|
|
322
325
|
```
|
|
323
326
|
|
|
324
327
|
### Translating with AI
|
|
@@ -328,8 +331,8 @@ has all the context it needs. ng-linguo writes a self-contained prompt that
|
|
|
328
331
|
teaches the model your `context` notes, slot tags, and plural rules, and only
|
|
329
332
|
ever sends entries that are still missing. Two ways to run it:
|
|
330
333
|
|
|
331
|
-
- **Clipboard (no key, no config):** `linguo-extract copyprompt pl` copies
|
|
332
|
-
prompt; paste it into any chat model and save the reply over `pl.po`.
|
|
334
|
+
- **Clipboard (no key, no config):** `npx linguo-extract copyprompt pl` copies
|
|
335
|
+
the prompt; paste it into any chat model and save the reply over `pl.po`.
|
|
333
336
|
- **Automatic:** point the `translator` config field at a small module that
|
|
334
337
|
calls your AI provider. ng-linguo builds the prompt and merges the reply; your
|
|
335
338
|
SDK and API key stay yours. See the
|
|
@@ -342,12 +345,12 @@ Every command runs non-interactively and deterministically, so the pipeline
|
|
|
342
345
|
drops into CI as-is:
|
|
343
346
|
|
|
344
347
|
```bash
|
|
345
|
-
linguo-extract extract
|
|
346
|
-
linguo-extract translate --all # optional: fill any gaps (needs a translator)
|
|
347
|
-
linguo-extract compile
|
|
348
|
+
npx linguo-extract extract # fails the build if it errors; idempotent otherwise
|
|
349
|
+
npx linguo-extract translate --all # optional: fill any gaps (needs a translator)
|
|
350
|
+
npx linguo-extract compile
|
|
348
351
|
```
|
|
349
352
|
|
|
350
|
-
`init` is scriptable too: `linguo-extract init --locales en,pl,de --out public/i18n`.
|
|
353
|
+
`init` is scriptable too: `npx linguo-extract init --locales en,pl,de --out public/i18n`.
|
|
351
354
|
|
|
352
355
|
## Configuration
|
|
353
356
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-linguo/linguo",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "A modern, signal-first i18n runtime for Angular 18+ — built on SignalStore, with a translator-safe slot syntax, ICU, and tree-shakeable HTTP loading.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "jmwierzbicki",
|