i18ntk 3.0.0 → 3.1.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/CHANGELOG.md +43 -16
- package/README.md +20 -17
- package/main/i18ntk-sizing.js +471 -218
- package/main/i18ntk-translate.js +399 -68
- package/main/i18ntk-validate.js +26 -14
- package/main/manage/commands/TranslateCommand.js +273 -52
- package/main/manage/commands/ValidateCommand.js +25 -13
- package/package.json +3 -1
- package/settings/settings-cli.js +75 -29
- package/settings/settings-manager.js +109 -1
- package/ui-locales/de.json +2 -2
- package/ui-locales/en.json +2 -2
- package/ui-locales/es.json +2 -2
- package/ui-locales/fr.json +2 -2
- package/ui-locales/ja.json +2 -2
- package/ui-locales/ru.json +4 -3
- package/ui-locales/zh.json +2 -2
- package/utils/config-manager.js +20 -4
- package/utils/security.js +4 -3
- package/utils/translate/cli.js +20 -16
- package/utils/translate/placeholder.js +60 -0
- package/utils/translate/protection.js +243 -0
- package/utils/translate/report.js +49 -22
- package/utils/validation-risk.js +175 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.1.0] - 2026-05-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Placeholder-preserve translation mode**: Translates text segments around dynamic placeholders and reinserts the original tokens exactly.
|
|
12
|
+
- **Auto Translate beta settings**: Added settings for placeholder mode, concurrency, batch size, progress interval, retry count, retry delay, timeout, dry-run preview, report output, and BOM output.
|
|
13
|
+
- **Large-file tuning flags**: Added `--batch-size` and `--progress-interval` to `i18ntk-translate`.
|
|
14
|
+
- **Short-lived placeholder manifest**: Mirrors placeholder maps to an OS temp file during processing and removes it after each file completes.
|
|
15
|
+
- **Validation content-risk helper**: Added structured detection for URLs, email addresses, secret-like values, and likely untranslated English content.
|
|
16
|
+
- **Sizing file-set analysis**: Added per-language file counts, per-file sizing statistics, and missing/extra file comparison across locale folders.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Automated and manager Auto Translate flows now default to placeholder `preserve` mode instead of skipping placeholder-bearing strings.
|
|
20
|
+
- `i18ntk-translate` can now be imported and run in-process by other package modules.
|
|
21
|
+
- Source JSON reads tolerate UTF-8 BOM-prefixed files.
|
|
22
|
+
- Validation warnings now report specific issue types and reasons instead of the vague `Risky content` message.
|
|
23
|
+
- English-content validation now reports an English percentage and only warns above a 10% threshold with at least three detected English words.
|
|
24
|
+
- Sizing reports now include folder-level file counts and per-file key/character breakdowns for each language.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Fixed false-positive validation warnings for normal product copy terms.
|
|
28
|
+
- Fixed validator handling so ordinary explanatory uses of words like `token` or `secret` are not treated as leaked credentials.
|
|
29
|
+
- Fixed distorted `i18ntk-sizing` table output by rendering aligned columns from measured values instead of fixed localized spacing.
|
|
30
|
+
- Fixed sizing language comparison output so it uses analyzed languages and the configured source language baseline.
|
|
31
|
+
|
|
32
|
+
### Security
|
|
33
|
+
- Removed production `child_process` usage from `main/manage/commands/TranslateCommand.js` by replacing the spawned CLI process with an in-process translator call.
|
|
34
|
+
|
|
8
35
|
## [3.0.0] - 2026-05-05
|
|
9
36
|
|
|
10
37
|
### Added
|
|
@@ -63,22 +90,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
63
90
|
|
|
64
91
|
### Scripts
|
|
65
92
|
- Fixed `scripts/build-public-package.js` and `scripts/reset-release-state.js` `npm_execpath` fallback for missing env var.
|
|
66
|
-
- Fixed `scripts/lint-locales.js` BOM handling and try-catch for `fs.readdirSync`.
|
|
67
|
-
|
|
68
|
-
## [2.5.1] - 2026-04-29
|
|
69
|
-
|
|
70
|
-
### Security
|
|
71
|
-
- Fixed `AdminAuth.verifyPin()` to fail closed when admin config is missing, disabled, or malformed instead of returning success.
|
|
72
|
-
- Fixed auth-required checks to fail closed when settings require admin PIN protection but the admin config is unusable.
|
|
73
|
-
- Normalized admin session expiry handling by storing both `expires` and `expiresAt` and cleaning up both formats consistently.
|
|
74
|
-
|
|
75
|
-
### Added
|
|
76
|
-
- Added regression tests for admin PIN fail-closed behavior and session expiry cleanup.
|
|
77
|
-
|
|
78
|
-
### Changed
|
|
79
|
-
- Documented the public npm package staging flow introduced after `2.5.0`.
|
|
80
|
-
|
|
81
|
-
## [2.5.0] - 2026-04-29
|
|
93
|
+
- Fixed `scripts/lint-locales.js` BOM handling and try-catch for `fs.readdirSync`.
|
|
94
|
+
|
|
95
|
+
## [2.5.1] - 2026-04-29
|
|
96
|
+
|
|
97
|
+
### Security
|
|
98
|
+
- Fixed `AdminAuth.verifyPin()` to fail closed when admin config is missing, disabled, or malformed instead of returning success.
|
|
99
|
+
- Fixed auth-required checks to fail closed when settings require admin PIN protection but the admin config is unusable.
|
|
100
|
+
- Normalized admin session expiry handling by storing both `expires` and `expiresAt` and cleaning up both formats consistently.
|
|
101
|
+
|
|
102
|
+
### Added
|
|
103
|
+
- Added regression tests for admin PIN fail-closed behavior and session expiry cleanup.
|
|
104
|
+
|
|
105
|
+
### Changed
|
|
106
|
+
- Documented the public npm package staging flow introduced after `2.5.0`.
|
|
107
|
+
|
|
108
|
+
## [2.5.0] - 2026-04-29
|
|
82
109
|
|
|
83
110
|
### Security
|
|
84
111
|
- Centralized environment-variable access behind the `utils/env-manager.js` allowlist.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# i18ntk v3.
|
|
1
|
+
# i18ntk v3.1.0
|
|
2
2
|
|
|
3
3
|
Zero-dependency internationalization toolkit for setup, scanning, analysis, validation, usage tracking, translation completion, automatic locale translation, and runtime translation loading.
|
|
4
4
|
|
|
@@ -9,25 +9,18 @@ Zero-dependency internationalization toolkit for setup, scanning, analysis, vali
|
|
|
9
9
|
[](https://nodejs.org)
|
|
10
10
|
[](https://www.npmjs.com/package/i18ntk)
|
|
11
11
|
[](LICENSE)
|
|
12
|
-
[](https://socket.dev/npm/package/i18ntk/overview/3.1.0)
|
|
13
13
|
|
|
14
14
|
## Upgrade Notice
|
|
15
15
|
|
|
16
|
-
Versions earlier than `3.
|
|
17
|
-
They are considered unsupported for production use. Upgrade to `3.
|
|
16
|
+
Versions earlier than `3.1.0` may contain known stability and security issues.
|
|
17
|
+
They are considered unsupported for production use. Upgrade to `3.1.0` or newer.
|
|
18
18
|
|
|
19
|
-
## v3.
|
|
19
|
+
## v3.1.0 - Auto Translate Hardening and Validation Warning Tuning
|
|
20
20
|
|
|
21
|
-
v3.
|
|
21
|
+
v3.1.0 improves automatic JSON locale translation through the management menu and the standalone `i18ntk-translate` command. It also reduces noisy validation warnings and added a dedicated settings module for the auto translator.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
- **Standalone CLI**: Use `i18ntk-translate <source-file> <target-lang>` for direct automation and batch translation.
|
|
25
|
-
- **Dry-run preview**: Review translated/skipped counts before writing target files.
|
|
26
|
-
- **Placeholder protection**: Detect and preserve placeholders such as `{name}`, `{{count}}`, `%s`, `%d`, `:id`, `%{name}`, and `${value}`.
|
|
27
|
-
- **Post-translation report**: Print or write translated and skipped key counts.
|
|
28
|
-
- **Zero dependencies**: Translation support uses built-in Node.js modules and the free Google Translate endpoint.
|
|
29
|
-
|
|
30
|
-
For the full detailed changelog, see [CHANGELOG.md](./CHANGELOG.md). For migration notes, see [docs/migration-guide-v3.0.0.md](./docs/migration-guide-v3.0.0.md).
|
|
23
|
+
For the full detailed changelog, see [CHANGELOG.md](./CHANGELOG.md). For migration notes, see [docs/migration-guide-v3.1.0.md](./docs/migration-guide-v3.1.0.md).
|
|
31
24
|
|
|
32
25
|
## What i18ntk Does
|
|
33
26
|
|
|
@@ -139,8 +132,11 @@ Auto Translate also supports:
|
|
|
139
132
|
|
|
140
133
|
- `--source-lang <code>`
|
|
141
134
|
- `--files <pattern>`
|
|
135
|
+
- `--preserve-placeholders`
|
|
142
136
|
- `--skip-placeholders`
|
|
143
137
|
- `--send-placeholders`
|
|
138
|
+
- `--batch-size <n>`
|
|
139
|
+
- `--progress-interval <n>`
|
|
144
140
|
- `--report-file <path>`
|
|
145
141
|
- `--report-stdout`
|
|
146
142
|
|
|
@@ -164,10 +160,10 @@ Direct CLI examples:
|
|
|
164
160
|
```bash
|
|
165
161
|
i18ntk-translate locales/en/common.json de
|
|
166
162
|
i18ntk-translate locales/en/common.json fr --dry-run --report-stdout
|
|
167
|
-
i18ntk-translate locales/en es --files "*.json" --no-confirm --
|
|
163
|
+
i18ntk-translate locales/en es --files "*.json" --no-confirm --preserve-placeholders
|
|
168
164
|
```
|
|
169
165
|
|
|
170
|
-
The manager flow accepts comma- or space-separated target language codes, previews the first target language with a dry run, asks for confirmation, then writes translated files under matching target-language directories such as `locales/de/common.json`.
|
|
166
|
+
The manager flow accepts comma- or space-separated target language codes, or `all` for every configured target language. It previews the first target language with a dry run when enabled, asks for confirmation, then writes translated files under matching target-language directories such as `locales/de/common.json`. By default it preserves placeholders while translating the surrounding text.
|
|
171
167
|
|
|
172
168
|
See [docs/auto-translate.md](docs/auto-translate.md) for full usage details.
|
|
173
169
|
|
|
@@ -201,12 +197,18 @@ Example `.i18ntk-config`:
|
|
|
201
197
|
|
|
202
198
|
```json
|
|
203
199
|
{
|
|
204
|
-
"version": "3.
|
|
200
|
+
"version": "3.1.0",
|
|
205
201
|
"sourceDir": "./locales",
|
|
206
202
|
"i18nDir": "./locales",
|
|
207
203
|
"outputDir": "./i18ntk-reports",
|
|
208
204
|
"sourceLanguage": "en",
|
|
209
205
|
"defaultLanguages": ["de", "es", "fr", "ru"],
|
|
206
|
+
"englishContentThresholdPercent": 10,
|
|
207
|
+
"allowedEnglishTerms": ["BrandName", "PRODUCT_CODE"],
|
|
208
|
+
"autoTranslate": {
|
|
209
|
+
"protectionEnabled": true,
|
|
210
|
+
"protectionFile": "./i18ntk-auto-translate.json"
|
|
211
|
+
},
|
|
210
212
|
"setup": {
|
|
211
213
|
"completed": true
|
|
212
214
|
}
|
|
@@ -225,6 +227,7 @@ See [docs/api/CONFIGURATION.md](docs/api/CONFIGURATION.md) for the full configur
|
|
|
225
227
|
- [Auto Translate Guide](https://github.com/vladnoskv/i18ntk/blob/main/docs/auto-translate.md)
|
|
226
228
|
- [Scanner Guide](https://github.com/vladnoskv/i18ntk/blob/main/docs/scanner-guide.md)
|
|
227
229
|
- [Environment Variables](https://github.com/vladnoskv/i18ntk/blob/main/docs/environment-variables.md)
|
|
230
|
+
- [Migration Guide v3.1.0](https://github.com/vladnoskv/i18ntk/blob/main/docs/migration-guide-v3.1.0.md)
|
|
228
231
|
- [Migration Guide v3.0.0](https://github.com/vladnoskv/i18ntk/blob/main/docs/migration-guide-v3.0.0.md)
|
|
229
232
|
- [Migration Guide v2.6.0](https://github.com/vladnoskv/i18ntk/blob/main/docs/migration-guide-v2.6.0.md)
|
|
230
233
|
- [Migration Guide v2.5.1](https://github.com/vladnoskv/i18ntk/blob/main/docs/migration-guide-v2.5.1.md)
|