generaltranslation 2.0.49 → 2.0.50
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/README.md +0 -44
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
@@ -237,50 +237,6 @@ console.log(results); // [{ translation: "Hola", language: "es" }, { translation
|
|
237
237
|
|
238
238
|
- A promise that resolves to an array of processed results.
|
239
239
|
|
240
|
-
### updateRemoteDictionary(updates)
|
241
|
-
|
242
|
-
Pushes updates to a remotely cached translation dictionary.
|
243
|
-
|
244
|
-
#### Parameters
|
245
|
-
|
246
|
-
- `updates` (Update[]): An array of update objects. Each update can be of type `react` or `intl`.
|
247
|
-
|
248
|
-
- **React Update**:
|
249
|
-
- `type`: `'react'`
|
250
|
-
- `data`: An object containing:
|
251
|
-
- `children` (object | string): The React children content to be translated.
|
252
|
-
- `targetLanguage` (string, optional): The target language for the translation.
|
253
|
-
- `metadata` (Record<string, any>): Additional metadata for the translation process.
|
254
|
-
|
255
|
-
- **Intl Update**:
|
256
|
-
- `type`: `'intl'`
|
257
|
-
- `data`: An object containing:
|
258
|
-
- `content` (string): The string content to be translated.
|
259
|
-
- `targetLanguage` (string, optional): The target language for the translation.
|
260
|
-
- `metadata` (Record<string, any>): Additional metadata for the translation process.
|
261
|
-
|
262
|
-
#### Returns
|
263
|
-
|
264
|
-
- A promise that resolves to a boolean indicating success (`true`) or failure (`false`).
|
265
|
-
|
266
|
-
#### Example
|
267
|
-
|
268
|
-
```js
|
269
|
-
import { updateRemoteDictionary } from 'generaltranslation';
|
270
|
-
const updates = [
|
271
|
-
{
|
272
|
-
type: 'react',
|
273
|
-
data: {
|
274
|
-
children: { type: 'div', props: { children: 'Hello, world' } },
|
275
|
-
targetLanguage: 'es',
|
276
|
-
metadata: { id: 'greeting' }
|
277
|
-
}
|
278
|
-
}
|
279
|
-
];
|
280
|
-
const success = await updateRemoteDictionary(updates);
|
281
|
-
console.log(success); // true or false
|
282
|
-
```
|
283
|
-
|
284
240
|
## Utility Functions
|
285
241
|
|
286
242
|
### getLanguageDirection
|
package/dist/index.d.ts
CHANGED
@@ -81,9 +81,11 @@ declare class GT {
|
|
81
81
|
*/
|
82
82
|
bundleTranslation(requests: Request[]): Promise<Array<any | null>>;
|
83
83
|
/**
|
84
|
-
*Pushes updates to a remotely cached translation dictionary.
|
85
|
-
* @param updates - Array of updates with optional targetLanguage.
|
86
|
-
* @
|
84
|
+
* Pushes updates to a remotely cached translation dictionary.
|
85
|
+
* @param {Update[]} updates - Array of updates with optional targetLanguage.
|
86
|
+
* @param {string} [projectID=this.projectID] - The ID of the project. Defaults to the instance's projectID.
|
87
|
+
* @param {boolean} [replace=false] - Whether to replace the existing dictionary. Defaults to false.
|
88
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of strings indicating the result of each update.
|
87
89
|
*/
|
88
90
|
updateRemoteDictionary(updates: Update[], projectID?: string, replace?: boolean): Promise<string[]>;
|
89
91
|
}
|
package/dist/index.js
CHANGED
@@ -104,9 +104,11 @@ class GT {
|
|
104
104
|
});
|
105
105
|
}
|
106
106
|
/**
|
107
|
-
*Pushes updates to a remotely cached translation dictionary.
|
108
|
-
* @param updates - Array of updates with optional targetLanguage.
|
109
|
-
* @
|
107
|
+
* Pushes updates to a remotely cached translation dictionary.
|
108
|
+
* @param {Update[]} updates - Array of updates with optional targetLanguage.
|
109
|
+
* @param {string} [projectID=this.projectID] - The ID of the project. Defaults to the instance's projectID.
|
110
|
+
* @param {boolean} [replace=false] - Whether to replace the existing dictionary. Defaults to false.
|
111
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of strings indicating the result of each update.
|
110
112
|
*/
|
111
113
|
updateRemoteDictionary(updates_1) {
|
112
114
|
return __awaiter(this, arguments, void 0, function* (updates, projectID = this.projectID, replace = false) {
|