i18ntk 1.2.2 → 1.3.1
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 +75 -2
- package/LICENSE +3 -1
- package/README.md +48 -47
- package/docs/README.md +42 -19
- package/docs/SCRIPT_DIRECTORY_GUIDE.md +278 -0
- package/docs/release-notes/v1.3.0.md +162 -0
- package/docs/release-notes/v1.3.1.md +136 -0
- package/main/i18ntk-analyze.js +14 -6
- package/main/i18ntk-autorun.js +37 -36
- package/main/i18ntk-complete.js +9 -5
- package/main/i18ntk-init.js +16 -12
- package/main/i18ntk-manage.js +6 -4
- package/main/i18ntk-sizing.js +12 -12
- package/main/i18ntk-summary.js +6 -2
- package/main/i18ntk-usage.js +5 -5
- package/main/i18ntk-validate.js +9 -5
- package/package.json +20 -19
- package/scripts/copy-translations.js +90 -0
- package/settings/i18ntk-config.json +10 -0
- package/settings/settings-cli.js +201 -77
- package/settings/settings-manager.js +19 -0
- package/ui-locales/de/autorun.json +69 -64
- package/ui-locales/de/common.json +14 -1
- package/ui-locales/de/errors.json +11 -1
- package/ui-locales/de/menu.json +10 -1
- package/ui-locales/de/operations.json +11 -0
- package/ui-locales/de/security.json +2 -1
- package/ui-locales/de/settings.json +67 -9
- package/ui-locales/de/sizing.json +14 -1
- package/ui-locales/de/status.json +18 -1
- package/ui-locales/de/test-complete-system.json +13 -1
- package/ui-locales/en/autorun.json +68 -65
- package/ui-locales/en/common.json +15 -1
- package/ui-locales/en/init.json +20 -5
- package/ui-locales/en/menu.json +1 -0
- package/ui-locales/en/operations.json +11 -1
- package/ui-locales/en/settings.json +158 -35
- package/ui-locales/en/validate.json +1 -0
- package/ui-locales/es/autorun.json +68 -65
- package/ui-locales/es/common.json +14 -1
- package/ui-locales/es/errors.json +11 -1
- package/ui-locales/es/menu.json +10 -1
- package/ui-locales/es/operations.json +11 -0
- package/ui-locales/es/security.json +2 -1
- package/ui-locales/es/settings.json +60 -9
- package/ui-locales/es/sizing.json +14 -1
- package/ui-locales/es/status.json +18 -1
- package/ui-locales/es/test-complete-system.json +13 -1
- package/ui-locales/fr/autorun.json +69 -64
- package/ui-locales/fr/common.json +14 -1
- package/ui-locales/fr/errors.json +11 -1
- package/ui-locales/fr/menu.json +10 -1
- package/ui-locales/fr/operations.json +11 -0
- package/ui-locales/fr/security.json +2 -1
- package/ui-locales/fr/settings.json +60 -9
- package/ui-locales/fr/sizing.json +14 -1
- package/ui-locales/fr/status.json +18 -1
- package/ui-locales/fr/test-complete-system.json +13 -1
- package/ui-locales/ja/autorun.json +69 -64
- package/ui-locales/ja/common.json +14 -1
- package/ui-locales/ja/errors.json +11 -1
- package/ui-locales/ja/menu.json +10 -1
- package/ui-locales/ja/operations.json +11 -0
- package/ui-locales/ja/security.json +2 -1
- package/ui-locales/ja/settings.json +60 -9
- package/ui-locales/ja/sizing.json +14 -1
- package/ui-locales/ja/status.json +18 -1
- package/ui-locales/ja/test-complete-system.json +13 -1
- package/ui-locales/pt/analyze.json +2 -1
- package/ui-locales/pt/autorun.json +69 -64
- package/ui-locales/pt/common.json +14 -1
- package/ui-locales/pt/errors.json +11 -1
- package/ui-locales/pt/init.json +5 -1
- package/ui-locales/pt/menu.json +10 -1
- package/ui-locales/pt/operations.json +11 -0
- package/ui-locales/pt/security.json +2 -1
- package/ui-locales/pt/settings.json +60 -9
- package/ui-locales/pt/sizing.json +14 -1
- package/ui-locales/pt/status.json +18 -1
- package/ui-locales/pt/test-complete-system.json +13 -1
- package/ui-locales/ru/autorun.json +69 -64
- package/ui-locales/ru/common.json +14 -1
- package/ui-locales/ru/errors.json +11 -1
- package/ui-locales/ru/menu.json +10 -1
- package/ui-locales/ru/operations.json +11 -0
- package/ui-locales/ru/security.json +2 -1
- package/ui-locales/ru/settings.json +60 -9
- package/ui-locales/ru/sizing.json +14 -1
- package/ui-locales/ru/status.json +18 -1
- package/ui-locales/ru/test-complete-system.json +13 -1
- package/ui-locales/zh/autorun.json +69 -64
- package/ui-locales/zh/common.json +14 -1
- package/ui-locales/zh/errors.json +11 -1
- package/ui-locales/zh/menu.json +10 -1
- package/ui-locales/zh/operations.json +11 -0
- package/ui-locales/zh/security.json +2 -1
- package/ui-locales/zh/settings.json +67 -9
- package/ui-locales/zh/sizing.json +13 -1
- package/ui-locales/zh/status.json +25 -8
- package/ui-locales/zh/test-complete-system.json +13 -1
- package/utils/test-complete-system.js +178 -162
- package/settings/backups/i18ntk-config-backup-2025-08-01T23-38-43-753Z.json +0 -117
- package/ui-locales/de-old.json +0 -705
- package/ui-locales/de.json +0 -15
- package/ui-locales/en-old.json +0 -709
- package/ui-locales/en.json +0 -15
- package/ui-locales/es-old.json +0 -654
- package/ui-locales/es.json +0 -15
- package/ui-locales/fr-old.json +0 -606
- package/ui-locales/fr.json +0 -15
- package/ui-locales/ja-old.json +0 -660
- package/ui-locales/ja.json +0 -15
- package/ui-locales/pt.json +0 -15
- package/ui-locales/ru-old.json +0 -655
- package/ui-locales/ru.json +0 -15
- package/ui-locales/zh-old.json +0 -647
- package/ui-locales/zh.json +0 -15
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# i18n Management Toolkit v1.3.0 Release Notes
|
|
2
|
+
|
|
3
|
+
## 🚀 Release Overview
|
|
4
|
+
|
|
5
|
+
**Version:** 1.3.0
|
|
6
|
+
**Release Date:** August 2, 2025
|
|
7
|
+
**Type:** Major Feature Release
|
|
8
|
+
**Status:** Current Stable
|
|
9
|
+
|
|
10
|
+
This release introduces significant improvements to path resolution and directory configuration, addressing long-standing issues with relative path handling while adding powerful new customization features.
|
|
11
|
+
|
|
12
|
+
## ✨ New Features
|
|
13
|
+
|
|
14
|
+
### 🎯 Per-Script Directory Configuration
|
|
15
|
+
- **Individual Directory Control**: Configure different source directories for each script type (`analyze`, `complete`, `init`, `manage`)
|
|
16
|
+
- **Flexible Structure**: Use different directory layouts for different purposes
|
|
17
|
+
- **CLI Override Support**: Override directories via command-line arguments
|
|
18
|
+
- **Backward Compatibility**: Existing configurations continue to work unchanged
|
|
19
|
+
|
|
20
|
+
### 🔧 Fixed Path Resolution Logic
|
|
21
|
+
- **Correct Relative Path Handling**: Fixed issue where relative paths were resolved from parent directory instead of project root
|
|
22
|
+
- **Consistent Behavior**: All scripts now handle paths consistently
|
|
23
|
+
- **Settings Compliance**: Analyzing logic now correctly follows settings configuration
|
|
24
|
+
- **Cross-Platform Support**: Improved path resolution across Windows, macOS, and Linux
|
|
25
|
+
|
|
26
|
+
### 🌍 Enhanced Internationalization
|
|
27
|
+
- **Continued Language Support**: Maintained full compatibility with existing language configurations
|
|
28
|
+
- **Framework Integration**: Enhanced support for React, Vue, Angular, and Next.js applications
|
|
29
|
+
- **Locale Validation**: Improved locale code validation and error reporting
|
|
30
|
+
|
|
31
|
+
### ⚙️ Configuration Improvements
|
|
32
|
+
- **Custom Directory Overrides**: Override any script directory via CLI arguments
|
|
33
|
+
- **Settings CLI Enhancement**: Improved configuration management interface
|
|
34
|
+
- **Migration Support**: Built-in tools for upgrading from v1.2.x
|
|
35
|
+
- **Validation Tools**: Enhanced configuration validation and error detection
|
|
36
|
+
|
|
37
|
+
## 🐛 Bug Fixes
|
|
38
|
+
|
|
39
|
+
### Path Resolution Issues
|
|
40
|
+
- **Fixed**: Relative paths in `sourceDir` and `outputDir` now resolve correctly from project root
|
|
41
|
+
- **Fixed**: Scripts no longer use incorrect parent directory as base for relative paths
|
|
42
|
+
- **Fixed**: Settings file paths now respect the configured project root
|
|
43
|
+
|
|
44
|
+
### Configuration Issues
|
|
45
|
+
- **Fixed**: Settings loading now correctly prioritizes CLI arguments over configuration files
|
|
46
|
+
- **Fixed**: Directory auto-detection improved for complex project structures
|
|
47
|
+
- **Fixed**: Error messages now provide clearer guidance for configuration issues
|
|
48
|
+
|
|
49
|
+
## 📊 Breaking Changes
|
|
50
|
+
|
|
51
|
+
### ⚠️ Migration Required
|
|
52
|
+
While this release maintains backward compatibility, we **strongly recommend** testing on a development branch before production deployment due to path resolution changes.
|
|
53
|
+
|
|
54
|
+
### No Breaking API Changes
|
|
55
|
+
- All existing CLI commands work identically
|
|
56
|
+
- All existing configuration files are compatible
|
|
57
|
+
- All existing directory structures are supported
|
|
58
|
+
|
|
59
|
+
## 🔄 Migration Guide
|
|
60
|
+
|
|
61
|
+
### Step 1: Backup Your Configuration
|
|
62
|
+
```bash
|
|
63
|
+
# Backup your current settings
|
|
64
|
+
cp .i18ntk-settings.json .i18ntk-settings.json.backup
|
|
65
|
+
cp i18ntk.config.js i18ntk.config.js.backup
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 2: Update to v1.3.0
|
|
69
|
+
```bash
|
|
70
|
+
# Update the package
|
|
71
|
+
npm update i18n-management-toolkit
|
|
72
|
+
|
|
73
|
+
# Or reinstall
|
|
74
|
+
npm install --save-dev i18n-management-toolkit@latest
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Step 3: Test Configuration
|
|
78
|
+
```bash
|
|
79
|
+
# Test your current configuration
|
|
80
|
+
npx i18ntk analyze --dry-run
|
|
81
|
+
npx i18ntk complete --dry-run
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Step 4: Configure Custom Directories (Optional)
|
|
85
|
+
```bash
|
|
86
|
+
# Configure custom directories per script type
|
|
87
|
+
npx i18ntk init --custom-directories
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Step 5: Verify Production Setup
|
|
91
|
+
```bash
|
|
92
|
+
# Run comprehensive validation
|
|
93
|
+
npx i18ntk validate
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 📖 Documentation Updates
|
|
97
|
+
|
|
98
|
+
### New Documentation
|
|
99
|
+
- **[Script Directory Guide](../SCRIPT_DIRECTORY_GUIDE.md)** - Complete guide to custom directory configuration
|
|
100
|
+
- **[Migration Guide](../SCRIPT_DIRECTORY_GUIDE.md#migration-guide)** - Step-by-step migration instructions
|
|
101
|
+
- **[Configuration Examples](../SCRIPT_DIRECTORY_GUIDE.md#usage-examples)** - Real-world configuration examples
|
|
102
|
+
|
|
103
|
+
### Updated Documentation
|
|
104
|
+
- **[API Reference](./api/API_REFERENCE.md)** - Updated with new directory configuration options
|
|
105
|
+
- **[Configuration Guide](./api/CONFIGURATION.md)** - Enhanced with per-script directory examples
|
|
106
|
+
- **[Framework Integration](./frameworks/README.md)** - Updated path resolution examples
|
|
107
|
+
|
|
108
|
+
## 🧪 Testing Recommendations
|
|
109
|
+
|
|
110
|
+
### Before Production Deployment
|
|
111
|
+
1. **Create Development Branch**: Always test on a separate branch first
|
|
112
|
+
2. **Run Dry-Run Commands**: Use `--dry-run` flag to preview changes
|
|
113
|
+
3. **Validate Configuration**: Run `npx i18ntk validate` to check setup
|
|
114
|
+
4. **Test All Scripts**: Verify `analyze`, `complete`, `init`, and `manage` scripts
|
|
115
|
+
5. **Check Path Resolution**: Ensure relative paths work correctly in your environment
|
|
116
|
+
|
|
117
|
+
### Testing Checklist
|
|
118
|
+
- [ ] All scripts run without errors
|
|
119
|
+
- [ ] Relative paths resolve correctly
|
|
120
|
+
- [ ] Custom directory configurations work as expected
|
|
121
|
+
- [ ] Existing translations are not affected
|
|
122
|
+
- [ ] Configuration validation passes
|
|
123
|
+
- [ ] Framework integration tests pass
|
|
124
|
+
|
|
125
|
+
## 🐛 Known Issues
|
|
126
|
+
|
|
127
|
+
### Current Limitations
|
|
128
|
+
- **Windows Path Separators**: Some edge cases with mixed path separators on Windows
|
|
129
|
+
- **Deep Nested Structures**: Very deep directory structures (>10 levels) may have performance impacts
|
|
130
|
+
- **Symbolic Links**: Limited support for symbolic links in directory paths
|
|
131
|
+
|
|
132
|
+
### Future Improvements
|
|
133
|
+
- Enhanced symbolic link support
|
|
134
|
+
- Performance optimizations for large projects
|
|
135
|
+
- Additional framework-specific integrations
|
|
136
|
+
|
|
137
|
+
## 📊 Version Comparison
|
|
138
|
+
|
|
139
|
+
| Feature | v1.2.x | v1.3.0 |
|
|
140
|
+
|---------|---------|---------|
|
|
141
|
+
| Path Resolution | ❌ Incorrect relative paths | ✅ Correct from project root |
|
|
142
|
+
| Per-Script Directories | ❌ Not supported | ✅ Fully configurable |
|
|
143
|
+
| CLI Overrides | ❌ Limited | ✅ All directories supported |
|
|
144
|
+
| Migration Tools | ❌ Manual | ✅ Built-in guides |
|
|
145
|
+
| Framework Support | ✅ Basic | ✅ Enhanced |
|
|
146
|
+
| Backward Compatibility | ✅ Full | ✅ Full |
|
|
147
|
+
|
|
148
|
+
## 🎉 Acknowledgments
|
|
149
|
+
|
|
150
|
+
Special thanks to the community for reporting path resolution issues and providing valuable feedback on directory configuration needs. Your contributions have made this significant improvement possible.
|
|
151
|
+
|
|
152
|
+
## 📞 Support
|
|
153
|
+
|
|
154
|
+
- **[Issues](https://github.com/your-repo/i18n-management-toolkit/issues)** - Report bugs or request features
|
|
155
|
+
- **[Discussions](https://github.com/your-repo/i18n-management-toolkit/discussions)** - Ask questions or share ideas
|
|
156
|
+
- **[Documentation](../README.md)** - Comprehensive guides and examples
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
**Next Release Preview:** v1.4.0 - Enhanced framework integrations and performance optimizations
|
|
161
|
+
|
|
162
|
+
**Upgrade Recommendation:** **HIGH** - All users should upgrade to benefit from path resolution fixes and new configuration features.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Release Notes - i18n Management Toolkit v1.3.1
|
|
2
|
+
|
|
3
|
+
**Release Date:** December 2024
|
|
4
|
+
**Version:** 1.3.1
|
|
5
|
+
**Previous Version:** 1.3.0
|
|
6
|
+
|
|
7
|
+
## 🆕 New Features
|
|
8
|
+
|
|
9
|
+
### Reset to Default Values Option
|
|
10
|
+
- **New Menu Option**: Added `r) Reset to Default Values` to the settings CLI menu
|
|
11
|
+
- **One-Click Reset**: Reset all directory configurations to their system defaults
|
|
12
|
+
- **Confirmation Prompt**: Includes safety confirmation before proceeding with reset
|
|
13
|
+
- **Safe Operation**: Preserves toolkit functionality while clearing custom configurations
|
|
14
|
+
|
|
15
|
+
## 🎯 Use Cases for Reset Functionality
|
|
16
|
+
|
|
17
|
+
The new reset option is particularly useful for:
|
|
18
|
+
|
|
19
|
+
- **Testing Configurations**: Start fresh when testing different directory setups
|
|
20
|
+
- **Migration Scenarios**: Reset configurations when moving between project structures
|
|
21
|
+
- **Troubleshooting**: Clear potentially problematic custom settings
|
|
22
|
+
- **New Projects**: Quick setup for new projects without manual configuration cleanup
|
|
23
|
+
|
|
24
|
+
## 🔧 Additional Improvements
|
|
25
|
+
|
|
26
|
+
### Enhanced Script Output
|
|
27
|
+
- **Source Directory Display**: Added clear display of source directory, source language, and strict mode status at the beginning of analyze and sizing script runs
|
|
28
|
+
- **Absolute Path Display**: Scripts now show resolved absolute paths for better debugging and verification
|
|
29
|
+
- **Configuration Transparency**: Users can immediately see what configuration is being used
|
|
30
|
+
|
|
31
|
+
### Improved Sizing Analysis
|
|
32
|
+
- **Better Recommendations**: Enhanced translation length difference warnings with more actionable guidance
|
|
33
|
+
- **Clear Guidance**: Sizing recommendations now provide specific, helpful advice instead of generic warnings
|
|
34
|
+
- **User-Friendly Output**: Improved formatting and messaging for better user experience
|
|
35
|
+
|
|
36
|
+
## 📋 Menu Enhancement
|
|
37
|
+
|
|
38
|
+
The settings CLI now includes:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Enter new value (or press Enter to keep current):
|
|
42
|
+
1) Analyze Script Directories
|
|
43
|
+
Current: /src/i18n/locales/test/
|
|
44
|
+
2) Complete Setup Directories
|
|
45
|
+
Current: (not set)
|
|
46
|
+
3) Initialize Script Directories
|
|
47
|
+
Current: (not set)
|
|
48
|
+
4) Manage Script Directories
|
|
49
|
+
Current: (not set)
|
|
50
|
+
5) Sizing Script Directories
|
|
51
|
+
Current: (not set)
|
|
52
|
+
6) Summary Report Directories
|
|
53
|
+
Current: (not set)
|
|
54
|
+
7) Usage Report Directories
|
|
55
|
+
Current: (not set)
|
|
56
|
+
8) Validate Script Directories
|
|
57
|
+
Current: (not set)
|
|
58
|
+
|
|
59
|
+
b) Back to main menu
|
|
60
|
+
r) Reset to Default Values
|
|
61
|
+
|
|
62
|
+
Select setting to edit (or b for back, r for reset):
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Enhanced Default Value Handling
|
|
66
|
+
|
|
67
|
+
**Improved UX**: Instead of leaving fields empty (which isn't possible after changes), users can now:
|
|
68
|
+
|
|
69
|
+
- **Type "default"**: Restore individual directory settings to system defaults
|
|
70
|
+
- **User-specific defaults**: Defaults adapt to your project directory structure
|
|
71
|
+
- **Granular control**: Reset individual settings without affecting others
|
|
72
|
+
- **Clear guidance**: Explicit "default" keyword instead of ambiguous empty inputs
|
|
73
|
+
|
|
74
|
+
This enhancement provides:
|
|
75
|
+
- **Better user experience**: Clear, unambiguous way to restore defaults
|
|
76
|
+
- **Flexibility**: Mix custom paths with default values as needed
|
|
77
|
+
- **Project-specific**: Defaults respect your actual project structure
|
|
78
|
+
|
|
79
|
+
## 🔧 Technical Details
|
|
80
|
+
|
|
81
|
+
### Reset Behavior
|
|
82
|
+
- **Scope**: Resets all 8 script directory configurations
|
|
83
|
+
- **Defaults**: Restores to system default directory paths
|
|
84
|
+
- **Safety**: Requires explicit user confirmation
|
|
85
|
+
- **Logging**: Logs reset operation for audit purposes
|
|
86
|
+
|
|
87
|
+
### Compatibility
|
|
88
|
+
- **Backward Compatible**: All v1.3.0 features remain unchanged
|
|
89
|
+
- **No Breaking Changes**: Existing configurations are preserved
|
|
90
|
+
- **Safe Upgrade**: Users can upgrade without configuration loss
|
|
91
|
+
|
|
92
|
+
## 📚 Documentation Updates
|
|
93
|
+
|
|
94
|
+
- Updated [Script Directory Guide](../SCRIPT_DIRECTORY_GUIDE.md) with reset functionality
|
|
95
|
+
- Added reset option examples and use cases
|
|
96
|
+
- Updated version references across all documentation
|
|
97
|
+
- Added troubleshooting section for reset scenarios
|
|
98
|
+
|
|
99
|
+
## 🧪 Testing Recommendations
|
|
100
|
+
|
|
101
|
+
Before using in production:
|
|
102
|
+
|
|
103
|
+
1. **Test Reset Function**: Verify reset works correctly with custom configurations
|
|
104
|
+
2. **Backup Configurations**: Consider backing up current settings before reset
|
|
105
|
+
3. **Verify Defaults**: Ensure default directory paths are appropriate for your environment
|
|
106
|
+
4. **Integration Testing**: Test with existing project workflows
|
|
107
|
+
|
|
108
|
+
## 🔄 Migration from v1.3.0
|
|
109
|
+
|
|
110
|
+
- **No Migration Required**: v1.3.1 is a minor enhancement
|
|
111
|
+
- **Configuration Preserved**: All existing settings remain intact
|
|
112
|
+
- **New Feature Only**: Reset functionality is additive, not replacement
|
|
113
|
+
|
|
114
|
+
## 📊 Version History
|
|
115
|
+
|
|
116
|
+
- **v1.3.1**: Reset to default values option (current)
|
|
117
|
+
- **v1.3.0**: Per-script directory configuration, path resolution fixes
|
|
118
|
+
- **v1.2.x**: Previous stable releases with basic directory support
|
|
119
|
+
|
|
120
|
+
## 🚀 Getting Started
|
|
121
|
+
|
|
122
|
+
To use the new reset functionality:
|
|
123
|
+
|
|
124
|
+
1. Run the settings CLI: `npm run i18ntk:settings`
|
|
125
|
+
2. Navigate to directory configuration
|
|
126
|
+
3. Select `r) Reset to Default Values`
|
|
127
|
+
4. Confirm the reset operation
|
|
128
|
+
5. Verify restored default paths
|
|
129
|
+
|
|
130
|
+
## ❓ Support
|
|
131
|
+
|
|
132
|
+
For questions about the reset functionality or any issues:
|
|
133
|
+
|
|
134
|
+
- Check the [Script Directory Guide](../SCRIPT_DIRECTORY_GUIDE.md)
|
|
135
|
+
- Review [troubleshooting section](../SCRIPT_DIRECTORY_GUIDE.md#troubleshooting)
|
|
136
|
+
- Open an issue on GitHub for technical problems
|
package/main/i18ntk-analyze.js
CHANGED
|
@@ -16,18 +16,23 @@ const fs = require('fs');
|
|
|
16
16
|
const path = require('path');
|
|
17
17
|
const readline = require('readline');
|
|
18
18
|
const { loadTranslations, t } = require('../utils/i18n-helper');
|
|
19
|
+
const PROJECT_ROOT = process.cwd();
|
|
19
20
|
const settingsManager = require('../settings/settings-manager');
|
|
20
21
|
const SecurityUtils = require('../utils/security');
|
|
21
22
|
|
|
22
23
|
// Get configuration from settings manager
|
|
23
24
|
function getConfig() {
|
|
24
25
|
const settings = settingsManager.getSettings();
|
|
26
|
+
|
|
27
|
+
// Check for per-script directory override, fallback to global sourceDir
|
|
28
|
+
const sourceDir = settings.scriptDirectories?.analyze || settings.sourceDir || './locales';
|
|
29
|
+
|
|
25
30
|
return {
|
|
26
|
-
sourceDir:
|
|
27
|
-
sourceLanguage: settings.
|
|
28
|
-
notTranslatedMarker: settings.processing?.notTranslatedMarker || 'NOT_TRANSLATED',
|
|
29
|
-
outputDir: settings.
|
|
30
|
-
excludeFiles: settings.processing?.excludeFiles || ['.DS_Store', 'Thumbs.db'],
|
|
31
|
+
sourceDir: sourceDir,
|
|
32
|
+
sourceLanguage: settings.sourceLanguage || 'en',
|
|
33
|
+
notTranslatedMarker: settings.notTranslatedMarker || settings.processing?.notTranslatedMarker || 'NOT_TRANSLATED',
|
|
34
|
+
outputDir: settings.outputDir || './i18ntk-reports',
|
|
35
|
+
excludeFiles: settings.excludeFiles || settings.processing?.excludeFiles || ['.DS_Store', 'Thumbs.db'],
|
|
31
36
|
uiLanguage: settings.language || 'en'
|
|
32
37
|
};
|
|
33
38
|
}
|
|
@@ -482,6 +487,9 @@ class I18nAnalyzer {
|
|
|
482
487
|
const results = []; // Add this line to declare the results array
|
|
483
488
|
|
|
484
489
|
console.log(this.t('analyze.starting') || '🔍 Starting translation analysis...');
|
|
490
|
+
console.log(`📁 Source directory: ${path.resolve(this.sourceDir)}`);
|
|
491
|
+
console.log(`🌍 Source language: ${this.config.sourceLanguage}`);
|
|
492
|
+
console.log(`⚙️ Strict mode: ${this.config.processing?.strictMode || this.config.strictMode ? 'ON' : 'OFF'}`);
|
|
485
493
|
|
|
486
494
|
// Ensure output directory exists
|
|
487
495
|
if (!fs.existsSync(this.outputDir)) {
|
|
@@ -572,7 +580,7 @@ class I18nAnalyzer {
|
|
|
572
580
|
// Update config if source directory is provided
|
|
573
581
|
if (args.sourceDir) {
|
|
574
582
|
this.config.sourceDir = args.sourceDir;
|
|
575
|
-
this.sourceDir = path.resolve(this.config.sourceDir);
|
|
583
|
+
this.sourceDir = path.resolve(PROJECT_ROOT, this.config.sourceDir);
|
|
576
584
|
this.sourceLanguageDir = path.join(this.sourceDir, this.config.sourceLanguage);
|
|
577
585
|
}
|
|
578
586
|
|
package/main/i18ntk-autorun.js
CHANGED
|
@@ -53,9 +53,10 @@ class AutoRunner {
|
|
|
53
53
|
const filePath = path.join(localesDir, lang, 'autorun.json');
|
|
54
54
|
if (fs.existsSync(filePath)) {
|
|
55
55
|
try {
|
|
56
|
-
translations[lang] =
|
|
56
|
+
translations[lang] = translations[lang] || {};
|
|
57
|
+
translations[lang].autorun = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
57
58
|
} catch (error) {
|
|
58
|
-
console.warn(
|
|
59
|
+
console.warn(this.t('translationLoadWarning', lang).replace('{lang}', lang));
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
});
|
|
@@ -69,7 +70,7 @@ class AutoRunner {
|
|
|
69
70
|
try {
|
|
70
71
|
return JSON.parse(fs.readFileSync(this.CONFIG_FILE, 'utf8'));
|
|
71
72
|
} catch (error) {
|
|
72
|
-
console.error(
|
|
73
|
+
console.error(this.t('configReadError', this.getSystemLanguage()).replace('{file}', this.CONFIG_FILE), error.message);
|
|
73
74
|
return this.DEFAULT_CONFIG;
|
|
74
75
|
}
|
|
75
76
|
}
|
|
@@ -81,16 +82,16 @@ class AutoRunner {
|
|
|
81
82
|
return envLang.substring(0, 2).toLowerCase();
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
t(key, lang = 'en') {
|
|
85
86
|
const translations = this.loadTranslations();
|
|
86
87
|
|
|
87
|
-
if (translations[lang] && translations[lang][key]) {
|
|
88
|
-
return translations[lang][key];
|
|
88
|
+
if (translations[lang] && translations[lang].autorun && translations[lang].autorun[key]) {
|
|
89
|
+
return translations[lang].autorun[key];
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
// Fallback to English
|
|
92
|
-
if (translations['en'] && translations['en'][key]) {
|
|
93
|
-
return translations['en'][key];
|
|
93
|
+
if (translations['en'] && translations['en'].autorun && translations['en'].autorun[key]) {
|
|
94
|
+
return translations['en'].autorun[key];
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
// Return the key as fallback
|
|
@@ -99,24 +100,24 @@ class AutoRunner {
|
|
|
99
100
|
|
|
100
101
|
displayHelp() {
|
|
101
102
|
const lang = this.getSystemLanguage();
|
|
102
|
-
console.log(`\n${this.
|
|
103
|
-
console.log('
|
|
104
|
-
console.log(`\n${this.
|
|
105
|
-
console.log(` ${this.
|
|
106
|
-
console.log(` ${this.
|
|
107
|
-
console.log(` ${this.
|
|
108
|
-
console.log(` ${this.
|
|
109
|
-
console.log(`\n${this.
|
|
110
|
-
console.log(` ${this.
|
|
111
|
-
console.log(` ${this.
|
|
112
|
-
console.log(` ${this.
|
|
103
|
+
console.log(`\n${this.t('autoRunScriptTitle', lang)}`);
|
|
104
|
+
console.log(this.t('separator', lang));
|
|
105
|
+
console.log(`\n${this.t('usageTitle', lang)}:`);
|
|
106
|
+
console.log(` ${this.t('runAllSteps')}`);
|
|
107
|
+
console.log(` ${this.t('configureSettingsFirst')}`);
|
|
108
|
+
console.log(` ${this.t('runSpecificSteps')}`);
|
|
109
|
+
console.log(` ${this.t('showHelp')}`);
|
|
110
|
+
console.log(`\n${this.t('examplesTitle', lang)}:`);
|
|
111
|
+
console.log(` ${this.t('configExample')}`);
|
|
112
|
+
console.log(` ${this.t('stepsExample1')}`);
|
|
113
|
+
console.log(` ${this.t('stepsExample2')}`);
|
|
113
114
|
console.log();
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
displayConfig() {
|
|
117
118
|
const lang = this.getSystemLanguage();
|
|
118
|
-
console.log(`\n${this.
|
|
119
|
-
console.log('
|
|
119
|
+
console.log(`\n${this.t('customSettingsConfiguration', lang)}`);
|
|
120
|
+
console.log(this.t('separator', lang));
|
|
120
121
|
|
|
121
122
|
const config = this.loadConfig();
|
|
122
123
|
console.log(JSON.stringify(config, null, 2));
|
|
@@ -128,22 +129,22 @@ class AutoRunner {
|
|
|
128
129
|
const scriptPath = path.join(__dirname, step.script);
|
|
129
130
|
|
|
130
131
|
if (!fs.existsSync(scriptPath)) {
|
|
131
|
-
console.error(`${this.
|
|
132
|
-
console.error(`${this.
|
|
132
|
+
console.error(`${this.t('stepFailed', lang)}: ${step.name}`);
|
|
133
|
+
console.error(`${this.t('errorLabel', lang)}: ${this.t('missingRequiredFile', lang).replace('{file}', step.script)}`);
|
|
133
134
|
return false;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
console.log(`\n[${stepNumber}/${totalSteps}] ${this.
|
|
137
|
-
console.log(`${this.
|
|
138
|
-
console.log('
|
|
137
|
+
console.log(`\n[${stepNumber}/${totalSteps}] ${this.t('runningStep', lang).replace('{stepName}', step.name)}`);
|
|
138
|
+
console.log(`${this.t('commandLabel', lang).replace('{command}', step.description)}`);
|
|
139
|
+
console.log(this.t('separator', lang));
|
|
139
140
|
|
|
140
141
|
try {
|
|
141
142
|
execSync(`node "${scriptPath}"`, { stdio: 'inherit' });
|
|
142
|
-
console.log(`✅ ${this.
|
|
143
|
+
console.log(`✅ ${this.t('stepCompleted', lang).replace('{stepName}', step.name)}`);
|
|
143
144
|
return true;
|
|
144
145
|
} catch (error) {
|
|
145
|
-
console.error(`❌ ${this.
|
|
146
|
-
console.error(`${this.
|
|
146
|
+
console.error(`❌ ${this.t('stepFailed', lang).replace('{stepName}', step.name)}`);
|
|
147
|
+
console.error(`${this.t('errorLabel', lang)}:`, error.message);
|
|
147
148
|
return false;
|
|
148
149
|
}
|
|
149
150
|
}
|
|
@@ -153,9 +154,9 @@ class AutoRunner {
|
|
|
153
154
|
const config = this.loadConfig();
|
|
154
155
|
|
|
155
156
|
if (!quiet) {
|
|
156
|
-
console.log(`\n
|
|
157
|
-
|
|
158
|
-
console.log(`${this.
|
|
157
|
+
console.log(`\n${this.t('startingAutoRunWorkflow', lang)}`);
|
|
158
|
+
console.log(this.t('separator', lang));
|
|
159
|
+
console.log(`${this.t('workflowIncludesSteps', lang).replace('{count}', config.steps.length)}`);
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
let successCount = 0;
|
|
@@ -167,16 +168,16 @@ class AutoRunner {
|
|
|
167
168
|
successCount++;
|
|
168
169
|
} else {
|
|
169
170
|
if (!quiet) {
|
|
170
|
-
console.error(`\n
|
|
171
|
+
console.error(`\n${this.t('workflowStopped', lang)}`);
|
|
171
172
|
}
|
|
172
173
|
process.exit(1);
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
if (!quiet) {
|
|
177
|
-
console.log(`\n
|
|
178
|
-
console.log(`${this.
|
|
179
|
-
console.log(`${this.
|
|
178
|
+
console.log(`\n${this.t('workflowCompleted', lang)}`);
|
|
179
|
+
console.log(`${this.t('successfulSteps', lang).replace('{count}', successCount)}`);
|
|
180
|
+
console.log(`${this.t('failedSteps', lang).replace('{count}', config.steps.length - successCount)}`);
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
}
|
package/main/i18ntk-complete.js
CHANGED
|
@@ -21,11 +21,15 @@ const settingsManager = require('../settings/settings-manager');
|
|
|
21
21
|
async function getConfig() {
|
|
22
22
|
try {
|
|
23
23
|
const settings = await settingsManager.getSettings();
|
|
24
|
+
|
|
25
|
+
// Check for per-script directory override, fallback to global sourceDir
|
|
26
|
+
const sourceDir = settings.scriptDirectories?.complete || settings.sourceDir || './locales';
|
|
27
|
+
|
|
24
28
|
const config = {
|
|
25
|
-
sourceDir:
|
|
26
|
-
sourceLanguage: settings.
|
|
27
|
-
notTranslatedMarker: settings.
|
|
28
|
-
excludeFiles: settings.processing?.excludeFiles || ['.DS_Store', 'Thumbs.db']
|
|
29
|
+
sourceDir: sourceDir,
|
|
30
|
+
sourceLanguage: settings.sourceLanguage || 'en',
|
|
31
|
+
notTranslatedMarker: settings.notTranslatedMarker || settings.processing?.notTranslatedMarker || 'NOT_TRANSLATED',
|
|
32
|
+
excludeFiles: settings.excludeFiles || settings.processing?.excludeFiles || ['.DS_Store', 'Thumbs.db']
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
// Basic validation for required fields
|
|
@@ -285,7 +289,7 @@ class I18nCompletionTool {
|
|
|
285
289
|
|
|
286
290
|
// Get missing keys from usage analysis
|
|
287
291
|
getMissingKeysFromUsage() {
|
|
288
|
-
const usageReportPath = path.join(process.cwd(), '
|
|
292
|
+
const usageReportPath = path.join(process.cwd(), 'reports', 'usage-analysis.txt');
|
|
289
293
|
|
|
290
294
|
// Delete old report to ensure fresh data
|
|
291
295
|
if (fs.existsSync(usageReportPath)) {
|
package/main/i18ntk-init.js
CHANGED
|
@@ -23,12 +23,16 @@ const UIi18n = require('./i18ntk-ui');
|
|
|
23
23
|
// Get configuration from settings manager
|
|
24
24
|
function getConfig() {
|
|
25
25
|
const settings = settingsManager.getSettings();
|
|
26
|
+
|
|
27
|
+
// Check for per-script directory override, fallback to global sourceDir
|
|
28
|
+
const sourceDir = settings.scriptDirectories?.init || settings.sourceDir || './locales';
|
|
29
|
+
|
|
26
30
|
return {
|
|
27
|
-
sourceDir:
|
|
28
|
-
sourceLanguage: settings.
|
|
29
|
-
defaultLanguages: settings.processing?.defaultLanguages || ['de', 'es', 'fr', 'ru'],
|
|
30
|
-
notTranslatedMarker: settings.processing?.notTranslatedMarker || 'NOT_TRANSLATED',
|
|
31
|
-
excludeFiles: settings.processing?.excludeFiles || ['.DS_Store', 'Thumbs.db'],
|
|
31
|
+
sourceDir: sourceDir,
|
|
32
|
+
sourceLanguage: settings.sourceLanguage || 'en',
|
|
33
|
+
defaultLanguages: settings.defaultLanguages || settings.processing?.defaultLanguages || ['de', 'es', 'fr', 'ru'],
|
|
34
|
+
notTranslatedMarker: settings.notTranslatedMarker || settings.processing?.notTranslatedMarker || 'NOT_TRANSLATED',
|
|
35
|
+
excludeFiles: settings.excludeFiles || settings.processing?.excludeFiles || ['.DS_Store', 'Thumbs.db'],
|
|
32
36
|
uiLanguage: settings.language || 'en'
|
|
33
37
|
};
|
|
34
38
|
}
|
|
@@ -205,7 +209,7 @@ class I18nInitializer {
|
|
|
205
209
|
|
|
206
210
|
if (existingLocations.length > 0) {
|
|
207
211
|
console.log('\n' + this.ui.t('init.existingDirectoriesFound'));
|
|
208
|
-
console.log('
|
|
212
|
+
console.log(this.ui.t('common.separator'));
|
|
209
213
|
|
|
210
214
|
existingLocations.forEach((location, index) => {
|
|
211
215
|
console.log(` ${index + 1}. ${location}`);
|
|
@@ -572,7 +576,7 @@ class I18nInitializer {
|
|
|
572
576
|
const question = (query) => new Promise(resolve => rl.question(query, resolve));
|
|
573
577
|
|
|
574
578
|
console.log('\n' + this.ui.t('init.languageSelectionTitle'));
|
|
575
|
-
console.log('
|
|
579
|
+
console.log(this.ui.t('common.separator'));
|
|
576
580
|
console.log(this.ui.t('language.available'));
|
|
577
581
|
|
|
578
582
|
Object.entries(LANGUAGE_CONFIG).forEach(([code, config], index) => {
|
|
@@ -607,7 +611,7 @@ class I18nInitializer {
|
|
|
607
611
|
async init() {
|
|
608
612
|
try {
|
|
609
613
|
console.log(this.ui.t('init.initializationTitle'));
|
|
610
|
-
console.log('
|
|
614
|
+
console.log(this.ui.t('common.separator'));
|
|
611
615
|
|
|
612
616
|
// Parse command line arguments
|
|
613
617
|
const args = this.parseArgs();
|
|
@@ -638,7 +642,7 @@ class I18nInitializer {
|
|
|
638
642
|
await this.initialize(hasI18n, args);
|
|
639
643
|
|
|
640
644
|
} catch (error) {
|
|
641
|
-
console.error('
|
|
645
|
+
console.error(this.ui.t('init.errors.initializationFailed', { error: error.message }));
|
|
642
646
|
throw error;
|
|
643
647
|
} finally {
|
|
644
648
|
if (this.shouldCloseRL && this.rl) {
|
|
@@ -751,7 +755,7 @@ class I18nInitializer {
|
|
|
751
755
|
// Summary report
|
|
752
756
|
console.log('\n' + '=' .repeat(50));
|
|
753
757
|
console.log(this.ui.t('init.initializationSummaryTitle'));
|
|
754
|
-
console.log('
|
|
758
|
+
console.log(this.ui.t('common.separator'));
|
|
755
759
|
|
|
756
760
|
Object.entries(results).forEach(([lang, data]) => {
|
|
757
761
|
const langName = LANGUAGE_CONFIG[lang]?.name || 'Unknown';
|
|
@@ -782,8 +786,8 @@ module.exports = I18nInitializer;
|
|
|
782
786
|
if (require.main === module) {
|
|
783
787
|
const initializer = new I18nInitializer();
|
|
784
788
|
initializer.init().catch(error => {
|
|
785
|
-
console.error('
|
|
786
|
-
console.error('
|
|
789
|
+
console.error(this.ui.t('common.initializationFailed', { error: error.message }));
|
|
790
|
+
console.error(this.ui.t('common.stackTrace', { stack: error.stack }));
|
|
787
791
|
process.exit(1);
|
|
788
792
|
});
|
|
789
793
|
}
|
package/main/i18ntk-manage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* I18N MANAGEMENT TOOLKIT - MAIN MANAGER
|
|
4
4
|
*
|
|
@@ -100,9 +100,11 @@ class I18nManager {
|
|
|
100
100
|
detectI18nDirectory() {
|
|
101
101
|
const settings = settingsManager.getSettings();
|
|
102
102
|
|
|
103
|
-
// Use
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
// Use per-script directory configuration if available, fallback to global sourceDir
|
|
104
|
+
const sourceDir = settings.scriptDirectories?.manage || settings.sourceDir;
|
|
105
|
+
|
|
106
|
+
if (sourceDir) {
|
|
107
|
+
this.config.sourceDir = sourceDir;
|
|
106
108
|
return;
|
|
107
109
|
}
|
|
108
110
|
|