i18n-keyless-node 1.12.3 → 1.12.4
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 +2 -2
- package/dist/types.d.ts +2 -5
- 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.12.
|
|
4
|
+
"version": "1.12.4",
|
|
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.12.
|
|
18
|
+
"i18n-keyless-core": "1.12.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@eslint/js": "^9.9.0",
|
package/dist/service.js
CHANGED
|
@@ -162,7 +162,7 @@ export const awaitForTranslation = new Proxy(async function (key, currentLanguag
|
|
|
162
162
|
primaryLanguage: config.languages.primary,
|
|
163
163
|
};
|
|
164
164
|
const apiUrl = config.API_URL || "https://api.i18n-keyless.com";
|
|
165
|
-
const url = `${apiUrl}/translate
|
|
165
|
+
const url = `${apiUrl}/translate`;
|
|
166
166
|
if (debug) {
|
|
167
167
|
console.log("fetching translation", url, body);
|
|
168
168
|
}
|
|
@@ -184,7 +184,7 @@ export const awaitForTranslation = new Proxy(async function (key, currentLanguag
|
|
|
184
184
|
if (response.message) {
|
|
185
185
|
console.warn("i18n-keyless: ", response.message);
|
|
186
186
|
}
|
|
187
|
-
return response.data || key;
|
|
187
|
+
return response.data.translation[currentLanguage] || key;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
catch (error) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lang, PrimaryLang } from "i18n-keyless-core";
|
|
1
|
+
import { HandleTranslateFunction, Lang, PrimaryLang } from "i18n-keyless-core";
|
|
2
2
|
export type Translations = Record<string, string>;
|
|
3
3
|
export interface I18nKeylessNodeConfig {
|
|
4
4
|
/**
|
|
@@ -54,10 +54,7 @@ export interface I18nKeylessNodeConfig {
|
|
|
54
54
|
* - not use this `handleTranslate` function, and use the built in API call with API_KEY filled
|
|
55
55
|
* - not use this `handleTranslate` function nor API_KEY key, and provide your own API_URL
|
|
56
56
|
*/
|
|
57
|
-
handleTranslate?:
|
|
58
|
-
ok: boolean;
|
|
59
|
-
message: string;
|
|
60
|
-
}>;
|
|
57
|
+
handleTranslate?: HandleTranslateFunction;
|
|
61
58
|
/**
|
|
62
59
|
* if this function exists, it will be called instead of the API call
|
|
63
60
|
* if this function doesn't exist, the default behavior is to call the API, with the API_KEY
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18n-keyless-node",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.12.
|
|
4
|
+
"version": "1.12.4",
|
|
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.12.
|
|
18
|
+
"i18n-keyless-core": "1.12.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@eslint/js": "^9.9.0",
|