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/dist/types.d.ts CHANGED
@@ -65,11 +65,11 @@ type JsxChild = string | JsxElement | Variable;
65
65
  /**
66
66
  * The format of the content
67
67
  */
68
- type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';
68
+ type DataFormat = 'JSX' | 'ICU' | 'I18NEXT' | 'DATE_FNS';
69
69
  /**
70
70
  * A content type representing JSX, ICU, and I18next messages
71
71
  */
72
- type Content = JsxChildren | IcuMessage | I18nextMessage;
72
+ type Content = JsxChildren | IcuMessage | I18nextMessage | DateFnsMessage;
73
73
  /**
74
74
  * A content type representing JSX elements
75
75
  */
@@ -82,6 +82,10 @@ type IcuMessage = string;
82
82
  * A content type representing I18next messages
83
83
  */
84
84
  type I18nextMessage = string;
85
+ /**
86
+ * A content type representing DateFns messages
87
+ */
88
+ type DateFnsMessage = string;
85
89
 
86
90
  /**
87
91
  * ActionType is the type of action to perform on the request.
@@ -112,7 +116,7 @@ type EntryMetadata = {
112
116
  scriptCode?: string;
113
117
  };
114
118
  /**
115
- * GTRequest is a translation request object for {@link JsxChildren} | {@link IcuMessage} | {@link I18nextMessage}
119
+ * GTRequest is a translation request object for {@link JsxChildren} | {@link IcuMessage} | {@link I18nextMessage} | {@link DateFnsMessage}
116
120
  *
117
121
  * @param source - The source content to translate.
118
122
  * @param targetLocale - The target locale to translate to.
@@ -162,6 +166,7 @@ type FileToUpload = {
162
166
  formatMetadata?: Record<string, any>;
163
167
  incomingBranchId?: string;
164
168
  checkedOutBranchId?: string;
169
+ locale: string;
165
170
  } & Omit<FileReference, 'branchId'> & {
166
171
  branchId?: string;
167
172
  };
@@ -223,6 +228,9 @@ type Updates = ({
223
228
  } | {
224
229
  dataFormat: 'I18NEXT';
225
230
  source: string;
231
+ } | {
232
+ dataFormat: 'DATE_FNS';
233
+ source: string;
226
234
  }))[];
227
235
  /**
228
236
  * Options for enqueueing files
@@ -264,6 +272,36 @@ type EnqueueFilesResult = {
264
272
  message: string;
265
273
  };
266
274
 
275
+ /**
276
+ * Metadata stored alongside GTJSON file entries.
277
+ * Keys correspond to the entry id/hash in the GTJSON body.
278
+ */
279
+ type GTJsonFormatMetadata = Record<string, {
280
+ context?: string;
281
+ id?: string;
282
+ domain?: string;
283
+ maxChars?: number;
284
+ dataFormat?: 'JSX' | 'ICU' | 'I18NEXT' | 'DATE_FNS';
285
+ requestVersion?: number;
286
+ approved_at?: string | null;
287
+ approved_by?: string | null;
288
+ hash?: string;
289
+ filePaths?: string[];
290
+ }>;
291
+ type FileUpload = {
292
+ branchId?: string;
293
+ incomingBranchId?: string;
294
+ checkedOutBranchId?: string;
295
+ content: string;
296
+ fileName: string;
297
+ fileFormat: FileFormat;
298
+ dataFormat?: DataFormat;
299
+ locale: string;
300
+ formatMetadata?: GTJsonFormatMetadata;
301
+ versionId?: string;
302
+ fileId?: string;
303
+ };
304
+
267
305
  type EnqueueEntriesOptions = {
268
306
  timeout?: number;
269
307
  sourceLocale?: string;
@@ -302,8 +340,8 @@ type TypedResult = {
302
340
  translation: JsxChildren;
303
341
  dataFormat: 'JSX';
304
342
  } | {
305
- translation: I18nextMessage | IcuMessage;
306
- dataFormat: 'ICU' | 'I18NEXT';
343
+ translation: I18nextMessage | IcuMessage | DateFnsMessage;
344
+ dataFormat: 'ICU' | 'I18NEXT' | 'DATE_FNS';
307
345
  };
308
346
  /**
309
347
  * RequestError is a type that represents an error that occurred during a translation request.
@@ -511,4 +549,4 @@ type TranslationRequestConfig = {
511
549
  };
512
550
 
513
551
  export { HTML_CONTENT_PROPS };
514
- export type { BranchDataResult, BranchQuery, CheckFileTranslationsOptions, CheckJobStatusResult, Content, ContentTranslationResult, CustomMapping, DataFormat, DownloadFileBatchOptions, DownloadFileBatchResult, DownloadFileOptions, DownloadedFile, EnqueueEntriesOptions, EnqueueEntriesResult, EnqueueFilesOptions, EnqueueFilesResult, Entry, ActionType as EntryActionType, EntryMetadata, FetchTranslationsOptions, FetchTranslationsResult, FileDataQuery, FileDataResult, FileFormat, FileReference, FileToUpload, FileTranslationQuery, FormatVariables, GTProp, HashMetadata, HtmlContentPropKeysRecord, HtmlContentPropValuesRecord, I18nextMessage, IcuMessage, IcuTranslationResult, JobStatus, JsxChild, JsxChildren, JsxElement, JsxTranslationResult, LocaleProperties, Metadata, Request, RetrievedTranslations, SubmitUserEditDiff, SubmitUserEditDiffsPayload, Transformation, TransformationPrefix, TranslateManyResult, TranslationError, TranslationRequestConfig, TranslationResult, TranslationResultReference, TranslationStatusResult, Update, Updates, Variable, VariableTransformationSuffix, VariableType, _Content };
552
+ export type { BranchDataResult, BranchQuery, CheckFileTranslationsOptions, CheckJobStatusResult, Content, ContentTranslationResult, CustomMapping, DataFormat, DateFnsMessage, DownloadFileBatchOptions, DownloadFileBatchResult, DownloadFileOptions, DownloadedFile, EnqueueEntriesOptions, EnqueueEntriesResult, EnqueueFilesOptions, EnqueueFilesResult, Entry, ActionType as EntryActionType, EntryMetadata, FetchTranslationsOptions, FetchTranslationsResult, FileDataQuery, FileDataResult, FileFormat, FileReference, FileToUpload, FileTranslationQuery, FileUpload, FormatVariables, GTProp, HashMetadata, HtmlContentPropKeysRecord, HtmlContentPropValuesRecord, I18nextMessage, IcuMessage, IcuTranslationResult, JobStatus, JsxChild, JsxChildren, JsxElement, JsxTranslationResult, LocaleProperties, Metadata, Request, RetrievedTranslations, SubmitUserEditDiff, SubmitUserEditDiffsPayload, Transformation, TransformationPrefix, TranslateManyResult, TranslationError, TranslationRequestConfig, TranslationResult, TranslationResultReference, TranslationStatusResult, Update, Updates, Variable, VariableTransformationSuffix, VariableType, _Content };
@@ -1 +1 @@
1
- {"version":3,"file":"types.esm.min.mjs","sources":["../src/types-dir/jsx/content.ts"],"sourcesContent":["import { Variable } from './variables';\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n t?: string; // tag name\n i?: number; // id\n d?: GTProp; // GT data\n c?: JsxChildren; // children\n};\n\nexport type JsxChild = string | JsxElement | Variable;\n\n/**\n * The format of the content\n */\nexport type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';\n\n/**\n * A content type representing JSX, ICU, and I18next messages\n */\nexport type Content = JsxChildren | IcuMessage | I18nextMessage;\n\n/**\n * A content type representing JSX elements\n */\nexport type JsxChildren = JsxChild | JsxChild[];\n\n/**\n * A content type representing ICU messages\n */\nexport type IcuMessage = string;\n\n/**\n * A content type representing I18next messages\n */\nexport type I18nextMessage = string;\n"],"names":["HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard"],"mappings":"AAKO,IAAMA,EAAqB,CAChCC,GAAI,cACJC,GAAI,QACJC,IAAK,MACLC,IAAK,aACLC,IAAK,kBACLC,IAAK"}
1
+ {"version":3,"file":"types.esm.min.mjs","sources":["../src/types-dir/jsx/content.ts"],"sourcesContent":["import { Variable } from './variables';\n\n/**\n * Map of data-_gt properties to their corresponding React props\n */\nexport const HTML_CONTENT_PROPS = {\n pl: 'placeholder',\n ti: 'title',\n alt: 'alt',\n arl: 'aria-label',\n arb: 'aria-labelledby',\n ard: 'aria-describedby',\n} as const;\n\nexport type HtmlContentPropKeysRecord = Partial<\n Record<keyof typeof HTML_CONTENT_PROPS, string>\n>;\nexport type HtmlContentPropValuesRecord = Partial<\n Record<(typeof HTML_CONTENT_PROPS)[keyof typeof HTML_CONTENT_PROPS], string>\n>;\n\n/**\n * GTProp is an internal property used to contain data for translating and rendering elements.\n * note, transformations are only read on the server side if they are 'plural' or 'branch'\n */\nexport type GTProp = {\n b?: Record<string, JsxChildren>; // Branches\n t?: 'p' | 'b'; // Branch Transformation\n} & HtmlContentPropKeysRecord;\n\nexport type JsxElement = {\n t?: string; // tag name\n i?: number; // id\n d?: GTProp; // GT data\n c?: JsxChildren; // children\n};\n\nexport type JsxChild = string | JsxElement | Variable;\n\n/**\n * The format of the content\n */\nexport type DataFormat = 'JSX' | 'ICU' | 'I18NEXT' | 'DATE_FNS';\n\n/**\n * A content type representing JSX, ICU, and I18next messages\n */\nexport type Content =\n | JsxChildren\n | IcuMessage\n | I18nextMessage\n | DateFnsMessage;\n\n/**\n * A content type representing JSX elements\n */\nexport type JsxChildren = JsxChild | JsxChild[];\n\n/**\n * A content type representing ICU messages\n */\nexport type IcuMessage = string;\n\n/**\n * A content type representing I18next messages\n */\nexport type I18nextMessage = string;\n\n/**\n * A content type representing DateFns messages\n */\nexport type DateFnsMessage = string;\n"],"names":["HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard"],"mappings":"AAKO,IAAMA,EAAqB,CAChCC,GAAI,cACJC,GAAI,QACJC,IAAK,MACLC,IAAK,aACLC,IAAK,kBACLC,IAAK"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generaltranslation",
3
- "version": "8.1.4",
3
+ "version": "8.1.6",
4
4
  "description": "A language toolkit for AI developers",
5
5
  "main": "dist/index.cjs.min.cjs",
6
6
  "module": "dist/index.esm.min.mjs",