i18ntk 1.6.1 → 1.6.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 +66 -22
- package/main/i18ntk-analyze.js +1 -0
- package/main/i18ntk-autorun.js +2 -1
- package/main/i18ntk-complete.js +2 -1
- package/main/i18ntk-init.js +2 -1
- package/main/i18ntk-manage.js +3 -0
- package/main/i18ntk-sizing.js +1 -0
- package/main/i18ntk-summary.js +1 -0
- package/main/i18ntk-usage.js +3 -2
- package/main/i18ntk-validate.js +1 -0
- package/package.json +35 -13
- package/scripts/debug/README.md +33 -33
- package/scripts/debug/debug-translation.js +55 -55
- package/scripts/export-translations.js +83 -83
- package/scripts/locale-optimizer.js +425 -425
- package/scripts/path-utils.test.js +23 -0
- package/scripts/prepublish.js +348 -0
- package/scripts/reset-defaults.test.js +18 -0
- package/scripts/smoke-pack.js +209 -0
- package/scripts/test-runner.js +207 -0
- package/scripts/update-checker.js +224 -224
- package/scripts/validate-all-translations.js +137 -137
- package/settings/.i18n-admin-config.json +7 -0
- package/settings/admin-config.json +1 -1
- package/settings/i18ntk-config.json +198 -0
- package/settings/settings-cli.js +3 -1
- package/settings/settings-manager.js +2 -2
- package/utils/config-helper.js +4 -4
- package/utils/config-manager.js +1 -1
- package/utils/i18n-helper.js +235 -120
- package/utils/security-config.js +1 -1
- package/utils/security.js +2 -2
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
**Version:** 1.6.
|
|
6
|
-
**Last Updated:** 2025-08-
|
|
5
|
+
**Version:** 1.6.3
|
|
6
|
+
**Last Updated:** 2025-08-09
|
|
7
7
|
**GitHub Repository:** [vladnoskv/i18ntk](https://github.com/vladnoskv/i18ntk)
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/i18ntk) [](https://badge.fury.io/js/i18ntk) [](https://nodejs.org/) [](https://www.npmjs.com/package/i18ntk) [](https://github.com/vladnoskv/i18ntk)
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
**Framework Support:** Auto-detects popular libraries (React i18next, Vue i18n, i18next, Nuxt i18n, Svelte i18n) or works without a framework. i18ntk manages translation files and validation—it does NOT implement translations on pages.
|
|
14
14
|
|
|
15
|
-
> **Zero dependencies** | **
|
|
15
|
+
> **Zero dependencies** | **Works with any framework** | **Enterprise-grade security**
|
|
16
16
|
|
|
17
17
|
> **v1.6.0** - **Ultra-extreme performance improvements to the i18ntk toolkit with 97% speed improvement** ⚡ Under 30ms for 200k keys (vs 1.2 seconds), up to 86% package size reduction, zero runtime dependencies.
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# Install globally
|
|
23
|
-
npm
|
|
23
|
+
npm i i18ntk
|
|
24
24
|
|
|
25
25
|
# Interactive setup
|
|
26
26
|
npx i18ntk init
|
|
@@ -75,21 +75,21 @@ i18ntk validate --source ./locales
|
|
|
75
75
|
|
|
76
76
|
## 🔧 Configuration
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
sourceDir:
|
|
84
|
-
outputDir:
|
|
85
|
-
defaultLanguage:
|
|
86
|
-
supportedLanguages: [
|
|
87
|
-
performance: {
|
|
88
|
-
mode:
|
|
89
|
-
batchSize: 1000,
|
|
90
|
-
concurrency: 16
|
|
78
|
+
Configuration is managed through the `settings/i18ntk-config.json` file:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"version": "1.6.3",
|
|
83
|
+
"sourceDir": "./locales",
|
|
84
|
+
"outputDir": "./i18ntk-reports",
|
|
85
|
+
"defaultLanguage": "en",
|
|
86
|
+
"supportedLanguages": ["en", "es", "fr", "de"],
|
|
87
|
+
"performance": {
|
|
88
|
+
"mode": "extreme",
|
|
89
|
+
"batchSize": 1000,
|
|
90
|
+
"concurrency": 16
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
## 🌍 Language Optimization
|
|
@@ -148,15 +148,16 @@ your-project/
|
|
|
148
148
|
│ ├── en.json
|
|
149
149
|
│ ├── es.json
|
|
150
150
|
│ └── ...
|
|
151
|
-
├── i18ntk-reports/
|
|
152
|
-
└──
|
|
151
|
+
├── i18ntk-reports/ # Generated reports
|
|
152
|
+
└── settings/ # Configuration directory
|
|
153
|
+
└── i18ntk-config.json # Main configuration file
|
|
153
154
|
```
|
|
154
155
|
|
|
155
156
|
## 🚨 Important Notes
|
|
156
157
|
|
|
157
158
|
- **Locale files are backed up automatically** before optimization
|
|
158
159
|
- **Use interactive optimizer** for safe locale management
|
|
159
|
-
- **Zero breaking changes** from v1.5.x to v1.6.
|
|
160
|
+
- **Zero breaking changes** from v1.5.x to v1.6.3
|
|
160
161
|
- **All improvements applied automatically** on update
|
|
161
162
|
|
|
162
163
|
## 📞 Support
|
|
@@ -168,4 +169,47 @@ your-project/
|
|
|
168
169
|
|
|
169
170
|
---
|
|
170
171
|
|
|
171
|
-
**Made for the global development community** ❤️
|
|
172
|
+
**Made for the global development community** ❤️
|
|
173
|
+
|
|
174
|
+
## Migration Guide
|
|
175
|
+
|
|
176
|
+
### Upgrading from Deprecated Versions
|
|
177
|
+
|
|
178
|
+
#### From any version < 1.6.3 (DEPRECATED - use latest version)
|
|
179
|
+
1. **Backup your current configuration**:
|
|
180
|
+
```bash
|
|
181
|
+
cp -r ./.i18ntk ./.i18ntk-backup-$(date +%Y%m%d)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
2. **Install the latest version**:
|
|
185
|
+
```bash
|
|
186
|
+
npm install i18ntk@1.6.3
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
3. **Run configuration migration**:
|
|
190
|
+
```bash
|
|
191
|
+
npx i18ntk@1.6.3 --migrate
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
4. **Verify installation**:
|
|
195
|
+
```bash
|
|
196
|
+
npx i18ntk@1.6.3--validate
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### Preserved Features from 1.6.3
|
|
200
|
+
- ✅ Ultra-extreme performance improvements
|
|
201
|
+
- ✅ Enhanced security with PIN protection
|
|
202
|
+
- ✅ Comprehensive backup & recovery
|
|
203
|
+
- ✅ Edge case handling
|
|
204
|
+
- ✅ Memory optimization
|
|
205
|
+
- ✅ Advanced configuration management
|
|
206
|
+
|
|
207
|
+
#### Breaking Changes
|
|
208
|
+
- **None** - 1.6.3 is fully backward compatible
|
|
209
|
+
|
|
210
|
+
### Migration Support
|
|
211
|
+
If you encounter issues during migration:
|
|
212
|
+
1. Check the [troubleshooting guide](docs/TROUBLESHOOTING.md)
|
|
213
|
+
2. Open an issue on [GitHub](https://github.com/vladnoskv/i18ntk/issues)
|
|
214
|
+
3. Join our [Discord community](https://discord.gg/i18ntk)
|
|
215
|
+
|
package/main/i18ntk-analyze.js
CHANGED
|
@@ -11,6 +11,7 @@ const fs = require('fs');
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
const readline = require('readline');
|
|
13
13
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
14
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
14
15
|
const { getUnifiedConfig, parseCommonArgs, displayHelp } = require('../utils/config-helper');
|
|
15
16
|
const SecurityUtils = require('../utils/security');
|
|
16
17
|
const AdminCLI = require('../utils/admin-cli');
|
package/main/i18ntk-autorun.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* i18n Toolkit - Automated Workflow Runner (1.6.
|
|
4
|
+
* i18n Toolkit - Automated Workflow Runner (1.6.3-ready)
|
|
5
5
|
* Executes predefined workflow steps for i18n management.
|
|
6
6
|
* - Deterministic translation loading
|
|
7
7
|
* - Safe config precedence (defaults < constructor < unified/CLI)
|
|
@@ -14,6 +14,7 @@ const fs = require('fs');
|
|
|
14
14
|
const path = require('path');
|
|
15
15
|
const { spawnSync } = require('child_process');
|
|
16
16
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
17
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
17
18
|
const { getUnifiedConfig, parseCommonArgs, displayHelp, ensureInitialized } = require('../utils/config-helper');
|
|
18
19
|
const SecurityUtils = require('../utils/security');
|
|
19
20
|
const configManager = require('../utils/config-manager');
|
package/main/i18ntk-complete.js
CHANGED
|
@@ -17,6 +17,7 @@ const { execSync } = require('child_process');
|
|
|
17
17
|
const SecurityUtils = require('../utils/security');
|
|
18
18
|
const { getUnifiedConfig, parseCommonArgs, displayHelp } = require('../utils/config-helper');
|
|
19
19
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
20
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
|
|
@@ -411,7 +412,7 @@ class I18nCompletionTool {
|
|
|
411
412
|
const { fromMenu = false } = options;
|
|
412
413
|
|
|
413
414
|
SecurityUtils.logSecurityEvent('I18n completion tool started', 'info', {
|
|
414
|
-
version:
|
|
415
|
+
version: this.config.version,
|
|
415
416
|
nodeVersion: process.version,
|
|
416
417
|
platform: process.platform
|
|
417
418
|
});
|
package/main/i18ntk-init.js
CHANGED
|
@@ -19,7 +19,8 @@ const configManager = require('../utils/config-manager');
|
|
|
19
19
|
const SecurityUtils = require('../utils/security');
|
|
20
20
|
const AdminAuth = require('../utils/admin-auth');
|
|
21
21
|
const UIi18n = require('./i18ntk-ui');
|
|
22
|
-
|
|
22
|
+
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
23
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
23
24
|
const { getUnifiedConfig, parseCommonArgs, displayHelp } = require('../utils/config-helper');
|
|
24
25
|
|
|
25
26
|
// Language configurations with native names
|
package/main/i18ntk-manage.js
CHANGED
|
@@ -34,6 +34,9 @@ const I18nSizingAnalyzer = require('./i18ntk-sizing');
|
|
|
34
34
|
const SettingsCLI = require('../settings/settings-cli');
|
|
35
35
|
const I18nDebugger = require('../scripts/debug/debugger');
|
|
36
36
|
|
|
37
|
+
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
38
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
39
|
+
|
|
37
40
|
// Use unified configuration system
|
|
38
41
|
const { getUnifiedConfig, ensureInitialized, validateSourceDir } = require('../utils/config-helper');
|
|
39
42
|
|
package/main/i18ntk-sizing.js
CHANGED
|
@@ -35,6 +35,7 @@ const fs = require('fs');
|
|
|
35
35
|
const path = require('path');
|
|
36
36
|
const { performance } = require('perf_hooks');
|
|
37
37
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
38
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
38
39
|
const configManager = require('../utils/config-manager');
|
|
39
40
|
const SecurityUtils = require('../utils/security');
|
|
40
41
|
const { getUnifiedConfig } = require('../utils/config-helper');
|
package/main/i18ntk-summary.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
6
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
6
7
|
const { getUnifiedConfig, parseCommonArgs, displayHelp } = require('../utils/config-helper');
|
|
7
8
|
const SecurityUtils = require('../utils/security');
|
|
8
9
|
const AdminCLI = require('../utils/admin-cli');
|
package/main/i18ntk-usage.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* I18N USAGE ANALYSIS TOOLKIT - Version 1.
|
|
3
|
+
* I18N USAGE ANALYSIS TOOLKIT - Version 1.6.3
|
|
4
4
|
*
|
|
5
5
|
* This script analyzes source code to find unused translation keys,
|
|
6
6
|
* missing translations, and provides comprehensive translation completeness analysis.
|
|
7
7
|
*
|
|
8
|
-
* NEW in v1.
|
|
8
|
+
* NEW in v1.6.3:
|
|
9
9
|
* - Modular folder structure support
|
|
10
10
|
* - Recursive translation file discovery
|
|
11
11
|
* - NOT_TRANSLATED analysis
|
|
@@ -25,6 +25,7 @@ const fs = require('fs');
|
|
|
25
25
|
const path = require('path');
|
|
26
26
|
const readline = require('readline');
|
|
27
27
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
28
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
28
29
|
const configManager = require('../utils/config-manager');
|
|
29
30
|
const SecurityUtils = require('../utils/security');
|
|
30
31
|
const AdminCLI = require('../utils/admin-cli');
|
package/main/i18ntk-validate.js
CHANGED
|
@@ -38,6 +38,7 @@ if (isUppercase) {
|
|
|
38
38
|
const fs = require('fs');
|
|
39
39
|
const path = require('path');
|
|
40
40
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
41
|
+
loadTranslations(process.env.I18NTK_LANG || 'en');
|
|
41
42
|
const configManager = require('../utils/config-manager');
|
|
42
43
|
const SecurityUtils = require('../utils/security');
|
|
43
44
|
const AdminCLI = require('../utils/admin-cli');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18ntk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "i18ntk (i18n Toolkit) - Ultra-extreme performance enterprise-grade internationalization management toolkit with 97% performance improvement (15.38ms for 200k keys), advanced security with PIN protection, comprehensive backup & recovery, and edge case handling for JavaScript/TypeScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -47,6 +47,11 @@
|
|
|
47
47
|
"author": "Vladimir Noskov (https://github.com/vladnoskv)",
|
|
48
48
|
"type": "commonjs",
|
|
49
49
|
"main": "main/i18ntk-manage.js",
|
|
50
|
+
"exports": {
|
|
51
|
+
".": "./main/i18ntk-manage.js",
|
|
52
|
+
"./ui-locales/*": "./ui-locales/*",
|
|
53
|
+
"./package.json": "./package.json"
|
|
54
|
+
},
|
|
50
55
|
"bin": {
|
|
51
56
|
"i18ntk": "main/i18ntk-manage.js",
|
|
52
57
|
"i18ntk-init": "main/i18ntk-init.js",
|
|
@@ -69,13 +74,19 @@
|
|
|
69
74
|
"settings/",
|
|
70
75
|
"ui-locales/",
|
|
71
76
|
"LICENSE",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"!scripts/test-runner.js",
|
|
75
|
-
"!scripts/path-utils.test.js",
|
|
76
|
-
"!scripts/reset-defaults.test.js"
|
|
77
|
+
"package.json",
|
|
78
|
+
"README.md"
|
|
77
79
|
],
|
|
80
|
+
"sideEffects": false,
|
|
78
81
|
"scripts": {
|
|
82
|
+
"docs:cleanup-deprecated": "node dev/cleanup-deprecated-notices.js",
|
|
83
|
+
"i18ntk": "node main/i18ntk-manage.js",
|
|
84
|
+
"i18ntk:init": "node main/i18ntk-init.js",
|
|
85
|
+
"i18ntk:analyze": "node main/i18ntk-analyze.js",
|
|
86
|
+
"i18ntk:validate": "main/i18ntk-validate.js",
|
|
87
|
+
"i18ntk:usage": "node main/i18ntk-usage.js",
|
|
88
|
+
"i18ntk:complete": "node main/i18ntk-complete.js",
|
|
89
|
+
"i18ntk-sizing": "main/i18ntk-sizing.js",
|
|
79
90
|
"start": "node main/i18ntk-manage.js",
|
|
80
91
|
"settings": "node settings/settings-cli.js",
|
|
81
92
|
"i18ntk:doctor": "node main/i18ntk-doctor.js",
|
|
@@ -93,7 +104,8 @@
|
|
|
93
104
|
"summary": "node main/i18ntk-summary.js",
|
|
94
105
|
"full-coverage": "npm run complete && npm run analyze",
|
|
95
106
|
"verify-package": "node dev/verify-package.js",
|
|
96
|
-
"
|
|
107
|
+
"smoke:pack": "node scripts/smoke-pack.js",
|
|
108
|
+
"prepublishOnly": "npm run verify-package && npm run smoke:pack",
|
|
97
109
|
"test": "node scripts/test-runner.js",
|
|
98
110
|
"test:all": "node scripts/test-runner.js",
|
|
99
111
|
"test:quick": "node scripts/test-runner.js --quick",
|
|
@@ -115,7 +127,13 @@
|
|
|
115
127
|
"languages:select": "node settings/settings-cli.js",
|
|
116
128
|
"languages:list": "node settings/settings-cli.js --list-languages",
|
|
117
129
|
"languages:status": "node settings/settings-cli.js --language-status",
|
|
118
|
-
"languages:restore": "echo 'Language restoration - use settings CLI for manual configuration'"
|
|
130
|
+
"languages:restore": "echo 'Language restoration - use settings CLI for manual configuration'",
|
|
131
|
+
"version:update": "node scripts/version-updater.js",
|
|
132
|
+
"version:check": "node scripts/version-checker.js",
|
|
133
|
+
"version:bump": "node scripts/version-bump.js",
|
|
134
|
+
"docs:update-versions": "node scripts/update-docs-versions.js",
|
|
135
|
+
"release:prepare": "npm run version:check && npm run docs:update-versions && npm run prepublishOnly",
|
|
136
|
+
"deprecate:old-versions": "node scripts/deprecate-versions.js"
|
|
119
137
|
},
|
|
120
138
|
"dependencies": {},
|
|
121
139
|
"engines": {
|
|
@@ -126,9 +144,9 @@
|
|
|
126
144
|
},
|
|
127
145
|
"preferGlobal": true,
|
|
128
146
|
"versionInfo": {
|
|
129
|
-
"version": "1.6.
|
|
130
|
-
"releaseDate": "
|
|
131
|
-
"lastUpdated": "
|
|
147
|
+
"version": "1.6.3",
|
|
148
|
+
"releaseDate": "27/07/2025",
|
|
149
|
+
"lastUpdated": "09/08/2025",
|
|
132
150
|
"maintainer": "Vladimir Noskov",
|
|
133
151
|
"changelog": "./CHANGELOG.md",
|
|
134
152
|
"documentation": "./README.md",
|
|
@@ -146,12 +164,16 @@
|
|
|
146
164
|
],
|
|
147
165
|
"breakingChanges": [],
|
|
148
166
|
"deprecations": [
|
|
149
|
-
"<1.5.0",
|
|
150
167
|
"1.0.x",
|
|
151
168
|
"1.1.x",
|
|
152
169
|
"1.2.x",
|
|
153
170
|
"1.3.x",
|
|
154
|
-
"1.4.x"
|
|
171
|
+
"1.4.x",
|
|
172
|
+
"1.5.x",
|
|
173
|
+
"1.6.0",
|
|
174
|
+
"1.6.1",
|
|
175
|
+
"1.6.2"
|
|
176
|
+
|
|
155
177
|
],
|
|
156
178
|
"nextVersion": "1.7.0",
|
|
157
179
|
"supportedNodeVersions": ">=16.0.0",
|
package/scripts/debug/README.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# Debug Tools
|
|
2
|
-
|
|
3
|
-
This folder contains debugging tools and utilities for the i18nTK project.
|
|
4
|
-
|
|
5
|
-
## Debug Scripts
|
|
6
|
-
|
|
7
|
-
- **debugger.js** - Main debugging script for identifying issues
|
|
8
|
-
- **config-validator.js** - Configuration validation debugger
|
|
9
|
-
- **translation-debugger.js** - Translation-specific debugging tools
|
|
10
|
-
- **performance-profiler.js** - Performance analysis and profiling
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# Run main debugger
|
|
16
|
-
node scripts/debug/debugger.js
|
|
17
|
-
|
|
18
|
-
# Validate configuration
|
|
19
|
-
node scripts/debug/config-validator.js
|
|
20
|
-
|
|
21
|
-
# Debug translations
|
|
22
|
-
node scripts/debug/translation-debugger.js
|
|
23
|
-
|
|
24
|
-
# Profile performance
|
|
25
|
-
node scripts/debug/performance-profiler.js
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Debug Output
|
|
29
|
-
|
|
30
|
-
Debug logs and reports are saved to `scripts/debug/logs/` with timestamps.
|
|
31
|
-
|
|
32
|
-
## Version 1.5.0 Update
|
|
33
|
-
|
|
1
|
+
# Debug Tools
|
|
2
|
+
|
|
3
|
+
This folder contains debugging tools and utilities for the i18nTK project.
|
|
4
|
+
|
|
5
|
+
## Debug Scripts
|
|
6
|
+
|
|
7
|
+
- **debugger.js** - Main debugging script for identifying issues
|
|
8
|
+
- **config-validator.js** - Configuration validation debugger
|
|
9
|
+
- **translation-debugger.js** - Translation-specific debugging tools
|
|
10
|
+
- **performance-profiler.js** - Performance analysis and profiling
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Run main debugger
|
|
16
|
+
node scripts/debug/debugger.js
|
|
17
|
+
|
|
18
|
+
# Validate configuration
|
|
19
|
+
node scripts/debug/config-validator.js
|
|
20
|
+
|
|
21
|
+
# Debug translations
|
|
22
|
+
node scripts/debug/translation-debugger.js
|
|
23
|
+
|
|
24
|
+
# Profile performance
|
|
25
|
+
node scripts/debug/performance-profiler.js
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Debug Output
|
|
29
|
+
|
|
30
|
+
Debug logs and reports are saved to `scripts/debug/logs/` with timestamps.
|
|
31
|
+
|
|
32
|
+
## Version 1.5.0 Update
|
|
33
|
+
|
|
34
34
|
**Critical Bug Fix**: These debug tools were moved from `/dev/debug/` to `/scripts/debug/` in v1.5.0 to resolve MODULE_NOT_FOUND errors when using `npx i18ntk`.
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
function getAllKeys(obj, prefix = '') {
|
|
5
|
-
let keys = [];
|
|
6
|
-
for (const key in obj) {
|
|
7
|
-
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
8
|
-
keys = keys.concat(getAllKeys(obj[key], prefix ? `${prefix}.${key}` : key));
|
|
9
|
-
} else {
|
|
10
|
-
keys.push(prefix ? `${prefix}.${key}` : key);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return keys;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function loadLanguageData(lang) {
|
|
17
|
-
const baseDir = './ui-locales';
|
|
18
|
-
const langDir = path.join(baseDir, lang);
|
|
19
|
-
const files = fs.readdirSync(langDir).filter(f => f.endsWith('.json'));
|
|
20
|
-
|
|
21
|
-
let langData = {};
|
|
22
|
-
for (const file of files) {
|
|
23
|
-
const filePath = path.join(langDir, file);
|
|
24
|
-
const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
25
|
-
langData = { ...langData, [file.replace('.json', '')]: content };
|
|
26
|
-
}
|
|
27
|
-
return langData;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
console.log('🔍 Checking translation consistency...\n');
|
|
31
|
-
|
|
32
|
-
const enData = loadLanguageData('en');
|
|
33
|
-
const zhData = loadLanguageData('zh');
|
|
34
|
-
|
|
35
|
-
const enKeys = getAllKeys(enData);
|
|
36
|
-
const zhKeys = getAllKeys(zhData);
|
|
37
|
-
|
|
38
|
-
console.log(`English keys: ${enKeys.length}`);
|
|
39
|
-
console.log(`Chinese keys: ${zhKeys.length}`);
|
|
40
|
-
|
|
41
|
-
const missingInZh = enKeys.filter(key => !zhKeys.includes(key));
|
|
42
|
-
const extraInZh = zhKeys.filter(key => !enKeys.includes(key));
|
|
43
|
-
|
|
44
|
-
if (missingInZh.length > 0) {
|
|
45
|
-
console.log('\n❌ Missing in Chinese:');
|
|
46
|
-
missingInZh.forEach(key => console.log(` - ${key}`));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (extraInZh.length > 0) {
|
|
50
|
-
console.log('\n⚠️ Extra in Chinese:');
|
|
51
|
-
extraInZh.forEach(key => console.log(` - ${key}`));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (missingInZh.length === 0 && extraInZh.length === 0) {
|
|
55
|
-
console.log('✅ All translations are consistent!');
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function getAllKeys(obj, prefix = '') {
|
|
5
|
+
let keys = [];
|
|
6
|
+
for (const key in obj) {
|
|
7
|
+
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
8
|
+
keys = keys.concat(getAllKeys(obj[key], prefix ? `${prefix}.${key}` : key));
|
|
9
|
+
} else {
|
|
10
|
+
keys.push(prefix ? `${prefix}.${key}` : key);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return keys;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function loadLanguageData(lang) {
|
|
17
|
+
const baseDir = './ui-locales';
|
|
18
|
+
const langDir = path.join(baseDir, lang);
|
|
19
|
+
const files = fs.readdirSync(langDir).filter(f => f.endsWith('.json'));
|
|
20
|
+
|
|
21
|
+
let langData = {};
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
const filePath = path.join(langDir, file);
|
|
24
|
+
const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
25
|
+
langData = { ...langData, [file.replace('.json', '')]: content };
|
|
26
|
+
}
|
|
27
|
+
return langData;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.log('🔍 Checking translation consistency...\n');
|
|
31
|
+
|
|
32
|
+
const enData = loadLanguageData('en');
|
|
33
|
+
const zhData = loadLanguageData('zh');
|
|
34
|
+
|
|
35
|
+
const enKeys = getAllKeys(enData);
|
|
36
|
+
const zhKeys = getAllKeys(zhData);
|
|
37
|
+
|
|
38
|
+
console.log(`English keys: ${enKeys.length}`);
|
|
39
|
+
console.log(`Chinese keys: ${zhKeys.length}`);
|
|
40
|
+
|
|
41
|
+
const missingInZh = enKeys.filter(key => !zhKeys.includes(key));
|
|
42
|
+
const extraInZh = zhKeys.filter(key => !enKeys.includes(key));
|
|
43
|
+
|
|
44
|
+
if (missingInZh.length > 0) {
|
|
45
|
+
console.log('\n❌ Missing in Chinese:');
|
|
46
|
+
missingInZh.forEach(key => console.log(` - ${key}`));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (extraInZh.length > 0) {
|
|
50
|
+
console.log('\n⚠️ Extra in Chinese:');
|
|
51
|
+
extraInZh.forEach(key => console.log(` - ${key}`));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (missingInZh.length === 0 && extraInZh.length === 0) {
|
|
55
|
+
console.log('✅ All translations are consistent!');
|
|
56
56
|
}
|