i18ntk 1.4.0 → 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 +61 -1
- package/README.md +410 -20
- package/locales/de/common.json +17 -20
- package/locales/en/common.json +17 -20
- package/locales/es/common.json +17 -20
- package/locales/fr/common.json +17 -20
- package/locales/ru/common.json +17 -20
- package/main/i18ntk-manage.js +52 -24
- package/package.json +6 -8
- package/{dev → scripts}/debug/README.md +9 -5
- package/{dev → scripts}/debug/debugger.js +84 -4
- package/scripts/prepublish.js +2 -2
- package/scripts/validate-all-translations.js +2 -2
- package/ui-locales/de/debug.json +5 -5
- package/ui-locales/de/init.json +1 -0
- package/ui-locales/de/language.json +11 -2
- package/ui-locales/de/security.json +2 -1
- package/ui-locales/de/sizing.json +1 -0
- package/ui-locales/de/usage.json +1 -0
- package/ui-locales/en/debug.json +5 -5
- package/ui-locales/en/init.json +1 -0
- package/ui-locales/en/language.json +11 -2
- package/ui-locales/en/security.json +2 -1
- package/ui-locales/en/sizing.json +2 -0
- package/ui-locales/en/usage.json +1 -0
- package/ui-locales/es/debug.json +5 -5
- package/ui-locales/es/init.json +1 -0
- package/ui-locales/es/language.json +11 -2
- package/ui-locales/es/security.json +2 -1
- package/ui-locales/es/sizing.json +2 -0
- package/ui-locales/es/usage.json +1 -0
- package/ui-locales/fr/debug.json +5 -5
- package/ui-locales/fr/init.json +1 -0
- package/ui-locales/fr/language.json +11 -2
- package/ui-locales/fr/security.json +2 -1
- package/ui-locales/fr/sizing.json +2 -0
- package/ui-locales/fr/usage.json +1 -0
- package/ui-locales/ja/debug.json +5 -5
- package/ui-locales/ja/init.json +1 -0
- package/ui-locales/ja/language.json +11 -2
- package/ui-locales/ja/security.json +2 -1
- package/ui-locales/ja/sizing.json +3 -0
- package/ui-locales/ja/usage.json +1 -0
- package/ui-locales/pt/debug.json +5 -5
- package/ui-locales/pt/init.json +1 -0
- package/ui-locales/pt/language.json +11 -2
- package/ui-locales/pt/security.json +2 -1
- package/ui-locales/pt/sizing.json +2 -0
- package/ui-locales/pt/usage.json +1 -0
- package/ui-locales/ru/debug.json +5 -5
- package/ui-locales/ru/init.json +1 -0
- package/ui-locales/ru/language.json +11 -2
- package/ui-locales/ru/security.json +2 -1
- package/ui-locales/ru/sizing.json +2 -0
- package/ui-locales/ru/usage.json +1 -0
- package/ui-locales/zh/debug.json +5 -5
- package/ui-locales/zh/init.json +1 -0
- package/ui-locales/zh/language.json +11 -2
- package/ui-locales/zh/security.json +2 -1
- package/ui-locales/zh/sizing.json +2 -0
- package/ui-locales/zh/usage.json +1 -0
- package/utils/test-complete-system.js +1 -1
- package/dev/README.md +0 -37
- package/docs/INSTALLATION.md +0 -98
- package/docs/PIN_PROTECTION_GUIDE.md +0 -265
- package/docs/README.md +0 -111
- package/docs/SCRIPT_DIRECTORY_GUIDE.md +0 -278
- package/docs/TODO_ROADMAP.md +0 -279
- package/docs/TRANSLATION_STATUS.md +0 -67
- package/docs/api/API_REFERENCE.md +0 -258
- package/docs/api/COMPONENTS.md +0 -492
- package/docs/api/CONFIGURATION.md +0 -676
- package/docs/api/NPM_PUBLISHING_GUIDE.md +0 -426
- package/docs/debug/DEBUG_README.md +0 -30
- package/docs/debug/DEBUG_TOOLS.md +0 -152
- package/docs/development/AGENTS.md +0 -349
- package/docs/development/DEVELOPMENT_RULES.md +0 -165
- package/docs/development/DEV_README.md +0 -41
- package/docs/release-notes/RELEASE_NOTES_v1.0.0.md +0 -175
- package/docs/release-notes/RELEASE_NOTES_v1.0.4.md +0 -153
- package/docs/release-notes/RELEASE_NOTES_v1.1.2.md +0 -68
- package/docs/release-notes/RELEASE_NOTES_v1.1.5.md +0 -81
- package/docs/release-notes/RELEASE_NOTES_v1.4.0.md +0 -115
- package/docs/release-notes/RELEASE_NOTES_v1.6.0.md +0 -141
- package/docs/release-notes/RELEASE_NOTES_v1.6.1.md +0 -185
- package/docs/release-notes/RELEASE_NOTES_v1.6.3.md +0 -199
- package/docs/release-notes/v1.3.0.md +0 -162
- package/docs/release-notes/v1.3.1.md +0 -136
- package/docs/reports/ANALYSIS_README.md +0 -17
- package/docs/reports/CONSOLE_MISMATCH_BUG_REPORT_v1.5.0.md +0 -181
- package/docs/reports/SIZING_README.md +0 -18
- package/docs/reports/SUMMARY_README.md +0 -18
- package/docs/reports/TRANSLATION_BUG_REPORT_v1.5.0.md +0 -129
- package/docs/reports/USAGE_README.md +0 -18
- package/docs/reports/VALIDATION_README.md +0 -18
- /package/{dev → scripts}/debug/complete-console-translations.js +0 -0
- /package/{dev → scripts}/debug/console-key-checker.js +0 -0
- /package/{dev → scripts}/debug/console-translations.js +0 -0
- /package/{dev → scripts}/debug/debug-security.js +0 -0
- /package/{dev → scripts}/debug/debug-translation.js +0 -0
- /package/{dev → scripts}/debug/export-missing-keys.js +0 -0
- /package/{dev → scripts}/debug/final-normalize.js +0 -0
- /package/{dev → scripts}/debug/find-extra-keys.js +0 -0
- /package/{dev → scripts}/debug/normalize-locales.js +0 -0
- /package/{dev → scripts}/debug/refactor-locales.js +0 -0
- /package/{dev → scripts}/debug/reorder-locales.js +0 -0
- /package/{dev → scripts}/debug/replace-hardcoded-console.js +0 -0
package/locales/fr/common.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
2
|
+
"common": {
|
|
3
|
+
"welcome": "NOT_TRANSLATED",
|
|
4
|
+
"hello": "NOT_TRANSLATED",
|
|
5
|
+
"goodbye": "NOT_TRANSLATED",
|
|
6
|
+
"yes": "NOT_TRANSLATED",
|
|
7
|
+
"no": "NOT_TRANSLATED",
|
|
8
|
+
"save": "NOT_TRANSLATED",
|
|
9
|
+
"cancel": "NOT_TRANSLATED",
|
|
10
|
+
"delete": "NOT_TRANSLATED",
|
|
11
|
+
"edit": "NOT_TRANSLATED",
|
|
12
|
+
"loading": "NOT_TRANSLATED"
|
|
11
13
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"availableKeysCount": "NOT_TRANSLATED",
|
|
19
|
-
"usedKeysCount": "NOT_TRANSLATED"
|
|
20
|
-
},
|
|
21
|
-
"success": "Succès",
|
|
22
|
-
"error": "Erreur"
|
|
14
|
+
"navigation": {
|
|
15
|
+
"home": "NOT_TRANSLATED",
|
|
16
|
+
"about": "NOT_TRANSLATED",
|
|
17
|
+
"contact": "NOT_TRANSLATED",
|
|
18
|
+
"settings": "NOT_TRANSLATED"
|
|
19
|
+
}
|
|
23
20
|
}
|
package/locales/ru/common.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
2
|
+
"common": {
|
|
3
|
+
"welcome": "NOT_TRANSLATED",
|
|
4
|
+
"hello": "NOT_TRANSLATED",
|
|
5
|
+
"goodbye": "NOT_TRANSLATED",
|
|
6
|
+
"yes": "NOT_TRANSLATED",
|
|
7
|
+
"no": "NOT_TRANSLATED",
|
|
8
|
+
"save": "NOT_TRANSLATED",
|
|
9
|
+
"cancel": "NOT_TRANSLATED",
|
|
10
|
+
"delete": "NOT_TRANSLATED",
|
|
11
|
+
"edit": "NOT_TRANSLATED",
|
|
12
|
+
"loading": "NOT_TRANSLATED"
|
|
11
13
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"availableKeysCount": "NOT_TRANSLATED",
|
|
19
|
-
"usedKeysCount": "NOT_TRANSLATED"
|
|
20
|
-
},
|
|
21
|
-
"success": "Успех",
|
|
22
|
-
"error": "Ошибка"
|
|
14
|
+
"navigation": {
|
|
15
|
+
"home": "NOT_TRANSLATED",
|
|
16
|
+
"about": "NOT_TRANSLATED",
|
|
17
|
+
"contact": "NOT_TRANSLATED",
|
|
18
|
+
"settings": "NOT_TRANSLATED"
|
|
19
|
+
}
|
|
23
20
|
}
|
package/main/i18ntk-manage.js
CHANGED
|
@@ -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('../
|
|
35
|
+
const I18nDebugger = require('../scripts/debug/debugger');
|
|
36
36
|
|
|
37
37
|
// Enhanced default configuration with multiple path detection
|
|
38
38
|
const DEFAULT_CONFIG = {
|
|
@@ -473,6 +473,7 @@ class I18nManager {
|
|
|
473
473
|
console.log(`10. ${this.ui.t('menu.options.settings')}`);
|
|
474
474
|
console.log(`11. ${this.ui.t('menu.options.help')}`);
|
|
475
475
|
console.log(`12. ${this.ui.t('menu.options.debug')}`);
|
|
476
|
+
console.log(`13. ${this.ui.t('menu.options.language')}`);
|
|
476
477
|
console.log(`0. ${this.ui.t('menu.options.exit')}`);
|
|
477
478
|
console.log('\n' + this.ui.t('menu.nonInteractiveModeWarning'));
|
|
478
479
|
console.log(this.ui.t('menu.useDirectExecution'));
|
|
@@ -496,6 +497,7 @@ class I18nManager {
|
|
|
496
497
|
console.log(`10. ${this.ui.t('menu.options.settings')}`);
|
|
497
498
|
console.log(`11. ${this.ui.t('menu.options.help')}`);
|
|
498
499
|
console.log(`12. ${this.ui.t('menu.options.debug')}`);
|
|
500
|
+
console.log(`13. ${this.ui.t('menu.options.language')}`);
|
|
499
501
|
console.log(`0. ${this.ui.t('menu.options.exit')}`);
|
|
500
502
|
|
|
501
503
|
const choice = await this.prompt('\n' + this.ui.t('menu.selectOptionPrompt'));
|
|
@@ -592,6 +594,9 @@ class I18nManager {
|
|
|
592
594
|
case '12':
|
|
593
595
|
await this.showDebugMenu();
|
|
594
596
|
break;
|
|
597
|
+
case '13':
|
|
598
|
+
await this.showLanguageMenu();
|
|
599
|
+
break;
|
|
595
600
|
case '0':
|
|
596
601
|
console.log(this.ui.t('menu.goodbye'));
|
|
597
602
|
this.safeClose();
|
|
@@ -602,6 +607,45 @@ class I18nManager {
|
|
|
602
607
|
}
|
|
603
608
|
}
|
|
604
609
|
|
|
610
|
+
// Language Menu
|
|
611
|
+
async showLanguageMenu() {
|
|
612
|
+
console.log(`\n${this.ui.t('language.title')}`);
|
|
613
|
+
console.log(this.ui.t('language.separator'));
|
|
614
|
+
console.log(this.ui.t('language.current', { language: this.ui.getLanguageDisplayName(this.ui.getCurrentLanguage()) }));
|
|
615
|
+
console.log('\n' + this.ui.t('language.available'));
|
|
616
|
+
|
|
617
|
+
this.ui.availableLanguages.forEach((lang, index) => {
|
|
618
|
+
const displayName = this.ui.getLanguageDisplayName(lang);
|
|
619
|
+
const current = lang === this.ui.getCurrentLanguage() ? ' ✓' : '';
|
|
620
|
+
console.log(this.ui.t('language.languageOption', { index: index + 1, displayName, current }));
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
console.log(`0. ${this.ui.t('language.backToMainMenu')}`);
|
|
624
|
+
|
|
625
|
+
const choice = await this.prompt('\n' + this.ui.t('language.prompt'));
|
|
626
|
+
const choiceNum = parseInt(choice);
|
|
627
|
+
|
|
628
|
+
if (choiceNum === 0) {
|
|
629
|
+
await this.showInteractiveMenu();
|
|
630
|
+
return;
|
|
631
|
+
} else if (choiceNum >= 1 && choiceNum <= this.ui.availableLanguages.length) {
|
|
632
|
+
const selectedLang = this.ui.availableLanguages[choiceNum - 1];
|
|
633
|
+
this.ui.changeLanguage(selectedLang);
|
|
634
|
+
console.log(this.ui.t('language.changed', { language: this.ui.getLanguageDisplayName(selectedLang) }));
|
|
635
|
+
|
|
636
|
+
// Refresh the UI with new language
|
|
637
|
+
this.ui.refreshLanguageFromSettings();
|
|
638
|
+
|
|
639
|
+
// Return to main menu with new language
|
|
640
|
+
await this.prompt('\n' + this.ui.t('language.pressEnterToContinue'));
|
|
641
|
+
await this.showInteractiveMenu();
|
|
642
|
+
} else {
|
|
643
|
+
console.log(this.ui.t('language.invalid'));
|
|
644
|
+
await this.prompt('\n' + this.ui.t('language.pressEnterToContinue'));
|
|
645
|
+
await this.showLanguageMenu();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
605
649
|
// Debug Tools Menu
|
|
606
650
|
async showDebugMenu() {
|
|
607
651
|
// Check for PIN protection
|
|
@@ -623,13 +667,9 @@ class I18nManager {
|
|
|
623
667
|
|
|
624
668
|
console.log(`\n${this.ui.t('debug.title')}`);
|
|
625
669
|
console.log(this.ui.t('debug.separator'));
|
|
626
|
-
console.log(
|
|
627
|
-
console.log(
|
|
628
|
-
console.log(
|
|
629
|
-
console.log(`4. ${this.ui.t('debug.replaceHardcodedConsole')}`);
|
|
630
|
-
console.log(`5. ${this.ui.t('debug.consoleKeyChecker')}`);
|
|
631
|
-
console.log(`6. ${this.ui.t('debug.debugLogs')}`);
|
|
632
|
-
console.log(`0. ${this.ui.t('debug.backToMainMenu')}`);
|
|
670
|
+
console.log(this.ui.t('debug.mainDebuggerSystemDiagnostics'));
|
|
671
|
+
console.log(this.ui.t('debug.debugLogs'));
|
|
672
|
+
console.log(this.ui.t('debug.backToMainMenu'));
|
|
633
673
|
|
|
634
674
|
const choice = await this.prompt('\n' + this.ui.t('debug.selectOption'));
|
|
635
675
|
|
|
@@ -638,18 +678,6 @@ class I18nManager {
|
|
|
638
678
|
await this.runDebugTool('debugger.js', 'Main Debugger');
|
|
639
679
|
break;
|
|
640
680
|
case '2':
|
|
641
|
-
await this.runDebugTool('console-translations.js', 'Console Translations');
|
|
642
|
-
break;
|
|
643
|
-
case '3':
|
|
644
|
-
await this.runDebugTool('export-missing-keys.js', 'Export Missing Keys');
|
|
645
|
-
break;
|
|
646
|
-
case '4':
|
|
647
|
-
await this.runDebugTool('replace-hardcoded-console.js', 'Replace Hardcoded Console');
|
|
648
|
-
break;
|
|
649
|
-
case '5':
|
|
650
|
-
await this.runDebugTool('console-key-checker.js', 'Console Key Checker');
|
|
651
|
-
break;
|
|
652
|
-
case '6':
|
|
653
681
|
await this.viewDebugLogs();
|
|
654
682
|
break;
|
|
655
683
|
case '0':
|
|
@@ -665,7 +693,7 @@ class I18nManager {
|
|
|
665
693
|
async runDebugTool(toolName, displayName) {
|
|
666
694
|
console.log(this.ui.t('debug.runningDebugTool', { displayName }));
|
|
667
695
|
try {
|
|
668
|
-
const toolPath = path.join(__dirname, '..', '
|
|
696
|
+
const toolPath = path.join(__dirname, '..', 'scripts', 'debug', toolName);
|
|
669
697
|
if (fs.existsSync(toolPath)) {
|
|
670
698
|
const { execSync } = require('child_process');
|
|
671
699
|
const output = execSync(`node "${toolPath}"`, {
|
|
@@ -691,7 +719,7 @@ class I18nManager {
|
|
|
691
719
|
console.log('============================================================');
|
|
692
720
|
|
|
693
721
|
try {
|
|
694
|
-
const logsDir = path.join(__dirname, '..', '
|
|
722
|
+
const logsDir = path.join(__dirname, '..', 'scripts', 'debug', 'logs');
|
|
695
723
|
if (fs.existsSync(logsDir)) {
|
|
696
724
|
const files = fs.readdirSync(logsDir)
|
|
697
725
|
.filter(file => file.endsWith('.log') || file.endsWith('.txt'))
|
|
@@ -758,8 +786,8 @@ class I18nManager {
|
|
|
758
786
|
const targetDirs = [
|
|
759
787
|
{ path: path.join(process.cwd(), 'i18ntk-reports'), name: 'Reports', type: 'reports' },
|
|
760
788
|
{ path: path.join(process.cwd(), 'reports'), name: 'Legacy Reports', type: 'reports' },
|
|
761
|
-
{ path: path.join(process.cwd(), '
|
|
762
|
-
{ path: path.join(process.cwd(), '
|
|
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' },
|
|
763
791
|
{ path: path.join(process.cwd(), 'settings', 'backups'), name: 'Backups', type: 'backups' }
|
|
764
792
|
];
|
|
765
793
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18ntk",
|
|
3
|
-
"version": "1.4.
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://github.com/sponsors/vladnoskv"
|
|
38
38
|
},
|
|
39
39
|
"license": "MIT",
|
|
40
|
-
"author": "Vladimir Noskov <
|
|
40
|
+
"author": "Vladimir Noskov <vladno@hotmail.co.uk> (https://github.com/vladnoskv)",
|
|
41
41
|
"type": "commonjs",
|
|
42
42
|
"main": "main/i18ntk-manage.js",
|
|
43
43
|
"bin": {
|
|
@@ -50,8 +50,7 @@
|
|
|
50
50
|
"i18ntk-complete": "main/i18ntk-complete.js",
|
|
51
51
|
"i18ntk-sizing": "main/i18ntk-sizing.js",
|
|
52
52
|
"i18ntk-summary": "main/i18ntk-summary.js",
|
|
53
|
-
"i18ntk-autorun": "main/i18ntk-autorun.js"
|
|
54
|
-
"i18ntk-debug": "dev/debug/debugger.js"
|
|
53
|
+
"i18ntk-autorun": "main/i18ntk-autorun.js"
|
|
55
54
|
},
|
|
56
55
|
"directories": {
|
|
57
56
|
"doc": "docs"
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
"settings/",
|
|
65
64
|
"ui-locales/",
|
|
66
65
|
"locales/",
|
|
67
|
-
"docs/",
|
|
68
66
|
"README.md",
|
|
69
67
|
"CHANGELOG.md",
|
|
70
68
|
"LICENSE"
|
|
@@ -125,9 +123,9 @@
|
|
|
125
123
|
},
|
|
126
124
|
"preferGlobal": true,
|
|
127
125
|
"versionInfo": {
|
|
128
|
-
"version": "1.4.
|
|
129
|
-
"releaseDate": "
|
|
130
|
-
"lastUpdated": "
|
|
126
|
+
"version": "1.4.2",
|
|
127
|
+
"releaseDate": "08/08/2025",
|
|
128
|
+
"lastUpdated": "08/08/2025",
|
|
131
129
|
"maintainer": "Vladimir Noskov",
|
|
132
130
|
"changelog": "./CHANGELOG.md",
|
|
133
131
|
"documentation": "./README.md",
|
|
@@ -13,18 +13,22 @@ This folder contains debugging tools and utilities for the i18nTK project.
|
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
# Run main debugger
|
|
16
|
-
node
|
|
16
|
+
node scripts/debug/debugger.js
|
|
17
17
|
|
|
18
18
|
# Validate configuration
|
|
19
|
-
node
|
|
19
|
+
node scripts/debug/config-validator.js
|
|
20
20
|
|
|
21
21
|
# Debug translations
|
|
22
|
-
node
|
|
22
|
+
node scripts/debug/translation-debugger.js
|
|
23
23
|
|
|
24
24
|
# Profile performance
|
|
25
|
-
node
|
|
25
|
+
node scripts/debug/performance-profiler.js
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Debug Output
|
|
29
29
|
|
|
30
|
-
Debug logs and reports are saved to `
|
|
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`.
|
|
@@ -13,8 +13,16 @@ const SecurityUtils = require('../../utils/security');
|
|
|
13
13
|
class I18nDebugger {
|
|
14
14
|
constructor(projectRoot = null) {
|
|
15
15
|
// Validate and sanitize project root path
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let defaultRoot;
|
|
17
|
+
|
|
18
|
+
if (projectRoot) {
|
|
19
|
+
defaultRoot = projectRoot;
|
|
20
|
+
} else {
|
|
21
|
+
// Find the actual project root by walking up from current directory
|
|
22
|
+
defaultRoot = this.findProjectRoot();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const validatedRoot = SecurityUtils.validatePath(defaultRoot, process.cwd());
|
|
18
26
|
if (!validatedRoot) {
|
|
19
27
|
throw new Error('Invalid project root path provided');
|
|
20
28
|
}
|
|
@@ -38,6 +46,53 @@ class I18nDebugger {
|
|
|
38
46
|
fs.appendFileSync(this.logFile, logMessage + '\n');
|
|
39
47
|
}
|
|
40
48
|
|
|
49
|
+
findProjectRoot() {
|
|
50
|
+
// Start from the current working directory and walk up to find project root
|
|
51
|
+
let currentDir = process.cwd();
|
|
52
|
+
|
|
53
|
+
// First, check if we're running from within node_modules/i18ntk
|
|
54
|
+
const nodeModulesPattern = /[\/\\]node_modules[\/\\]i18ntk/;
|
|
55
|
+
if (nodeModulesPattern.test(currentDir)) {
|
|
56
|
+
// We're running from the i18ntk package, find the actual project root
|
|
57
|
+
let projectDir = currentDir;
|
|
58
|
+
while (projectDir !== path.dirname(projectDir)) {
|
|
59
|
+
if (fs.existsSync(path.join(projectDir, 'package.json')) &&
|
|
60
|
+
!projectDir.includes('node_modules')) {
|
|
61
|
+
return projectDir;
|
|
62
|
+
}
|
|
63
|
+
projectDir = path.dirname(projectDir);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Walk up the directory tree to find package.json
|
|
68
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
69
|
+
const packageJsonPath = path.join(currentDir, 'package.json');
|
|
70
|
+
|
|
71
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
72
|
+
try {
|
|
73
|
+
const packageContent = fs.readFileSync(packageJsonPath, 'utf8');
|
|
74
|
+
const packageData = JSON.parse(packageContent);
|
|
75
|
+
|
|
76
|
+
// Skip if this is the i18ntk package itself
|
|
77
|
+
if (packageData.name === 'i18ntk' && currentDir.includes('node_modules')) {
|
|
78
|
+
currentDir = path.dirname(currentDir);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Found a valid project package.json
|
|
83
|
+
return currentDir;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
// Invalid package.json, continue searching
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
currentDir = path.dirname(currentDir);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Fallback to the original behavior if no project root found
|
|
93
|
+
return path.resolve(__dirname, '../..');
|
|
94
|
+
}
|
|
95
|
+
|
|
41
96
|
addIssue(issue) {
|
|
42
97
|
this.issues.push(issue);
|
|
43
98
|
this.log(`ISSUE: ${issue}`, 'ERROR');
|
|
@@ -287,10 +342,33 @@ class I18nDebugger {
|
|
|
287
342
|
const packageJson = JSON.parse(fs.readFileSync(path.resolve(this.projectRoot, 'package.json'), 'utf8'));
|
|
288
343
|
const dependencies = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
289
344
|
|
|
290
|
-
// Check if node_modules exists
|
|
345
|
+
// Check if node_modules exists in project root
|
|
291
346
|
const nodeModulesPath = path.resolve(this.projectRoot, 'node_modules');
|
|
292
347
|
if (!fs.existsSync(nodeModulesPath)) {
|
|
293
|
-
|
|
348
|
+
// Also check parent directories for node_modules (monorepo support)
|
|
349
|
+
let currentDir = this.projectRoot;
|
|
350
|
+
let foundNodeModules = false;
|
|
351
|
+
|
|
352
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
353
|
+
const parentNodeModules = path.join(currentDir, 'node_modules');
|
|
354
|
+
if (fs.existsSync(parentNodeModules)) {
|
|
355
|
+
this.log(`Found node_modules in: ${parentNodeModules}`);
|
|
356
|
+
foundNodeModules = true;
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
currentDir = path.dirname(currentDir);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (!foundNodeModules) {
|
|
363
|
+
const depCount = Object.keys(dependencies).length;
|
|
364
|
+
if (depCount > 0) {
|
|
365
|
+
this.addWarning(`node_modules directory not found in project or parent directories. Run 'npm install' in ${this.projectRoot}`);
|
|
366
|
+
} else {
|
|
367
|
+
this.log('No dependencies found in package.json');
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
this.log(`Found node_modules in: ${nodeModulesPath}`);
|
|
294
372
|
}
|
|
295
373
|
|
|
296
374
|
this.log(`Found ${Object.keys(dependencies).length} dependencies`);
|
|
@@ -357,6 +435,8 @@ class I18nDebugger {
|
|
|
357
435
|
async run() {
|
|
358
436
|
this.log('Starting i18nTK Debug Analysis...');
|
|
359
437
|
this.log(`Project Root: ${this.projectRoot}`);
|
|
438
|
+
this.log(`Working Directory: ${process.cwd()}`);
|
|
439
|
+
this.log(`Debug Tool Directory: ${__dirname}`);
|
|
360
440
|
|
|
361
441
|
SecurityUtils.logSecurityEvent('Debug analysis started', 'info', { projectRoot: this.projectRoot });
|
|
362
442
|
|
package/scripts/prepublish.js
CHANGED
|
@@ -13,8 +13,8 @@ class PrepublishCleaner {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
this.projectRoot = path.join(__dirname, '..');
|
|
15
15
|
this.directories = [
|
|
16
|
-
'
|
|
17
|
-
'
|
|
16
|
+
'scripts/debug/logs',
|
|
17
|
+
'scripts/debug/reports',
|
|
18
18
|
'settings/backups',
|
|
19
19
|
'i18ntk-reports',
|
|
20
20
|
'reports'
|
|
@@ -69,8 +69,8 @@ class TranslationValidator {
|
|
|
69
69
|
console.log('\n🔧 Validating Debug Tools...');
|
|
70
70
|
|
|
71
71
|
const debugTools = [
|
|
72
|
-
'
|
|
73
|
-
'
|
|
72
|
+
'scripts/debug/debugger.js',
|
|
73
|
+
'scripts/debug/language-debug.js'
|
|
74
74
|
];
|
|
75
75
|
|
|
76
76
|
for (const tool of debugTools) {
|
package/ui-locales/de/debug.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"title": "🔧 Debug-Tools",
|
|
3
3
|
"separator": "============================================================",
|
|
4
4
|
"mainDebuggerSystemDiagnostics": "1. Systemdiagnose",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"debugLogs": "
|
|
5
|
+
"_consoleTranslationsCheck": "// 2. Konsolenübersetzungsprüfung",
|
|
6
|
+
"_exportMissingKeys": "// 3. Fehlende Übersetzungsschlüssel exportieren",
|
|
7
|
+
"_replaceHardcodedConsole": "// 4. Hartcodierte Konsolenzeichenketten ersetzen",
|
|
8
|
+
"_consoleKeyChecker": "// 5. Konsolenschlüsselprüfer",
|
|
9
|
+
"debugLogs": "2. Debug-Protokolle",
|
|
10
10
|
"backToMainMenu": "0. Zurück zum Hauptmenü",
|
|
11
11
|
"selectOption": "Wählen Sie ein Debug-Tool: ",
|
|
12
12
|
"runningDebugTool": "Führe {displayName} aus...",
|
package/ui-locales/de/init.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"autoDetectedI18nDirectory": "📂 Automatisch erkanntes i18n-Verzeichnis: {directory}",
|
|
9
9
|
"initializingProject": "⚙️ Projektkonfiguration wird initialisiert...",
|
|
10
10
|
"languageSelectionTitle": "🌐 Sprachkonfiguration",
|
|
11
|
+
"createdSampleTranslationFile": "✅ Beispieleübersetzungsdatei erstellt: {file}",
|
|
11
12
|
"available": "Verfügbar",
|
|
12
13
|
"defaultLanguages": "📝 Standardsprachen: {languages}",
|
|
13
14
|
"enterLanguageCodes": "🎯 Geben Sie Zielsprachcodes ein (kommagetrennt, z.B. de, es, fr, ru):",
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"title": "🌍 Sprache ändern",
|
|
3
|
+
"separator": "============================================================",
|
|
4
|
+
"current": "Aktuelle Sprache: {language}",
|
|
5
|
+
"available": "Verfügbare Sprachen:",
|
|
6
|
+
"languageOption": "{index}. {displayName}{current}",
|
|
7
|
+
"backToMainMenu": "Zurück zum Hauptmenü",
|
|
8
|
+
"prompt": "Wählen Sie eine Sprache (0-8):",
|
|
9
|
+
"cancelled": "Sprachänderung abgebrochen.",
|
|
10
|
+
"invalid": "Ungültige Auswahl. Bitte versuchen Sie es erneut.",
|
|
11
|
+
"changed": "Sprache geändert zu: {language}",
|
|
12
|
+
"pressEnterToContinue": "Drücken Sie Enter zum Fortfahren..."
|
|
4
13
|
}
|
|
@@ -21,5 +21,6 @@
|
|
|
21
21
|
"unknownCommandArg": "Unbekanntes Befehlsargument",
|
|
22
22
|
"logMessage": "[SICHERHEIT {level}] {timestamp}: {event}",
|
|
23
23
|
"alertMessage": "[SICHERHEITSALARM] {timestamp}: {event}",
|
|
24
|
-
"securityWarning": "[SICHERHEITSWARNUNG] {timestamp}: {event}"
|
|
24
|
+
"securityWarning": "[SICHERHEITSWARNUNG] {timestamp}: {event}",
|
|
25
|
+
"json_parse_error": "Sicherheit: JSON-Parsing-Fehler: {errorMessage}"
|
|
25
26
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"analyzing_file_sizes": "Analysiere Dateigrößen...",
|
|
13
13
|
"analyzing_translation_content": "Analysiere Übersetzungsinhalt...",
|
|
14
14
|
"generating_size_comparisons": "Generiere Größenvergleiche...",
|
|
15
|
+
"problematic_keys": "Problematische Schlüssel:",
|
|
15
16
|
"problematicKeysLabel": "Problematische Schlüssel: {{problematicKeys}}",
|
|
16
17
|
"no_languages_found_for_comparison": "Keine Sprachen für Vergleich gefunden",
|
|
17
18
|
"sizing_analysis_results": "I18n Größenanalyse Ergebnisse",
|
package/ui-locales/de/usage.json
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"detectedI18nDirectory": "Erkanntes I18n-Verzeichnis: {{i18nDir}}",
|
|
21
21
|
"fileInfo": " 📄 {namespace}: {keys} Schlüssel",
|
|
22
22
|
"failedToAnalyzeUsage": "❌ Nutzungsanalyse fehlgeschlagen: {error}",
|
|
23
|
+
"failedToAnalyzeFile": "❌ Dateianalysem fehlgeschlagen: {error}",
|
|
23
24
|
"analyzerInitialized": "Analysator initialisiert",
|
|
24
25
|
"analyzerInitFailed": "Analysator-Initialisierung fehlgeschlagen: {error}",
|
|
25
26
|
"argsParsed": "Argumente geparst",
|
package/ui-locales/en/debug.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"title": "🔧 Debug Tools",
|
|
3
3
|
"separator": "============================================================",
|
|
4
4
|
"mainDebuggerSystemDiagnostics": "1. System Diagnostics",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"debugLogs": "
|
|
5
|
+
"_consoleTranslationsCheck": "// 2. Console Translations Check",
|
|
6
|
+
"_exportMissingKeys": "// 3. Export Missing Translation Keys",
|
|
7
|
+
"_replaceHardcodedConsole": "// 4. Replace Hardcoded Console Strings",
|
|
8
|
+
"_consoleKeyChecker": "// 5. Console Key Checker",
|
|
9
|
+
"debugLogs": "2. Debug Logs",
|
|
10
10
|
"backToMainMenu": "0. Back to Main Menu",
|
|
11
11
|
"selectOption": "Select a debug tool: ",
|
|
12
12
|
"runningDebugTool": "Running {displayName}...",
|
package/ui-locales/en/init.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"useExistingDirectoryPrompt": "Do you want to use the existing directory? (y/n)",
|
|
9
9
|
"autoDetectedI18nDirectory": "📂 Auto-detected i18n directory: {directory}",
|
|
10
10
|
"initializingProject": "⚙️ Initializing project configuration...",
|
|
11
|
+
"createdSampleTranslationFile": "✅ Created sample translation file: {file}",
|
|
11
12
|
"languageSelectionTitle": "🌐 Language Configuration",
|
|
12
13
|
"available": "Available",
|
|
13
14
|
"defaultLanguages": "📝 Default languages: {languages}",
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"title": "🌍 Change Language",
|
|
3
|
+
"separator": "============================================================",
|
|
4
|
+
"current": "Current language: {language}",
|
|
5
|
+
"available": "Available Languages:",
|
|
6
|
+
"languageOption": "{index}. {displayName}{current}",
|
|
7
|
+
"backToMainMenu": "Back to Main Menu",
|
|
8
|
+
"prompt": "Select a language (0-8):",
|
|
9
|
+
"cancelled": "Language change cancelled.",
|
|
10
|
+
"invalid": "Invalid choice. Please try again.",
|
|
11
|
+
"changed": "Language changed to: {language}",
|
|
12
|
+
"pressEnterToContinue": "Press Enter to continue..."
|
|
4
13
|
}
|
|
@@ -21,5 +21,6 @@
|
|
|
21
21
|
"unknownCommandArg": "Unknown command argument",
|
|
22
22
|
"logMessage": "[SECURITY {level}] {timestamp}: {event}",
|
|
23
23
|
"alertMessage": "[SECURITY ALERT] {timestamp}: {event}",
|
|
24
|
-
"securityWarning": "[SECURITY WARNING] {timestamp}: {event}"
|
|
24
|
+
"securityWarning": "[SECURITY WARNING] {timestamp}: {event}",
|
|
25
|
+
"json_parse_error": "Security: JSON parse error: {errorMessage}"
|
|
25
26
|
}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"sourceDirectoryNotFoundError": "Source directory not found: {{sourceDir}}",
|
|
10
10
|
"invalidOutputDirectoryError": "Invalid output directory path: {{outputDir}}",
|
|
11
11
|
"invalidReportFileError": "Invalid report file path",
|
|
12
|
+
"problematic_keys": "Problematic keys: {{problematicKeys}}",
|
|
12
13
|
"problematicKeysLabel": "Problematic keys: {{problematicKeys}}",
|
|
14
|
+
"long_translations": "Long translations: {{longTranslations}}",
|
|
13
15
|
"failedToSaveReportError": "Failed to save report securely",
|
|
14
16
|
"invalidCsvFileError": "Invalid CSV file path",
|
|
15
17
|
"failedToSaveCsvError": "Failed to save CSV report securely",
|
package/ui-locales/en/usage.json
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"detectedI18nDirectory": "Detected i18n directory: {{i18nDir}}",
|
|
21
21
|
"fileInfo": " 📄 {namespace}: {keys} keys",
|
|
22
22
|
"failedToAnalyzeUsage": "❌ Failed to analyze usage: {error}",
|
|
23
|
+
"failedToAnalyzeFile": "❌ Failed to analyze file: {error}",
|
|
23
24
|
"analyzerInitialized": "Analyzer initialized",
|
|
24
25
|
"analyzerInitFailed": "Analyzer initialization failed: {error}",
|
|
25
26
|
"argsParsed": "Arguments parsed",
|
package/ui-locales/es/debug.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"title": "🔧 Herramientas de Depuración",
|
|
3
3
|
"separator": "============================================================",
|
|
4
4
|
"mainDebuggerSystemDiagnostics": "1. Diagnósticos del Sistema",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"debugLogs": "
|
|
5
|
+
"_consoleTranslationsCheck": "// 2. Verificación de Traducciones de Consola",
|
|
6
|
+
"_exportMissingKeys": "// 3. Exportar Claves de Traducción Faltantes",
|
|
7
|
+
"_replaceHardcodedConsole": "// 4. Reemplazar Cadenas de Consola Codificadas",
|
|
8
|
+
"_consoleKeyChecker": "// 5. Verificador de Claves de Consola",
|
|
9
|
+
"debugLogs": "2. Registros de Depuración",
|
|
10
10
|
"backToMainMenu": "0. Volver al Menú Principal",
|
|
11
11
|
"selectOption": "Seleccione una herramienta de depuración: ",
|
|
12
12
|
"runningDebugTool": "Ejecutando {displayName}...",
|
package/ui-locales/es/init.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"autoDetectedI18nDirectory": "📂 Directorio i18n detectado automáticamente: {directory}",
|
|
9
9
|
"initializingProject": "⚙️ Inicializando configuración del proyecto...",
|
|
10
10
|
"languageSelectionTitle": "🌐 Configuración de Idioma",
|
|
11
|
+
"createdSampleTranslationFile": "✅ Archivo de traducción de ejemplo creado: {file}",
|
|
11
12
|
"available": "Disponible",
|
|
12
13
|
"defaultLanguages": "📝 Idiomas predeterminados: {languages}",
|
|
13
14
|
"enterLanguageCodes": "🎯 Ingresa códigos de idioma objetivo (separados por comas, ej. de, es, fr, ru):",
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"title": "🌍 Cambiar Idioma",
|
|
3
|
+
"separator": "============================================================",
|
|
4
|
+
"current": "Idioma actual: {language}",
|
|
5
|
+
"available": "Idiomas disponibles:",
|
|
6
|
+
"languageOption": "{index}. {displayName}{current}",
|
|
7
|
+
"backToMainMenu": "Volver al Menú Principal",
|
|
8
|
+
"prompt": "Seleccione un idioma (0-8):",
|
|
9
|
+
"cancelled": "Cambio de idioma cancelado.",
|
|
10
|
+
"invalid": "Opción inválida. Por favor, inténtelo de nuevo.",
|
|
11
|
+
"changed": "Idioma cambiado a: {language}",
|
|
12
|
+
"pressEnterToContinue": "Presione Enter para continuar..."
|
|
4
13
|
}
|