generaltranslation 2.0.51 → 2.0.52
Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts
CHANGED
@@ -83,11 +83,12 @@ declare class GT {
|
|
83
83
|
/**
|
84
84
|
* Pushes updates to a remotely cached translation dictionary.
|
85
85
|
* @param {Update[]} updates - Array of updates with optional targetLanguage.
|
86
|
+
* @param {string[]} [languages] - Array of languages to be updated.
|
86
87
|
* @param {string} [projectID=this.projectID] - The ID of the project. Defaults to the instance's projectID.
|
87
88
|
* @param {boolean} [replace=false] - Whether to replace the existing dictionary. Defaults to false.
|
88
89
|
* @returns {Promise<string[]>} A promise that resolves to an array of strings indicating the languages which have been updated.
|
89
90
|
*/
|
90
|
-
updateRemoteDictionary(updates: Update[], projectID?: string, replace?: boolean): Promise<string[]>;
|
91
|
+
updateRemoteDictionary(updates: Update[], languages?: string[], projectID?: string, replace?: boolean): Promise<string[]>;
|
91
92
|
}
|
92
93
|
export default GT;
|
93
94
|
/**
|
package/dist/index.js
CHANGED
@@ -106,13 +106,14 @@ class GT {
|
|
106
106
|
/**
|
107
107
|
* Pushes updates to a remotely cached translation dictionary.
|
108
108
|
* @param {Update[]} updates - Array of updates with optional targetLanguage.
|
109
|
+
* @param {string[]} [languages] - Array of languages to be updated.
|
109
110
|
* @param {string} [projectID=this.projectID] - The ID of the project. Defaults to the instance's projectID.
|
110
111
|
* @param {boolean} [replace=false] - Whether to replace the existing dictionary. Defaults to false.
|
111
112
|
* @returns {Promise<string[]>} A promise that resolves to an array of strings indicating the languages which have been updated.
|
112
113
|
*/
|
113
114
|
updateRemoteDictionary(updates_1) {
|
114
|
-
return __awaiter(this, arguments, void 0, function* (updates, projectID = this.projectID, replace = false) {
|
115
|
-
return (0, _updateRemoteDictionary_1.default)(this, updates, projectID, replace);
|
115
|
+
return __awaiter(this, arguments, void 0, function* (updates, languages = [], projectID = this.projectID, replace = false) {
|
116
|
+
return (0, _updateRemoteDictionary_1.default)(this, updates, languages, projectID, replace);
|
116
117
|
});
|
117
118
|
}
|
118
119
|
}
|
@@ -2,14 +2,16 @@ export type Update = {
|
|
2
2
|
type: 'react';
|
3
3
|
data: {
|
4
4
|
children: object | string;
|
5
|
-
targetLanguages?: string[];
|
6
5
|
metadata: Record<string, any>;
|
7
6
|
};
|
8
7
|
} | {
|
9
8
|
type: 'intl';
|
10
9
|
data: {
|
11
10
|
content: string;
|
12
|
-
targetLanguages?: string[];
|
13
11
|
metadata: Record<string, any>;
|
14
12
|
};
|
15
13
|
};
|
14
|
+
export default function _updateRemoteDictionary(gt: {
|
15
|
+
baseURL: string;
|
16
|
+
apiKey: string;
|
17
|
+
}, updates: Update[], languages: string[], projectID: string, replace: boolean): Promise<string[]>;
|
@@ -10,14 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.default = _updateRemoteDictionary;
|
13
|
-
|
14
|
-
* Pushes updates to a remotely cached translation dictionary.
|
15
|
-
* @param {{ baseURL: string, apiKey: string }} gt - Contains the baseURL and apiKey for the server request.
|
16
|
-
* @param {Update[]} updates - Array of requests to be processed and sent.
|
17
|
-
* @returns {Promise<boolean>} A promise that resolves to an array of processed results.
|
18
|
-
* @internal
|
19
|
-
*/
|
20
|
-
function _updateRemoteDictionary(gt, updates, projectID, replace) {
|
13
|
+
function _updateRemoteDictionary(gt, updates, languages, projectID, replace) {
|
21
14
|
return __awaiter(this, void 0, void 0, function* () {
|
22
15
|
try {
|
23
16
|
const response = yield fetch(`${gt.baseURL}/update`, {
|
@@ -27,7 +20,7 @@ function _updateRemoteDictionary(gt, updates, projectID, replace) {
|
|
27
20
|
'gtx-api-key': gt.apiKey,
|
28
21
|
},
|
29
22
|
body: JSON.stringify({
|
30
|
-
updates, projectID, replace
|
23
|
+
updates, languages, projectID, replace
|
31
24
|
})
|
32
25
|
});
|
33
26
|
if (!response.ok) {
|