i18ntk 1.6.0 → 1.6.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/main/i18ntk-doctor.js +1 -1
- package/main/i18ntk-init.js +1 -1
- package/package.json +6 -17
- package/utils/i18n-helper.js +30 -1
package/main/i18ntk-doctor.js
CHANGED
package/main/i18ntk-init.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18ntk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
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",
|
|
@@ -49,16 +49,15 @@
|
|
|
49
49
|
"main": "main/i18ntk-manage.js",
|
|
50
50
|
"bin": {
|
|
51
51
|
"i18ntk": "main/i18ntk-manage.js",
|
|
52
|
-
"i18ntk-manage": "main/i18ntk-manage.js",
|
|
53
52
|
"i18ntk-init": "main/i18ntk-init.js",
|
|
54
53
|
"i18ntk-analyze": "main/i18ntk-analyze.js",
|
|
55
54
|
"i18ntk-validate": "main/i18ntk-validate.js",
|
|
56
55
|
"i18ntk-usage": "main/i18ntk-usage.js",
|
|
57
56
|
"i18ntk-complete": "main/i18ntk-complete.js",
|
|
58
57
|
"i18ntk-sizing": "main/i18ntk-sizing.js",
|
|
58
|
+
"i18ntk-autorun": "main/i18ntk-autorun.js",
|
|
59
59
|
"i18ntk-summary": "main/i18ntk-summary.js",
|
|
60
|
-
"i18ntk-
|
|
61
|
-
"i18ntk-autorun": "main/i18ntk-autorun.js"
|
|
60
|
+
"i18ntk-doctor": "main/i18ntk-doctor.js"
|
|
62
61
|
},
|
|
63
62
|
"directories": {
|
|
64
63
|
"doc": "docs"
|
|
@@ -78,16 +77,6 @@
|
|
|
78
77
|
],
|
|
79
78
|
"scripts": {
|
|
80
79
|
"start": "node main/i18ntk-manage.js",
|
|
81
|
-
"i18ntk": "node main/i18ntk-manage.js",
|
|
82
|
-
"i18ntk:init": "node main/i18ntk-init.js --yes",
|
|
83
|
-
"i18ntk:analyze": "node main/i18ntk-analyze.js",
|
|
84
|
-
"i18ntk:validate": "node main/i18ntk-validate.js",
|
|
85
|
-
"i18ntk:usage": "node main/i18ntk-usage.js",
|
|
86
|
-
"i18ntk:complete": "node main/i18ntk-complete.js",
|
|
87
|
-
"i18ntk:sizing": "node main/i18ntk-sizing.js",
|
|
88
|
-
"i18ntk:sizing:detailed": "node main/i18ntk-sizing.js --detailed",
|
|
89
|
-
"i18ntk:debug": "node main/i18ntk-manage.js --command=debug",
|
|
90
|
-
"i18ntk:settings": "node settings/settings-cli.js",
|
|
91
80
|
"settings": "node settings/settings-cli.js",
|
|
92
81
|
"i18ntk:doctor": "node main/i18ntk-doctor.js",
|
|
93
82
|
"i18ntk:summary": "node main/i18ntk-summary.js",
|
|
@@ -122,8 +111,8 @@
|
|
|
122
111
|
"security:audit": "npm audit --audit-level=moderate",
|
|
123
112
|
"security:fix": "npm audit fix",
|
|
124
113
|
"security:check": "node utils/security-check.js",
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
"security:config": "node utils/security-config.js",
|
|
115
|
+
"languages:select": "node settings/settings-cli.js",
|
|
127
116
|
"languages:list": "node settings/settings-cli.js --list-languages",
|
|
128
117
|
"languages:status": "node settings/settings-cli.js --language-status",
|
|
129
118
|
"languages:restore": "echo 'Language restoration - use settings CLI for manual configuration'"
|
|
@@ -137,7 +126,7 @@
|
|
|
137
126
|
},
|
|
138
127
|
"preferGlobal": true,
|
|
139
128
|
"versionInfo": {
|
|
140
|
-
"version": "1.6.
|
|
129
|
+
"version": "1.6.1",
|
|
141
130
|
"releaseDate": "08/08/2025",
|
|
142
131
|
"lastUpdated": "08/08/2025",
|
|
143
132
|
"maintainer": "Vladimir Noskov",
|
package/utils/i18n-helper.js
CHANGED
|
@@ -33,7 +33,20 @@ function loadTranslations(language, baseDir) {
|
|
|
33
33
|
currentLanguage = language;
|
|
34
34
|
|
|
35
35
|
// Ensure we always have a valid string path
|
|
36
|
+
// First, try to use the package's ui-locales directory (works for both development and npm install)
|
|
36
37
|
let localesDir = path.join(__dirname, '..', 'ui-locales');
|
|
38
|
+
|
|
39
|
+
// Check if the package is installed as a dependency (node_modules/i18ntk)
|
|
40
|
+
if (!fs.existsSync(localesDir)) {
|
|
41
|
+
try {
|
|
42
|
+
// When installed as npm package, use the package's ui-locales directory
|
|
43
|
+
const packageRoot = path.dirname(require.resolve('../package.json'));
|
|
44
|
+
localesDir = path.join(packageRoot, 'ui-locales');
|
|
45
|
+
} catch (resolveError) {
|
|
46
|
+
// Fallback to relative path if package.json resolution fails
|
|
47
|
+
localesDir = path.join(__dirname, '..', 'ui-locales');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
37
50
|
|
|
38
51
|
// Use provided directory if it's a valid string
|
|
39
52
|
if (typeof baseDir === 'string' && baseDir.trim() !== '') {
|
|
@@ -50,10 +63,26 @@ function loadTranslations(language, baseDir) {
|
|
|
50
63
|
try {
|
|
51
64
|
localesDir = path.resolve(localesDir);
|
|
52
65
|
} catch (resolveError) {
|
|
53
|
-
//
|
|
66
|
+
// Final fallback to package ui-locales directory
|
|
54
67
|
localesDir = path.join(__dirname, '..', 'ui-locales');
|
|
55
68
|
}
|
|
56
69
|
|
|
70
|
+
// Ensure the directory exists before attempting to read from it
|
|
71
|
+
if (!fs.existsSync(localesDir)) {
|
|
72
|
+
console.warn(`UI locales directory not found: ${localesDir}`);
|
|
73
|
+
// Try one more fallback - direct package path
|
|
74
|
+
try {
|
|
75
|
+
const packageRoot = path.join(__dirname, '..');
|
|
76
|
+
const fallbackDir = path.join(packageRoot, 'ui-locales');
|
|
77
|
+
if (fs.existsSync(fallbackDir)) {
|
|
78
|
+
localesDir = fallbackDir;
|
|
79
|
+
}
|
|
80
|
+
} catch (e) {
|
|
81
|
+
// Last resort - use current directory
|
|
82
|
+
localesDir = path.join(process.cwd(), 'ui-locales');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
57
86
|
try {
|
|
58
87
|
translations = {}; // Reset translations for the new language
|
|
59
88
|
|