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 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.0.0
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
  [![node](https://img.shields.io/badge/node-%3E%3D16-339933)](https://nodejs.org)
10
10
  [![dependencies](https://img.shields.io/badge/dependencies-0-success)](https://www.npmjs.com/package/i18ntk)
11
11
  [![license](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
12
- [![socket](https://socket.dev/api/badge/npm/package/i18ntk/3.0.0)](https://socket.dev/npm/package/i18ntk/overview/3.0.0)
12
+ [![socket](https://socket.dev/api/badge/npm/package/i18ntk/3.1.0)](https://socket.dev/npm/package/i18ntk/overview/3.1.0)
13
13
 
14
14
  ## Upgrade Notice
15
15
 
16
- Versions earlier than `3.0.0` may contain known stability and security issues.
17
- They are considered unsupported for production use. Upgrade to `3.0.0` or newer.
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.0.0 - Auto Translate Release
19
+ ## v3.1.0 - Auto Translate Hardening and Validation Warning Tuning
20
20
 
21
- v3.0.0 adds automatic JSON locale translation through the management menu and the standalone `i18ntk-translate` command. Highlights:
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
- - **Auto Translate (Beta)**: Translate one or more source JSON files into one or more target languages from menu option 14.
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 --skip-placeholders
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.0.0",
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)