generaltranslation 2.0.66 → 2.0.67
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -32,14 +32,14 @@ declare class GT {
|
|
32
32
|
* If `metadata.save` is provided, the translation is cached for use in a public project.
|
33
33
|
*
|
34
34
|
* @param {Content} content - The string or array of strings/variables to be translated.
|
35
|
-
* @param {string}
|
35
|
+
* @param {string} language - The target language code (e.g., 'en', 'fr') for the translation.
|
36
36
|
* @param {{ context?: string, save?: boolean, [key: string]: any }} [metadata] - Additional metadata for the translation request.
|
37
37
|
* @param {string} [metadata.context] - Contextual information to assist with the translation.
|
38
38
|
* @param {boolean} [metadata.save] - Whether to cache the translation for use in a public project.
|
39
39
|
*
|
40
40
|
* @returns {Promise<ContentTranslationResult>} A promise that resolves to the translated content, or an error if the translation fails.
|
41
41
|
*/
|
42
|
-
translate(content: Content,
|
42
|
+
translate(content: Content, language: string, metadata?: {
|
43
43
|
context?: string;
|
44
44
|
save?: boolean;
|
45
45
|
[key: string]: any;
|
@@ -52,12 +52,12 @@ declare class GT {
|
|
52
52
|
*
|
53
53
|
* @param {Object} params - The parameters for the translation.
|
54
54
|
* @param {ReactChildrenAsObject} params.children - The React children content to be translated.
|
55
|
-
* @param {string} params.
|
55
|
+
* @param {string} params.language - The target language for the translation.
|
56
56
|
* @param {Object} params.metadata - Additional metadata for the translation process.
|
57
57
|
*
|
58
58
|
* @returns {Promise<ReactTranslationResult>} - A promise that resolves to the translated content.
|
59
59
|
*/
|
60
|
-
translateReact(children: ReactChildrenAsObject,
|
60
|
+
translateReact(children: ReactChildrenAsObject, language: string, metadata?: {
|
61
61
|
context?: string;
|
62
62
|
save?: boolean;
|
63
63
|
[key: string]: any;
|
@@ -70,7 +70,7 @@ declare class GT {
|
|
70
70
|
translateBundle(requests: Request[]): Promise<Array<ReactTranslationResult | ContentTranslationResult>>;
|
71
71
|
/**
|
72
72
|
* Pushes updates to a remotely cached translation dictionary.
|
73
|
-
* @param {Update[]} updates - Array of updates
|
73
|
+
* @param {Update[]} updates - Array of updates.
|
74
74
|
* @param {string[]} [languages] - Array of languages to be updated.
|
75
75
|
* @param {string} [projectID=this.projectID] - The ID of the project. Defaults to the instance's projectID.
|
76
76
|
* @param {boolean} [replace=false] - Whether to replace the existing dictionary. Defaults to false.
|
package/dist/index.js
CHANGED
@@ -105,18 +105,18 @@ var GT = /** @class */ (function () {
|
|
105
105
|
* If `metadata.save` is provided, the translation is cached for use in a public project.
|
106
106
|
*
|
107
107
|
* @param {Content} content - The string or array of strings/variables to be translated.
|
108
|
-
* @param {string}
|
108
|
+
* @param {string} language - The target language code (e.g., 'en', 'fr') for the translation.
|
109
109
|
* @param {{ context?: string, save?: boolean, [key: string]: any }} [metadata] - Additional metadata for the translation request.
|
110
110
|
* @param {string} [metadata.context] - Contextual information to assist with the translation.
|
111
111
|
* @param {boolean} [metadata.save] - Whether to cache the translation for use in a public project.
|
112
112
|
*
|
113
113
|
* @returns {Promise<ContentTranslationResult>} A promise that resolves to the translated content, or an error if the translation fails.
|
114
114
|
*/
|
115
|
-
GT.prototype.translate = function (content,
|
115
|
+
GT.prototype.translate = function (content, language, metadata) {
|
116
116
|
return __awaiter(this, void 0, void 0, function () {
|
117
117
|
return __generator(this, function (_a) {
|
118
118
|
switch (_a.label) {
|
119
|
-
case 0: return [4 /*yield*/, (0, _translate_1.default)(this, content,
|
119
|
+
case 0: return [4 /*yield*/, (0, _translate_1.default)(this, content, language, __assign({ projectID: this.projectID, defaultLanguage: this.defaultLanguage }, metadata))];
|
120
120
|
case 1: return [2 /*return*/, _a.sent()];
|
121
121
|
}
|
122
122
|
});
|
@@ -127,16 +127,16 @@ var GT = /** @class */ (function () {
|
|
127
127
|
*
|
128
128
|
* @param {Object} params - The parameters for the translation.
|
129
129
|
* @param {ReactChildrenAsObject} params.children - The React children content to be translated.
|
130
|
-
* @param {string} params.
|
130
|
+
* @param {string} params.language - The target language for the translation.
|
131
131
|
* @param {Object} params.metadata - Additional metadata for the translation process.
|
132
132
|
*
|
133
133
|
* @returns {Promise<ReactTranslationResult>} - A promise that resolves to the translated content.
|
134
134
|
*/
|
135
|
-
GT.prototype.translateReact = function (children,
|
135
|
+
GT.prototype.translateReact = function (children, language, metadata) {
|
136
136
|
return __awaiter(this, void 0, void 0, function () {
|
137
137
|
return __generator(this, function (_a) {
|
138
138
|
switch (_a.label) {
|
139
|
-
case 0: return [4 /*yield*/, (0, _translateReact_1.default)(this, children,
|
139
|
+
case 0: return [4 /*yield*/, (0, _translateReact_1.default)(this, children, language, __assign({ projectID: this.projectID, defaultLanguage: this.defaultLanguage }, metadata))];
|
140
140
|
case 1: return [2 /*return*/, _a.sent()];
|
141
141
|
}
|
142
142
|
});
|
@@ -156,7 +156,7 @@ var GT = /** @class */ (function () {
|
|
156
156
|
};
|
157
157
|
/**
|
158
158
|
* Pushes updates to a remotely cached translation dictionary.
|
159
|
-
* @param {Update[]} updates - Array of updates
|
159
|
+
* @param {Update[]} updates - Array of updates.
|
160
160
|
* @param {string[]} [languages] - Array of languages to be updated.
|
161
161
|
* @param {string} [projectID=this.projectID] - The ID of the project. Defaults to the instance's projectID.
|
162
162
|
* @param {boolean} [replace=false] - Whether to replace the existing dictionary. Defaults to false.
|