generaltranslation 8.1.4 → 8.1.6
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/CHANGELOG.md +12 -0
- package/dist/id.d.ts +1 -1
- package/dist/index.cjs.min.cjs +3 -3
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.d.ts +60 -46
- package/dist/index.esm.min.mjs +3 -3
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs +1 -1
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.d.ts +2 -2
- package/dist/internal.esm.min.mjs +1 -1
- package/dist/internal.esm.min.mjs.map +1 -1
- package/dist/logging/warnings.d.ts +1 -0
- package/dist/settings/settings.d.ts +1 -1
- package/dist/types-dir/api/enqueueFiles.d.ts +3 -0
- package/dist/types-dir/api/entry.d.ts +1 -1
- package/dist/types-dir/api/file.d.ts +1 -0
- package/dist/types-dir/api/translate.d.ts +3 -3
- package/dist/types-dir/api/uploadFiles.d.ts +1 -9
- package/dist/types-dir/jsx/content.d.ts +6 -2
- package/dist/types.cjs.min.cjs.map +1 -1
- package/dist/types.d.ts +44 -6
- package/dist/types.esm.min.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -64,11 +64,11 @@ type JsxChild = string | JsxElement | Variable;
|
|
|
64
64
|
/**
|
|
65
65
|
* The format of the content
|
|
66
66
|
*/
|
|
67
|
-
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';
|
|
67
|
+
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT' | 'DATE_FNS';
|
|
68
68
|
/**
|
|
69
69
|
* A content type representing JSX, ICU, and I18next messages
|
|
70
70
|
*/
|
|
71
|
-
type Content = JsxChildren | IcuMessage | I18nextMessage;
|
|
71
|
+
type Content = JsxChildren | IcuMessage | I18nextMessage | DateFnsMessage;
|
|
72
72
|
/**
|
|
73
73
|
* A content type representing JSX elements
|
|
74
74
|
*/
|
|
@@ -81,6 +81,10 @@ type IcuMessage = string;
|
|
|
81
81
|
* A content type representing I18next messages
|
|
82
82
|
*/
|
|
83
83
|
type I18nextMessage = string;
|
|
84
|
+
/**
|
|
85
|
+
* A content type representing DateFns messages
|
|
86
|
+
*/
|
|
87
|
+
type DateFnsMessage = string;
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
90
|
* ActionType is the type of action to perform on the request.
|
|
@@ -111,7 +115,7 @@ type EntryMetadata = {
|
|
|
111
115
|
scriptCode?: string;
|
|
112
116
|
};
|
|
113
117
|
/**
|
|
114
|
-
* GTRequest is a translation request object for {@link JsxChildren} | {@link IcuMessage} | {@link I18nextMessage}
|
|
118
|
+
* GTRequest is a translation request object for {@link JsxChildren} | {@link IcuMessage} | {@link I18nextMessage} | {@link DateFnsMessage}
|
|
115
119
|
*
|
|
116
120
|
* @param source - The source content to translate.
|
|
117
121
|
* @param targetLocale - The target locale to translate to.
|
|
@@ -214,6 +218,46 @@ type EnqueueFilesResult = {
|
|
|
214
218
|
message: string;
|
|
215
219
|
};
|
|
216
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Metadata stored alongside GTJSON file entries.
|
|
223
|
+
* Keys correspond to the entry id/hash in the GTJSON body.
|
|
224
|
+
*/
|
|
225
|
+
type GTJsonFormatMetadata = Record<string, {
|
|
226
|
+
context?: string;
|
|
227
|
+
id?: string;
|
|
228
|
+
domain?: string;
|
|
229
|
+
maxChars?: number;
|
|
230
|
+
dataFormat?: 'JSX' | 'ICU' | 'I18NEXT' | 'DATE_FNS';
|
|
231
|
+
requestVersion?: number;
|
|
232
|
+
approved_at?: string | null;
|
|
233
|
+
approved_by?: string | null;
|
|
234
|
+
hash?: string;
|
|
235
|
+
filePaths?: string[];
|
|
236
|
+
}>;
|
|
237
|
+
type FileUpload = {
|
|
238
|
+
branchId?: string;
|
|
239
|
+
incomingBranchId?: string;
|
|
240
|
+
checkedOutBranchId?: string;
|
|
241
|
+
content: string;
|
|
242
|
+
fileName: string;
|
|
243
|
+
fileFormat: FileFormat;
|
|
244
|
+
dataFormat?: DataFormat;
|
|
245
|
+
locale: string;
|
|
246
|
+
formatMetadata?: GTJsonFormatMetadata;
|
|
247
|
+
versionId?: string;
|
|
248
|
+
fileId?: string;
|
|
249
|
+
};
|
|
250
|
+
type UploadFilesOptions = {
|
|
251
|
+
sourceLocale: string;
|
|
252
|
+
modelProvider?: string;
|
|
253
|
+
timeout?: number;
|
|
254
|
+
};
|
|
255
|
+
type UploadFilesResponse = {
|
|
256
|
+
uploadedFiles: FileReference[];
|
|
257
|
+
count: number;
|
|
258
|
+
message: string;
|
|
259
|
+
};
|
|
260
|
+
|
|
217
261
|
type DownloadFileOptions = {
|
|
218
262
|
timeout?: number;
|
|
219
263
|
};
|
|
@@ -232,8 +276,8 @@ type TypedResult = {
|
|
|
232
276
|
translation: JsxChildren;
|
|
233
277
|
dataFormat: 'JSX';
|
|
234
278
|
} | {
|
|
235
|
-
translation: I18nextMessage | IcuMessage;
|
|
236
|
-
dataFormat: 'ICU' | 'I18NEXT';
|
|
279
|
+
translation: I18nextMessage | IcuMessage | DateFnsMessage;
|
|
280
|
+
dataFormat: 'ICU' | 'I18NEXT' | 'DATE_FNS';
|
|
237
281
|
};
|
|
238
282
|
/**
|
|
239
283
|
* RequestError is a type that represents an error that occurred during a translation request.
|
|
@@ -369,46 +413,6 @@ type CustomRegionMapping = {
|
|
|
369
413
|
};
|
|
370
414
|
};
|
|
371
415
|
|
|
372
|
-
/**
|
|
373
|
-
* Metadata stored alongside GTJSON file entries.
|
|
374
|
-
* Keys correspond to the entry id/hash in the GTJSON body.
|
|
375
|
-
*/
|
|
376
|
-
type GTJsonFormatMetadata = Record<string, {
|
|
377
|
-
context?: string;
|
|
378
|
-
id?: string;
|
|
379
|
-
domain?: string;
|
|
380
|
-
maxChars?: number;
|
|
381
|
-
dataFormat?: 'JSX' | 'ICU';
|
|
382
|
-
requestVersion?: number;
|
|
383
|
-
approved_at?: string | null;
|
|
384
|
-
approved_by?: string | null;
|
|
385
|
-
hash?: string;
|
|
386
|
-
filePaths?: string[];
|
|
387
|
-
}>;
|
|
388
|
-
type FileUpload = {
|
|
389
|
-
branchId?: string;
|
|
390
|
-
incomingBranchId?: string;
|
|
391
|
-
checkedOutBranchId?: string;
|
|
392
|
-
content: string;
|
|
393
|
-
fileName: string;
|
|
394
|
-
fileFormat: FileFormat;
|
|
395
|
-
dataFormat?: DataFormat;
|
|
396
|
-
locale: string;
|
|
397
|
-
formatMetadata?: GTJsonFormatMetadata;
|
|
398
|
-
versionId?: string;
|
|
399
|
-
fileId?: string;
|
|
400
|
-
};
|
|
401
|
-
type UploadFilesOptions = {
|
|
402
|
-
sourceLocale: string;
|
|
403
|
-
modelProvider?: string;
|
|
404
|
-
timeout?: number;
|
|
405
|
-
};
|
|
406
|
-
type UploadFilesResponse = {
|
|
407
|
-
uploadedFiles: FileReference[];
|
|
408
|
-
count: number;
|
|
409
|
-
message: string;
|
|
410
|
-
};
|
|
411
|
-
|
|
412
416
|
type ProjectData = {
|
|
413
417
|
id: string;
|
|
414
418
|
name: string;
|
|
@@ -706,10 +710,17 @@ declare class GT {
|
|
|
706
710
|
_translate(source: I18nextMessage, targetLocale: string, metadata?: Omit<EntryMetadata, 'dataFormat'> & {
|
|
707
711
|
dataFormat?: 'I18NEXT';
|
|
708
712
|
}): Promise<TranslationResult | TranslationError>;
|
|
713
|
+
/**
|
|
714
|
+
* Translates the source content to the target locale.
|
|
715
|
+
* @deprecated Use the {@link translate} method instead.
|
|
716
|
+
*/
|
|
717
|
+
_translate(source: DateFnsMessage, targetLocale: string, metadata?: Omit<EntryMetadata, 'dataFormat'> & {
|
|
718
|
+
dataFormat?: 'DATE_FNS';
|
|
719
|
+
}): Promise<TranslationResult | TranslationError>;
|
|
709
720
|
/**
|
|
710
721
|
* Translates the source content to the target locale.
|
|
711
722
|
*
|
|
712
|
-
* @param {Content} source - {@link JsxChildren} | {@link IcuMessage} | {@link I18nextMessage} The source content to translate.
|
|
723
|
+
* @param {Content} source - {@link JsxChildren} | {@link IcuMessage} | {@link I18nextMessage} | {@link DateFnsMessage} The source content to translate.
|
|
713
724
|
* @param {string} targetLocale - string The target locale to translate to.
|
|
714
725
|
* @param {EntryMetadata} metadata - {@link EntryMetadata} The metadata for the translation.
|
|
715
726
|
* @returns {Promise<TranslationResult | TranslationError>} The translated content.
|
|
@@ -741,6 +752,9 @@ declare class GT {
|
|
|
741
752
|
translate(source: I18nextMessage, targetLocale: string, metadata?: Omit<EntryMetadata, 'dataFormat'> & {
|
|
742
753
|
dataFormat?: 'I18NEXT';
|
|
743
754
|
}): Promise<TranslationResult | TranslationError>;
|
|
755
|
+
translate(source: DateFnsMessage, targetLocale: string, metadata?: Omit<EntryMetadata, 'dataFormat'> & {
|
|
756
|
+
dataFormat?: 'DATE_FNS';
|
|
757
|
+
}): Promise<TranslationResult | TranslationError>;
|
|
744
758
|
/**
|
|
745
759
|
* Translates multiple source contents to the target locale.
|
|
746
760
|
* Override global metadata by supplying a metadata object for each request.
|