i18n-keyless-node 1.14.6 → 1.14.7
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/dist/package.json +2 -2
- package/dist/service.js +8 -6
- package/package.json +2 -2
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18n-keyless-node",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"postpublish": "rm -rf ./dist && rm *.tgz"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"i18n-keyless-core": "1.14.
|
|
18
|
+
"i18n-keyless-core": "1.14.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@eslint/js": "^9.9.0",
|
package/dist/service.js
CHANGED
|
@@ -127,11 +127,6 @@ queue.on("empty", () => {
|
|
|
127
127
|
store.translations = res.data.translations;
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
-
sendTranslationsUsageToI18nKeyless().then((res) => {
|
|
131
|
-
if (res?.ok) {
|
|
132
|
-
store.lastUsedTranslations = {};
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
130
|
});
|
|
136
131
|
export async function init(newConfig) {
|
|
137
132
|
if (!newConfig.languages) {
|
|
@@ -182,7 +177,11 @@ async function awaitForTranslationFn(key, currentLanguage, options) {
|
|
|
182
177
|
}
|
|
183
178
|
const forceTemporaryLang = options?.forceTemporary?.[currentLanguage];
|
|
184
179
|
const translationKey = context ? `${key}__${context}` : key;
|
|
185
|
-
store.lastUsedTranslations[translationKey]
|
|
180
|
+
const lastUsedAt = store.lastUsedTranslations[translationKey];
|
|
181
|
+
const newLastUsedAt = new Date().toISOString().split("T")[0];
|
|
182
|
+
if (lastUsedAt !== newLastUsedAt) {
|
|
183
|
+
store.lastUsedTranslations[translationKey] = newLastUsedAt;
|
|
184
|
+
}
|
|
186
185
|
// Safe navigation for potentially undefined language store
|
|
187
186
|
const translation = translations[currentLanguage]?.[translationKey];
|
|
188
187
|
// Return existing translation if found and not forced temporary
|
|
@@ -190,6 +189,9 @@ async function awaitForTranslationFn(key, currentLanguage, options) {
|
|
|
190
189
|
if (debug) {
|
|
191
190
|
console.log(`i18n-keyless: Translation found in store for key: "${translationKey}"`);
|
|
192
191
|
}
|
|
192
|
+
if (lastUsedAt !== newLastUsedAt) {
|
|
193
|
+
sendTranslationsUsageToI18nKeyless();
|
|
194
|
+
}
|
|
193
195
|
return translation;
|
|
194
196
|
}
|
|
195
197
|
// Use custom handler if provided
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18n-keyless-node",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"postpublish": "rm -rf ./dist && rm *.tgz"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"i18n-keyless-core": "1.14.
|
|
18
|
+
"i18n-keyless-core": "1.14.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@eslint/js": "^9.9.0",
|