i18ntk 1.4.1 โ†’ 1.4.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/CHANGELOG.md CHANGED
@@ -2,7 +2,15 @@
2
2
 
3
3
  All notable changes to the i18n Management Toolkit will be documented in this file.
4
4
 
5
- **Current Version:** 1.4.1
5
+ **Current Version:** 1.4.2
6
+
7
+ ## [1.4.2] - 04/08/2025
8
+
9
+ ### Fixed
10
+ - **CRITICAL**: Fixed `MODULE_NOT_FOUND` error when running `npx i18ntk` due to missing debug scripts in npm package
11
+ - Relocated debug scripts from `/dev/debug/` to `/scripts/debug/` to ensure all required files are included in the npm package
12
+ - Updated all internal path references to reflect the new debug script location
13
+ - Resolved compatibility issues caused by the removal of `/dev` directory from npm package
6
14
 
7
15
  ## [1.4.1] - 04/08/2025
8
16
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D16.0.0-brightgreen.svg)](https://nodejs.org/)
6
6
 
7
- **Version:** 1.4.1 (04/08/2025) - i18n internationalization toolkit for JavaScript/TypeScript projects.
7
+ **Version:** 1.4.2 (08/08/2025) - i18n internationalization toolkit for JavaScript/TypeScript projects.
8
8
 
9
9
  ## ๐Ÿš€ Quick Start
10
10
 
@@ -32,7 +32,13 @@ npx i18ntk analyze
32
32
  npx i18ntk summary
33
33
  ```
34
34
 
35
- ## โœจ What's New in v1.4.1
35
+ ## โœจ What's New in v1.4.2
36
+
37
+ ### ๐Ÿšจ Critical Bug Fix
38
+ - **Fixed MODULE_NOT_FOUND Error**: Resolved critical issue in v1.4.1 where `npx i18ntk` would fail with missing debug scripts
39
+ - **Relocated Debug Tools**: Moved debug scripts from `/dev/debug/` to `/scripts/debug/` to ensure proper npm package inclusion
40
+ - **Updated All References**: Fixed all internal path references to work with new debug script location
41
+ - **Immediate Update Recommended**: Do not use v1.4.1 and any v1.4.1 users should update to v1.4.2 immediately. Apologies for the issue, due to the local testing environments, the bug was missed in testing.
36
42
 
37
43
  ### ๐Ÿ”ง Debug Tools Streamlining & Package Optimization
38
44
  - **Reduced Package Size**: Removed development debug tools from production builds, significantly reducing package footprint
@@ -32,7 +32,7 @@ const I18nValidator = require('./i18ntk-validate');
32
32
  const I18nUsageAnalyzer = require('./i18ntk-usage');
33
33
  const I18nSizingAnalyzer = require('./i18ntk-sizing');
34
34
  const SettingsCLI = require('../settings/settings-cli');
35
- const I18nDebugger = require('../dev/debug/debugger');
35
+ const I18nDebugger = require('../scripts/debug/debugger');
36
36
 
37
37
  // Enhanced default configuration with multiple path detection
38
38
  const DEFAULT_CONFIG = {
@@ -693,7 +693,7 @@ class I18nManager {
693
693
  async runDebugTool(toolName, displayName) {
694
694
  console.log(this.ui.t('debug.runningDebugTool', { displayName }));
695
695
  try {
696
- const toolPath = path.join(__dirname, '..', 'dev', 'debug', toolName);
696
+ const toolPath = path.join(__dirname, '..', 'scripts', 'debug', toolName);
697
697
  if (fs.existsSync(toolPath)) {
698
698
  const { execSync } = require('child_process');
699
699
  const output = execSync(`node "${toolPath}"`, {
@@ -719,7 +719,7 @@ class I18nManager {
719
719
  console.log('============================================================');
720
720
 
721
721
  try {
722
- const logsDir = path.join(__dirname, '..', 'dev', 'debug', 'logs');
722
+ const logsDir = path.join(__dirname, '..', 'scripts', 'debug', 'logs');
723
723
  if (fs.existsSync(logsDir)) {
724
724
  const files = fs.readdirSync(logsDir)
725
725
  .filter(file => file.endsWith('.log') || file.endsWith('.txt'))
@@ -786,8 +786,8 @@ class I18nManager {
786
786
  const targetDirs = [
787
787
  { path: path.join(process.cwd(), 'i18ntk-reports'), name: 'Reports', type: 'reports' },
788
788
  { path: path.join(process.cwd(), 'reports'), name: 'Legacy Reports', type: 'reports' },
789
- { path: path.join(process.cwd(), 'dev', 'debug', 'logs'), name: 'Debug Logs', type: 'logs' },
790
- { path: path.join(process.cwd(), 'dev', 'debug', 'reports'), name: 'Debug Reports', type: 'reports' },
789
+ { path: path.join(process.cwd(), 'scripts', 'debug', 'logs'), name: 'Debug Logs', type: 'logs' },
790
+ { path: path.join(process.cwd(), 'scripts', 'debug', 'reports'), name: 'Debug Reports', type: 'reports' },
791
791
  { path: path.join(process.cwd(), 'settings', 'backups'), name: 'Backups', type: 'backups' }
792
792
  ];
793
793
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18ntk",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "i18ntk (i18n Toolkit) - A comprehensive, enterprise-grade internationalization (i18n) management toolkit for JavaScript/TypeScript projects with advanced analysis, validation, and automation features",
5
5
  "keywords": [
6
6
  "i18n",
@@ -123,9 +123,9 @@
123
123
  },
124
124
  "preferGlobal": true,
125
125
  "versionInfo": {
126
- "version": "1.4.1",
127
- "releaseDate": "05/08/2025",
128
- "lastUpdated": "04/08/2025",
126
+ "version": "1.4.2",
127
+ "releaseDate": "08/08/2025",
128
+ "lastUpdated": "08/08/2025",
129
129
  "maintainer": "Vladimir Noskov",
130
130
  "changelog": "./CHANGELOG.md",
131
131
  "documentation": "./README.md",
@@ -0,0 +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.4.2 Update
33
+
34
+ **Critical Bug Fix**: These debug tools were moved from `/dev/debug/` to `/scripts/debug/` in v1.4.2 to resolve MODULE_NOT_FOUND errors when using `npx i18ntk`.
@@ -0,0 +1,295 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Complete Console Translations
5
+ * Adds missing translation keys to all ui-locales language files
6
+ * to ensure 100% translation coverage for the i18n-management-toolkit package.
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const ConsoleTranslationsChecker = require('./console-translations');
12
+ const UIi18n = require('../../main/i18ntk-ui');
13
+
14
+ class ConsoleTranslationsCompleter {
15
+ constructor() {
16
+ this.uiLocalesDir = path.join(__dirname, '..', '..', 'ui-locales');
17
+ this.referenceLanguage = 'en';
18
+ this.supportedLanguages = ['de', 'es', 'fr', 'ja', 'ru', 'zh'];
19
+ this.dryRun = process.argv.includes('--dry-run');
20
+ this.results = {
21
+ totalKeysAdded: 0,
22
+ languagesProcessed: 0,
23
+ changes: {}
24
+ };
25
+ }
26
+
27
+ /**
28
+ * Load and parse a JSON translation file
29
+ */
30
+ loadTranslationFile(language) {
31
+ const filePath = path.join(this.uiLocalesDir, `${language}.json`);
32
+
33
+ try {
34
+ if (!fs.existsSync(filePath)) {
35
+ throw new Error(`Translation file not found: ${filePath}`);
36
+ }
37
+
38
+ const content = fs.readFileSync(filePath, 'utf8');
39
+ return JSON.parse(content);
40
+ } catch (error) {
41
+ console.log(`โŒ Error loading ${language}.json: ${error.message}`);
42
+ return null;
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Save translation file with proper formatting
48
+ */
49
+ saveTranslationFile(language, data) {
50
+ const filePath = path.join(this.uiLocalesDir, `${language}.json`);
51
+
52
+ try {
53
+ const content = JSON.stringify(data, null, 2);
54
+
55
+ if (this.dryRun) {
56
+ console.log(` ๐Ÿงช DRY RUN: Would save ${language}.json`);
57
+ return true;
58
+ }
59
+
60
+ fs.writeFileSync(filePath, content, 'utf8');
61
+ return true;
62
+ } catch (error) {
63
+ console.log(`โŒ Error saving ${language}.json: ${error.message}`);
64
+ return false;
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Get nested object value by dot notation path
70
+ */
71
+ getNestedValue(obj, path) {
72
+ return path.split('.').reduce((current, key) => {
73
+ return current && current[key] !== undefined ? current[key] : undefined;
74
+ }, obj);
75
+ }
76
+
77
+ /**
78
+ * Set nested object value by dot notation path
79
+ */
80
+ setNestedValue(obj, path, value) {
81
+ const keys = path.split('.');
82
+ const lastKey = keys.pop();
83
+
84
+ const target = keys.reduce((current, key) => {
85
+ if (!current[key] || typeof current[key] !== 'object') {
86
+ current[key] = {};
87
+ }
88
+ return current[key];
89
+ }, obj);
90
+
91
+ target[lastKey] = value;
92
+ }
93
+
94
+ /**
95
+ * Generate placeholder translation for missing keys
96
+ */
97
+ generatePlaceholderTranslation(key, referenceValue, targetLanguage) {
98
+ // Use consistent placeholder prefix for all languages
99
+ const prefix = '[NOT TRANSLATED]';
100
+
101
+ // For simple strings, add consistent prefix
102
+ if (typeof referenceValue === 'string') {
103
+ // Keep emojis and special characters, but mark as needing translation
104
+ if (referenceValue.length < 50) {
105
+ return `${prefix} ${referenceValue}`;
106
+ } else {
107
+ // For longer strings, just use the prefix
108
+ return `${prefix} ${referenceValue.substring(0, 30)}...`;
109
+ }
110
+ }
111
+
112
+ // For arrays, copy structure but mark items
113
+ if (Array.isArray(referenceValue)) {
114
+ return referenceValue.map(item =>
115
+ typeof item === 'string' ? `${prefix} ${item}` : item
116
+ );
117
+ }
118
+
119
+ // For other types, return as-is
120
+ return referenceValue;
121
+ }
122
+
123
+ /**
124
+ * Complete translations for a specific language
125
+ */
126
+ completeLanguage(language, missingKeys, referenceData) {
127
+ console.log(`๐Ÿ”„ Processing ${language.toUpperCase()}...`);
128
+
129
+ const languageData = this.loadTranslationFile(language);
130
+ if (!languageData) {
131
+ return false;
132
+ }
133
+
134
+ let keysAdded = 0;
135
+ const changes = [];
136
+
137
+ for (const key of missingKeys) {
138
+ const referenceValue = this.getNestedValue(referenceData, key);
139
+ if (referenceValue !== undefined) {
140
+ const placeholderValue = this.generatePlaceholderTranslation(key, referenceValue, language);
141
+ this.setNestedValue(languageData, key, placeholderValue);
142
+ keysAdded++;
143
+ changes.push(key);
144
+ }
145
+ }
146
+
147
+ if (keysAdded > 0) {
148
+ const success = this.saveTranslationFile(language, languageData);
149
+ if (success) {
150
+ console.log(` โœ… Added ${keysAdded} missing keys`);
151
+ this.results.changes[language] = changes;
152
+ this.results.totalKeysAdded += keysAdded;
153
+ this.results.languagesProcessed++;
154
+
155
+ // Show sample of added keys
156
+ const sampleKeys = changes.slice(0, 3);
157
+ console.log(` ๐Ÿ“ Sample: ${sampleKeys.join(', ')}`);
158
+ if (changes.length > 3) {
159
+ console.log(` ๐Ÿ“ ... and ${changes.length - 3} more`);
160
+ }
161
+ } else {
162
+ console.log(` โŒ Failed to save changes`);
163
+ return false;
164
+ }
165
+ } else {
166
+ console.log(` โœ… No missing keys found`);
167
+ }
168
+
169
+ return true;
170
+ }
171
+
172
+ /**
173
+ * Run the completion process
174
+ */
175
+ async run() {
176
+ console.log('๐Ÿ”ง CONSOLE TRANSLATIONS COMPLETION');
177
+ console.log('============================================================');
178
+ console.log(`๐Ÿ“ UI Locales directory: ${this.uiLocalesDir}`);
179
+ console.log(`๐Ÿ”ค Reference language: ${this.referenceLanguage}`);
180
+
181
+ if (this.dryRun) {
182
+ console.log('๐Ÿงช DRY RUN MODE - No files will be modified');
183
+ }
184
+
185
+ console.log('');
186
+
187
+ // First, run analysis to get missing keys
188
+ console.log('๐Ÿ” Analyzing current translation status...');
189
+ const checker = new ConsoleTranslationsChecker();
190
+ const analysisSuccess = await checker.run();
191
+
192
+ if (!analysisSuccess) {
193
+ console.log('โŒ Failed to analyze translations');
194
+ return false;
195
+ }
196
+
197
+ // Load reference data
198
+ const referenceData = this.loadTranslationFile(this.referenceLanguage);
199
+ if (!referenceData) {
200
+ console.log(`โŒ Cannot load reference language: ${this.referenceLanguage}`);
201
+ return false;
202
+ }
203
+
204
+ console.log('');
205
+ console.log('๐Ÿ”„ COMPLETING MISSING TRANSLATIONS');
206
+ console.log('============================================================');
207
+
208
+ // Get missing keys from the analysis
209
+ const missingKeysData = checker.results.missingKeys;
210
+
211
+ // Process each language
212
+ for (const language of this.supportedLanguages) {
213
+ const missingKeys = missingKeysData[language] || [];
214
+
215
+ if (missingKeys.length === 0) {
216
+ console.log(`โœ… ${language.toUpperCase()}: Already complete`);
217
+ continue;
218
+ }
219
+
220
+ console.log(`๐Ÿ“Š ${language.toUpperCase()}: ${missingKeys.length} missing keys`);
221
+ const success = this.completeLanguage(language, missingKeys, referenceData);
222
+
223
+ if (!success) {
224
+ console.log(`โŒ Failed to complete ${language}`);
225
+ return false;
226
+ }
227
+ }
228
+
229
+ // Generate summary
230
+ this.generateSummary();
231
+
232
+ // Run final verification
233
+ if (!this.dryRun && this.results.totalKeysAdded > 0) {
234
+ console.log('');
235
+ console.log('๐Ÿ” VERIFICATION - Running final analysis...');
236
+ console.log('============================================================');
237
+
238
+ const finalChecker = new ConsoleTranslationsChecker();
239
+ await finalChecker.run();
240
+ }
241
+
242
+ return true;
243
+ }
244
+
245
+ /**
246
+ * Generate completion summary
247
+ */
248
+ generateSummary() {
249
+ console.log('');
250
+ console.log('๐Ÿ“Š COMPLETION SUMMARY');
251
+ console.log('============================================================');
252
+ console.log(`โœ… Total keys added: ${this.results.totalKeysAdded}`);
253
+ console.log(`๐ŸŒ Languages processed: ${this.results.languagesProcessed}/${this.supportedLanguages.length}`);
254
+
255
+ if (this.results.totalKeysAdded > 0) {
256
+ console.log('');
257
+ console.log('๐Ÿ“‹ CHANGES BY LANGUAGE:');
258
+ console.log('------------------------------------------------------------');
259
+
260
+ for (const [language, changes] of Object.entries(this.results.changes)) {
261
+ console.log(`๐Ÿ”ค ${language.toUpperCase()}: ${changes.length} keys added`);
262
+ }
263
+ }
264
+
265
+ console.log('');
266
+ console.log('๐Ÿ’ก NEXT STEPS:');
267
+ console.log('------------------------------------------------------------');
268
+
269
+ if (this.dryRun) {
270
+ console.log('๐Ÿ”ง Run without --dry-run to apply changes:');
271
+ console.log(' node complete-console-translations.js');
272
+ } else if (this.results.totalKeysAdded > 0) {
273
+ console.log('๐ŸŒ Translation placeholders have been added!');
274
+ console.log('๐Ÿ“ Next steps:');
275
+ console.log('1. Review and translate the placeholder values');
276
+ console.log('2. Replace [DE], [ES], [FR], [JA], [RU], [ZH] prefixes with actual translations');
277
+ console.log('3. Run console-translations.js to verify 100% completion');
278
+ } else {
279
+ console.log('๐ŸŽ‰ All translations are already complete!');
280
+ }
281
+ }
282
+ }
283
+
284
+ // Run the completer if called directly
285
+ if (require.main === module) {
286
+ const completer = new ConsoleTranslationsCompleter();
287
+ completer.run().then(success => {
288
+ process.exit(success ? 0 : 1);
289
+ }).catch(error => {
290
+ console.error('โŒ Fatal error:', error.message);
291
+ process.exit(1);
292
+ });
293
+ }
294
+
295
+ module.exports = ConsoleTranslationsCompleter;