generaltranslation 2.0.46 → 2.0.48
Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts
CHANGED
@@ -85,7 +85,7 @@ declare class GT {
|
|
85
85
|
* @param updates - Array of updates with optional targetLanguage.
|
86
86
|
* @returns A promise that resolves to a boolean indicating success or failure.
|
87
87
|
*/
|
88
|
-
updateRemoteDictionary(updates: Update[]): Promise<
|
88
|
+
updateRemoteDictionary(updates: Update[]): Promise<string[]>;
|
89
89
|
}
|
90
90
|
export default GT;
|
91
91
|
/**
|
@@ -2,14 +2,14 @@ export type Update = {
|
|
2
2
|
type: 'react';
|
3
3
|
data: {
|
4
4
|
children: object | string;
|
5
|
-
|
5
|
+
targetLanguages?: string[];
|
6
6
|
metadata: Record<string, any>;
|
7
7
|
};
|
8
8
|
} | {
|
9
9
|
type: 'intl';
|
10
10
|
data: {
|
11
11
|
content: string;
|
12
|
-
|
12
|
+
targetLanguages?: string[];
|
13
13
|
metadata: Record<string, any>;
|
14
14
|
};
|
15
15
|
};
|
@@ -32,15 +32,15 @@ function _updateRemoteDictionary(gt, updates) {
|
|
32
32
|
throw new Error(`${response.status}: ${yield response.text()}`);
|
33
33
|
}
|
34
34
|
const result = yield response.json();
|
35
|
-
return result.
|
35
|
+
return result.languages;
|
36
36
|
}
|
37
37
|
catch (error) {
|
38
38
|
if (error instanceof Error && error.name === 'AbortError') {
|
39
39
|
console.error('Request timed out');
|
40
|
-
return
|
40
|
+
return [];
|
41
41
|
}
|
42
42
|
console.error(error);
|
43
|
-
return
|
43
|
+
return [];
|
44
44
|
}
|
45
45
|
});
|
46
46
|
}
|