@mariokreitz/langsync 0.5.0 → 0.7.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.
- package/README.md +33 -11
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +587 -612
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -29
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
> Modern localization workflow tooling for TypeScript applications.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@mariokreitz/langsync)
|
|
6
|
+
[](https://github.com/mariokreitz/langsync/actions/workflows/ci.yml)
|
|
7
|
+
[](https://codecov.io/gh/mariokreitz/langsync)
|
|
6
8
|
[](https://nodejs.org)
|
|
7
9
|
[](https://github.com/mariokreitz/langsync/blob/main/LICENSE)
|
|
8
10
|
|
|
@@ -14,7 +16,7 @@ chaos of hand-edited JSON or fragile Excel hand-offs.
|
|
|
14
16
|
- **Bidirectional Excel I/O** for non-technical translators.
|
|
15
17
|
- **Strict validation** with CI-friendly exit codes and JSON output.
|
|
16
18
|
- **Auto-detected integrations** for `i18next`, `ngx-translate`, `react-intl`.
|
|
17
|
-
- **Interactive setup** that scaffolds your config and locale files.
|
|
19
|
+
- **Interactive setup** that scaffolds your config and single-file or namespaced locale files.
|
|
18
20
|
|
|
19
21
|
## Install
|
|
20
22
|
|
|
@@ -59,16 +61,16 @@ npx langsync import excel
|
|
|
59
61
|
| Command | Description |
|
|
60
62
|
| ----------------------- | ------------------------------------------------------------------- |
|
|
61
63
|
| `langsync init` | Initialize a typed `langsync.config.ts` and scaffold locale files. |
|
|
62
|
-
| `langsync validate` | Report missing, extra, and empty keys
|
|
64
|
+
| `langsync validate` | Report missing, extra, and empty keys across locales/namespaces. |
|
|
63
65
|
| `langsync find-missing` | Report missing keys per locale; exits non-zero on errors. |
|
|
64
|
-
| `langsync sync` | Synchronize keys
|
|
66
|
+
| `langsync sync` | Synchronize reference keys into each target locale or namespace. |
|
|
65
67
|
| `langsync translate` | Fill empty values in non-reference locales using an AI provider. |
|
|
66
68
|
| `langsync watch` | Watch locale files and run incremental sync + validation on change. |
|
|
67
|
-
| `langsync export excel` | Export
|
|
68
|
-
| `langsync import excel` | Import translations
|
|
69
|
+
| `langsync export excel` | Export locales/namespaces into a single `.xlsx` workbook. |
|
|
70
|
+
| `langsync import excel` | Import workbook translations back into configured JSON files. |
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
`--dry-run`.
|
|
72
|
+
The `validate` and `find-missing` commands support `--reporter json`. The
|
|
73
|
+
`sync`, `translate`, and `import excel` commands support `--dry-run`.
|
|
72
74
|
|
|
73
75
|
## Configuration
|
|
74
76
|
|
|
@@ -83,6 +85,9 @@ export default defineConfig({
|
|
|
83
85
|
locales: ['en', 'de', 'fr'],
|
|
84
86
|
defaultLocale: 'en',
|
|
85
87
|
framework: 'i18next',
|
|
88
|
+
// Opt in to namespaced files when your project outgrows one file per locale.
|
|
89
|
+
// namespaces: { structure: 'locale-dir' }, // ./src/i18n/en/common.json
|
|
90
|
+
// namespaces: { structure: 'locale-prefix' }, // ./src/i18n/en.common.json
|
|
86
91
|
excel: {
|
|
87
92
|
file: 'translations.xlsx',
|
|
88
93
|
sheetName: 'Translations',
|
|
@@ -95,14 +100,31 @@ export default defineConfig({
|
|
|
95
100
|
```
|
|
96
101
|
|
|
97
102
|
JSON, JS, and MJS configs are also supported via cosmiconfig. Omit `framework`
|
|
98
|
-
or set `framework: 'none'` for custom setups.
|
|
103
|
+
or set `framework: 'none'` for custom setups. Omit `namespaces` for the default
|
|
104
|
+
`<input>/<locale>.json` layout, or set `namespaces.structure` to `locale-dir`
|
|
105
|
+
or `locale-prefix` for per-namespace files.
|
|
106
|
+
|
|
107
|
+
## SDK
|
|
108
|
+
|
|
109
|
+
Besides the CLI, LangSync ships a standalone SDK — `@mariokreitz/langsync-sdk` —
|
|
110
|
+
that exports the command runners (`runValidate`, `runSync`, `runFindMissing`,
|
|
111
|
+
`runTranslate`) as in-process, side-effect-free functions. Use it to drive the
|
|
112
|
+
same workflows from Node.js — editor integrations, custom scripts, or CI tooling
|
|
113
|
+
— without shelling out.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install @mariokreitz/langsync-sdk
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
See the [SDK reference](https://docs.langsync.kreitz-webdev.de/docs/sdk) for the
|
|
120
|
+
full surface, options, and result types.
|
|
99
121
|
|
|
100
122
|
## Documentation
|
|
101
123
|
|
|
102
|
-
Full documentation
|
|
103
|
-
and framework integration recipes:
|
|
124
|
+
Full documentation — configuration reference, every CLI command, the VS Code
|
|
125
|
+
extension, the SDK, and framework integration recipes:
|
|
104
126
|
|
|
105
|
-
**https://
|
|
127
|
+
**https://docs.langsync.kreitz-webdev.de**
|
|
106
128
|
|
|
107
129
|
## License
|
|
108
130
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@langsync
|
|
1
|
+
import '@mariokreitz/langsync-sdk';
|