i18n-keyless-node 1.14.4 → 1.14.5
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.d.ts +1 -1
- package/dist/service.js +7 -7
- package/dist/types.d.ts +2 -2
- 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.5",
|
|
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.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@eslint/js": "^9.9.0",
|
package/dist/service.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare function getAllTranslationsForAllLanguages(): Promise<I18nKeyless
|
|
|
14
14
|
*
|
|
15
15
|
* It's called on lib initialization
|
|
16
16
|
* and everytime the language is set
|
|
17
|
-
* @param
|
|
17
|
+
* @param lastUsedTranslations - The last used translations
|
|
18
18
|
* @param store - The translation store
|
|
19
19
|
* @returns Promise resolving to the translation response or void if failed
|
|
20
20
|
*/
|
package/dist/service.js
CHANGED
|
@@ -19,7 +19,7 @@ const store = {
|
|
|
19
19
|
ko: {},
|
|
20
20
|
ar: {},
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
lastUsedTranslations: {},
|
|
23
23
|
uniqueId: "",
|
|
24
24
|
lastRefresh: "",
|
|
25
25
|
config: {
|
|
@@ -80,7 +80,7 @@ export async function getAllTranslationsForAllLanguages() {
|
|
|
80
80
|
*
|
|
81
81
|
* It's called on lib initialization
|
|
82
82
|
* and everytime the language is set
|
|
83
|
-
* @param
|
|
83
|
+
* @param lastUsedTranslations - The last used translations
|
|
84
84
|
* @param store - The translation store
|
|
85
85
|
* @returns Promise resolving to the translation response or void if failed
|
|
86
86
|
*/
|
|
@@ -90,13 +90,13 @@ export async function sendTranslationsUsageToI18nKeyless() {
|
|
|
90
90
|
console.error("i18n-keyless: No config found");
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
if (Object.keys(
|
|
93
|
+
const lastUsedTranslations = store.lastUsedTranslations;
|
|
94
|
+
if (Object.keys(lastUsedTranslations).length === 0) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
try {
|
|
98
98
|
const response = config.sendTranslationsUsage
|
|
99
|
-
? await config.sendTranslationsUsage(
|
|
99
|
+
? await config.sendTranslationsUsage(lastUsedTranslations)
|
|
100
100
|
: await api
|
|
101
101
|
.postLastUsedTranslations(`${config.API_URL || "https://api.i18n-keyless.com"}/translate/last-used-translations`, {
|
|
102
102
|
method: "POST",
|
|
@@ -107,7 +107,7 @@ export async function sendTranslationsUsageToI18nKeyless() {
|
|
|
107
107
|
},
|
|
108
108
|
body: JSON.stringify({
|
|
109
109
|
primaryLanguage: config.languages.primary,
|
|
110
|
-
|
|
110
|
+
lastUsedTranslations,
|
|
111
111
|
}),
|
|
112
112
|
})
|
|
113
113
|
.then((res) => res);
|
|
@@ -129,7 +129,7 @@ queue.on("empty", () => {
|
|
|
129
129
|
});
|
|
130
130
|
sendTranslationsUsageToI18nKeyless().then((res) => {
|
|
131
131
|
if (res?.ok) {
|
|
132
|
-
store.
|
|
132
|
+
store.lastUsedTranslations = {};
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HandleTranslateFunction, Lang,
|
|
1
|
+
import { HandleTranslateFunction, Lang, LastUsedTranslations, PrimaryLang, SendTranslationsUsageFunction } from "i18n-keyless-core";
|
|
2
2
|
export type Translations = Record<string, string>;
|
|
3
3
|
export interface I18nKeylessNodeConfig {
|
|
4
4
|
/**
|
|
@@ -90,7 +90,7 @@ export interface I18nKeylessNodeStore {
|
|
|
90
90
|
/**
|
|
91
91
|
* the last used translations
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
lastUsedTranslations: LastUsedTranslations;
|
|
94
94
|
/**
|
|
95
95
|
* i18n-keyless' config
|
|
96
96
|
*/
|
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.5",
|
|
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.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@eslint/js": "^9.9.0",
|