generaltranslation 8.1.5 → 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/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.
@@ -223,7 +227,7 @@ type GTJsonFormatMetadata = Record<string, {
223
227
  id?: string;
224
228
  domain?: string;
225
229
  maxChars?: number;
226
- dataFormat?: 'JSX' | 'ICU';
230
+ dataFormat?: 'JSX' | 'ICU' | 'I18NEXT' | 'DATE_FNS';
227
231
  requestVersion?: number;
228
232
  approved_at?: string | null;
229
233
  approved_by?: string | null;
@@ -272,8 +276,8 @@ type TypedResult = {
272
276
  translation: JsxChildren;
273
277
  dataFormat: 'JSX';
274
278
  } | {
275
- translation: I18nextMessage | IcuMessage;
276
- dataFormat: 'ICU' | 'I18NEXT';
279
+ translation: I18nextMessage | IcuMessage | DateFnsMessage;
280
+ dataFormat: 'ICU' | 'I18NEXT' | 'DATE_FNS';
277
281
  };
278
282
  /**
279
283
  * RequestError is a type that represents an error that occurred during a translation request.
@@ -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.