generaltranslation 9.5.6 → 9.5.7
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 +6 -0
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/internal.mjs.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.mts +1 -1
- package/dist/{types-CEsh60Yt.d.mts → types-BxgnFr8M.d.cts} +3 -3
- package/dist/{types-yByDbKnV.d.cts → types-Ix4SHG5H.d.mts} +3 -3
- package/dist/types-dir/transformations.d.ts +2 -2
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/utils/minify.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# generaltranslation
|
|
2
2
|
|
|
3
|
+
## 9.5.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2455](https://github.com/generaltranslation/gt/pull/2455) [`c220f39`](https://github.com/generaltranslation/gt/commit/c220f39182a61be3d8139bfe18c5bced0f2956dc) Thanks [@eoinest](https://github.com/eoinest)! - Fix `<RelativeTime>` inside `<T>`: rename its variable transformation suffix from `relative-time` to `relativetime` so `_gtt` parsing reads it in full, letting it render formatted time and hash like the extractors.
|
|
8
|
+
|
|
3
9
|
## 9.5.6
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/id.d.cts
CHANGED
package/dist/id.d.mts
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as DownloadFileOptions, Ct as FileQueryResult, F as SubmitUserEditDiffsPayload, G as FileDataQuery, I as AwaitJobsOptions$1, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, St as FileQuery, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, at as SetupProjectFileReference, ct as EnqueueFilesOptions, dt as DownloadFileBatchResult, et as PublishFileEntry, gt as FileReferenceIds, it as UploadFilesResponse, lt as DownloadFileBatchOptions, n as CreateTagOptions, nt as FileUpload, ot as SetupProjectOptions, q as BranchQuery, r as CreateTagResult, rt as UploadFilesOptions, st as SetupProjectResult, tt as PublishFilesResult, u as GetOrphanedFilesResult, ut as DownloadFileBatchRequest, xt as CheckFileTranslationsOptions, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-
|
|
1
|
+
import { $ as DownloadFileOptions, Ct as FileQueryResult, F as SubmitUserEditDiffsPayload, G as FileDataQuery, I as AwaitJobsOptions$1, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, St as FileQuery, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, at as SetupProjectFileReference, ct as EnqueueFilesOptions, dt as DownloadFileBatchResult, et as PublishFileEntry, gt as FileReferenceIds, it as UploadFilesResponse, lt as DownloadFileBatchOptions, n as CreateTagOptions, nt as FileUpload, ot as SetupProjectOptions, q as BranchQuery, r as CreateTagResult, rt as UploadFilesOptions, st as SetupProjectResult, tt as PublishFilesResult, u as GetOrphanedFilesResult, ut as DownloadFileBatchRequest, xt as CheckFileTranslationsOptions, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-BxgnFr8M.cjs";
|
|
2
2
|
import { GTConstructorParams, GTRuntime } from "./runtime.cjs";
|
|
3
3
|
import { n as declareVar, r as decodeVars, t as derive } from "./derive-J2NQLqZm.cjs";
|
|
4
4
|
import { CreateBranchResponse, GetProjectInfoResponse, UploadAssetsResponse } from "@generaltranslation/api";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as DownloadFileOptions, Ct as FileQueryResult, F as SubmitUserEditDiffsPayload, G as FileDataQuery, I as AwaitJobsOptions$1, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, St as FileQuery, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, at as SetupProjectFileReference, ct as EnqueueFilesOptions, dt as DownloadFileBatchResult, et as PublishFileEntry, gt as FileReferenceIds, it as UploadFilesResponse, lt as DownloadFileBatchOptions, n as CreateTagOptions, nt as FileUpload, ot as SetupProjectOptions, q as BranchQuery, r as CreateTagResult, rt as UploadFilesOptions, st as SetupProjectResult, tt as PublishFilesResult, u as GetOrphanedFilesResult, ut as DownloadFileBatchRequest, xt as CheckFileTranslationsOptions, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-
|
|
1
|
+
import { $ as DownloadFileOptions, Ct as FileQueryResult, F as SubmitUserEditDiffsPayload, G as FileDataQuery, I as AwaitJobsOptions$1, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, St as FileQuery, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, at as SetupProjectFileReference, ct as EnqueueFilesOptions, dt as DownloadFileBatchResult, et as PublishFileEntry, gt as FileReferenceIds, it as UploadFilesResponse, lt as DownloadFileBatchOptions, n as CreateTagOptions, nt as FileUpload, ot as SetupProjectOptions, q as BranchQuery, r as CreateTagResult, rt as UploadFilesOptions, st as SetupProjectResult, tt as PublishFilesResult, u as GetOrphanedFilesResult, ut as DownloadFileBatchRequest, xt as CheckFileTranslationsOptions, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-Ix4SHG5H.mjs";
|
|
2
2
|
import { GTConstructorParams, GTRuntime } from "./runtime.mjs";
|
|
3
3
|
import { n as declareVar, r as decodeVars, t as derive } from "./derive-VfZjYfIU.mjs";
|
|
4
4
|
import { CreateBranchResponse, GetProjectInfoResponse, UploadAssetsResponse } from "@generaltranslation/api";
|
package/dist/internal.cjs
CHANGED
|
@@ -56,7 +56,7 @@ const VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {
|
|
|
56
56
|
number: "n",
|
|
57
57
|
datetime: "d",
|
|
58
58
|
currency: "c",
|
|
59
|
-
|
|
59
|
+
relativetime: "rt"
|
|
60
60
|
};
|
|
61
61
|
function minifyVariableType(variableType) {
|
|
62
62
|
return VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];
|
package/dist/internal.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.cjs","names":["isGTUnindexedSelectElement","VAR_IDENTIFIER","isGTUnindexedSelectElement","VAR_IDENTIFIER","TYPE","traverseIcu","isGTIndexedSelectElement"],"sources":["../src/settings/plurals.ts","../src/locales/getPluralForm.ts","../src/utils/minify.ts","../src/derive/indexVars.ts","../src/derive/extractVars.ts","../src/derive/condenseVars.ts"],"sourcesContent":["export const pluralForms = [\n 'singular',\n 'plural',\n 'dual',\n 'zero',\n 'one',\n 'two',\n 'few',\n 'many',\n 'other',\n] as const;\nexport type PluralType = (typeof pluralForms)[number];\nexport function isAcceptedPluralForm(form: string): form is PluralType {\n return pluralForms.includes(form as (typeof pluralForms)[number]);\n}\n","import { getCachedPluralRules } from '@generaltranslation/format/internal';\n\nimport { pluralForms, PluralType } from '../settings/plurals';\nimport { libraryDefaultLocale } from '../settings/settings';\n\n/**\n * Given a number and a list of allowed plural forms, return the plural form that best fits the number.\n *\n * @param {number} n - The number to determine the plural form for.\n * @param {PluralType[]} forms - The allowed plural forms.\n * @returns {PluralType} The determined plural form, or an empty string if none fit.\n */\nexport function _getPluralForm(\n n: number,\n forms: readonly PluralType[] = pluralForms,\n locales: string[] = [libraryDefaultLocale]\n): PluralType | '' {\n const pluralRules = getCachedPluralRules(locales);\n const provisionalBranchName = pluralRules.select(n);\n // aliases\n const absN = Math.abs(n);\n // 0\n if (absN === 0 && forms.includes('zero')) return 'zero'; // override\n // 1\n if (absN === 1) {\n if (forms.includes('singular')) return 'singular'; // override\n if (forms.includes('one')) return 'one'; // override\n }\n if (provisionalBranchName === 'one' && forms.includes('singular'))\n return 'singular';\n // 2\n if (absN === 2) {\n if (forms.includes('dual')) return 'dual'; // override\n if (forms.includes('two')) return 'two'; // override\n }\n if (provisionalBranchName === 'two' && forms.includes('dual')) return 'dual';\n // fallbacks\n if (forms.includes(provisionalBranchName)) return provisionalBranchName;\n if (forms.includes('plural')) return 'plural';\n if (forms.includes('other')) return 'other';\n return '';\n}\n","import { VariableTransformationSuffix, VariableType } from '../types';\n\nconst VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {\n variable: 'v',\n number: 'n',\n datetime: 'd',\n currency: 'c',\n 'relative-time': 'rt',\n} as const;\n\nexport function minifyVariableType(\n variableType: VariableTransformationSuffix\n): VariableType {\n return VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];\n}\n","import { VAR_IDENTIFIER } from './utils/constants';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { GTUnindexedSelectElement } from './utils/types';\nimport { isGTUnindexedSelectElement } from './utils/traverseHelpers';\nimport type { IcuMessage } from '@generaltranslation/format/types';\n\ntype Location = {\n start: number;\n end: number;\n otherStart: number;\n otherEnd: number;\n};\n\n/**\n * Given an ICU string adds identifiers to each _gt_ placeholder\n * indexVars('Hello {_gt_} {_gt_} World') => 'Hello {_gt_1_} {_gt_2_} World'\n */\nexport function indexVars(icuString: IcuMessage): string {\n // Check if the string contains _gt_\n if (!icuString.includes(VAR_IDENTIFIER)) {\n return icuString;\n }\n\n // Record the location of the variable\n const variableLocations: Location[] = [];\n function visitor(child: GTUnindexedSelectElement): void {\n variableLocations.push({\n start: child.location?.start.offset ?? 0,\n end: child.location?.end.offset ?? 0,\n otherStart: child.options.other.location?.start.offset ?? 0,\n otherEnd: child.options.other.location?.end.offset ?? 0,\n });\n }\n\n // Find all variable identifiers.\n traverseIcu({\n icuString,\n shouldVisit: isGTUnindexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false, captureLocation: true },\n });\n\n // Index each variable and collapse the other option.\n const result = [];\n let current = 0;\n for (let i = 0; i < variableLocations.length; i++) {\n const { start, end, otherStart, otherEnd } = variableLocations[i];\n // Before the variable\n result.push(icuString.slice(current, start));\n // Replace the variable with the new identifier (+1 is for the curly brace)\n result.push(icuString.slice(start, start + VAR_IDENTIFIER.length + 1));\n\n // Add the new identifier.\n result.push(String(i + 1));\n // After the variable\n result.push(icuString.slice(start + VAR_IDENTIFIER.length + 1, otherStart));\n // Before the other option\n result.push('{}');\n // The other option\n result.push(icuString.slice(otherEnd, end));\n current = end;\n }\n result.push(icuString.slice(current, icuString.length));\n\n return result.join('');\n}\n","import { VAR_IDENTIFIER } from './utils/constants';\nimport { isGTUnindexedSelectElement } from './utils/traverseHelpers';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { GTUnindexedSelectElement } from './utils/types';\n/**\n * Given an unindexed ICU string, extracts all the _gt_ variables and an indexed mapping of the variable to the values\n *\n * extractVars('Hello {_gt_, select, other {World}}') => { _gt_1: 'World' }\n *\n * @param {string} icuString - The ICU string to extract variables from.\n * @returns {Record<string, string>} A mapping of the variable to the value.\n */\nexport function extractVars(icuString: string): Record<string, string> {\n // Check if the string contains _gt_\n if (!icuString.includes(VAR_IDENTIFIER)) {\n return {};\n }\n\n // Extract all the _gt_# variables\n let index = 1;\n const variables: Record<string, string> = {};\n function visitor(child: GTUnindexedSelectElement): void {\n variables[child.value + index] = child.options.other.value.length\n ? child.options.other.value[0]?.value\n : '';\n index += 1;\n }\n\n traverseIcu({\n icuString,\n shouldVisit: isGTUnindexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false },\n });\n\n return variables;\n}\n","import { printAST, TYPE, type ArgumentElement } from '@generaltranslation/icu';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { VAR_IDENTIFIER } from './utils/constants';\nimport { GTIndexedSelectElement } from './utils/types';\nimport { isGTIndexedSelectElement } from './utils/traverseHelpers';\ninterface GTIndexedArgumentElement extends ArgumentElement {\n value: `${typeof VAR_IDENTIFIER}${number}`;\n}\n\nconst CONTAINS_INDEXED_GT_REGEX = new RegExp(`${VAR_IDENTIFIER}\\\\d+`);\n\n/**\n * Given an indexed ICU string, condenses any select to an argument\n * Unindexed _gt_ source strings and indexed _gt_# translation strings\n * are mutually exclusive.\n * indexVars('Hello {_gt_1, select, other {World}}') => 'Hello {_gt_1}'\n * @param {string} icuString - The ICU string to condense.\n * @returns {string} The condensed ICU string.\n */\nexport function condenseVars(icuString: string): string {\n // Check if the string contains an indexed _gt_ identifier.\n if (!CONTAINS_INDEXED_GT_REGEX.test(icuString)) {\n return icuString;\n }\n\n // Replace with argument\n function visitor(child: GTIndexedSelectElement): void {\n (child as unknown as GTIndexedArgumentElement).type = TYPE.argument;\n Reflect.deleteProperty(child, 'options');\n }\n\n const ast = traverseIcu({\n icuString,\n shouldVisit: isGTIndexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false },\n });\n\n // Serialize\n return printAST(ast);\n}\n"],"mappings":";;;;;;;;;AAAA,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,qBAAqB,MAAkC;AACrE,QAAO,YAAY,SAAS,KAAqC;;;;;;;;;;;ACDnE,SAAgB,eACd,GACA,QAA+B,aAC/B,UAAoB,CAAA,KAAsB,EACzB;CAEjB,MAAM,yBAAA,GAAA,oCAAA,sBADmC,QACA,CAAC,OAAO,EAAE;CAEnD,MAAM,OAAO,KAAK,IAAI,EAAE;AAExB,KAAI,SAAS,KAAK,MAAM,SAAS,OAAO,CAAE,QAAO;AAEjD,KAAI,SAAS,GAAG;AACd,MAAI,MAAM,SAAS,WAAW,CAAE,QAAO;AACvC,MAAI,MAAM,SAAS,MAAM,CAAE,QAAO;;AAEpC,KAAI,0BAA0B,SAAS,MAAM,SAAS,WAAW,CAC/D,QAAO;AAET,KAAI,SAAS,GAAG;AACd,MAAI,MAAM,SAAS,OAAO,CAAE,QAAO;AACnC,MAAI,MAAM,SAAS,MA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AO,KAAK,UAAU,MAAM,UAAU,IAAI,CAAC;AAC3C,YAAU;;AAEZ,QAAO,KAAK,UAAU,MAAM,SAAS,UAAU,OAAO,CAAC;AAEvD,QAAO,OAAO,KAAK,GAAG;;;;;;;;;;;;ACpDxB,SAAgB,YAAY,WAA2C;AAErE,KAAI,CAAC,UAAU,SAAA,OAAwB,CACrC,QAAO,EAAE;CAIX,IAAI,QAAQ;CACZ,MAAM,YAAoC,EAAE;CAC5C,SAAS,QAAQ,OAAuC;AACtD,YAAU,MAAM,QAAQ,SAAS,MAAM,QAAQ,MAAM,MAAM,SACvD,MAAM,QAAQ,MAAM,MAAM,IAAI,QAC9B;AACJ,WAAS;;AAGX,gBAAA,YAAY;EACV;EACA,aAAaC,eAAAA;EACb;EACA,SAAS,EAAE,oBAAoB,OAAO;EACvC,CAAC;AAEF,QAAO;;;;AC1BT,MAAM,4BAA4B,IAAI,OAAO,GAAGC,eAAAA,eAAe,MAAM;;;;;;;;;AAUrE,SAAgB,aAAa,WAA2B;AAEtD,KAAI,CAAC,0BAA0B,KAAK,UAAU,CAC5C,QAAO;CAIT,SAAS,QAAQ,OAAqC;AACnD,QAA8C,OAAOC,wBAAAA,KAAK;AAC3D,UAAQ,eAAe,OAAO,UAAU;;AAW1C,SAAA,GAAA,wBAAA,UARYC,eAAAA,YAAY;EACtB;EACA,aAAaC,eAAAA;EACb;EACA,SAAS,EAAE,oBAAoB,OAAO;EACvC,CAGkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"internal.cjs","names":["isGTUnindexedSelectElement","VAR_IDENTIFIER","isGTUnindexedSelectElement","VAR_IDENTIFIER","TYPE","traverseIcu","isGTIndexedSelectElement"],"sources":["../src/settings/plurals.ts","../src/locales/getPluralForm.ts","../src/utils/minify.ts","../src/derive/indexVars.ts","../src/derive/extractVars.ts","../src/derive/condenseVars.ts"],"sourcesContent":["export const pluralForms = [\n 'singular',\n 'plural',\n 'dual',\n 'zero',\n 'one',\n 'two',\n 'few',\n 'many',\n 'other',\n] as const;\nexport type PluralType = (typeof pluralForms)[number];\nexport function isAcceptedPluralForm(form: string): form is PluralType {\n return pluralForms.includes(form as (typeof pluralForms)[number]);\n}\n","import { getCachedPluralRules } from '@generaltranslation/format/internal';\n\nimport { pluralForms, PluralType } from '../settings/plurals';\nimport { libraryDefaultLocale } from '../settings/settings';\n\n/**\n * Given a number and a list of allowed plural forms, return the plural form that best fits the number.\n *\n * @param {number} n - The number to determine the plural form for.\n * @param {PluralType[]} forms - The allowed plural forms.\n * @returns {PluralType} The determined plural form, or an empty string if none fit.\n */\nexport function _getPluralForm(\n n: number,\n forms: readonly PluralType[] = pluralForms,\n locales: string[] = [libraryDefaultLocale]\n): PluralType | '' {\n const pluralRules = getCachedPluralRules(locales);\n const provisionalBranchName = pluralRules.select(n);\n // aliases\n const absN = Math.abs(n);\n // 0\n if (absN === 0 && forms.includes('zero')) return 'zero'; // override\n // 1\n if (absN === 1) {\n if (forms.includes('singular')) return 'singular'; // override\n if (forms.includes('one')) return 'one'; // override\n }\n if (provisionalBranchName === 'one' && forms.includes('singular'))\n return 'singular';\n // 2\n if (absN === 2) {\n if (forms.includes('dual')) return 'dual'; // override\n if (forms.includes('two')) return 'two'; // override\n }\n if (provisionalBranchName === 'two' && forms.includes('dual')) return 'dual';\n // fallbacks\n if (forms.includes(provisionalBranchName)) return provisionalBranchName;\n if (forms.includes('plural')) return 'plural';\n if (forms.includes('other')) return 'other';\n return '';\n}\n","import { VariableTransformationSuffix, VariableType } from '../types';\n\nconst VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {\n variable: 'v',\n number: 'n',\n datetime: 'd',\n currency: 'c',\n relativetime: 'rt',\n} as const;\n\nexport function minifyVariableType(\n variableType: VariableTransformationSuffix\n): VariableType {\n return VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];\n}\n","import { VAR_IDENTIFIER } from './utils/constants';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { GTUnindexedSelectElement } from './utils/types';\nimport { isGTUnindexedSelectElement } from './utils/traverseHelpers';\nimport type { IcuMessage } from '@generaltranslation/format/types';\n\ntype Location = {\n start: number;\n end: number;\n otherStart: number;\n otherEnd: number;\n};\n\n/**\n * Given an ICU string adds identifiers to each _gt_ placeholder\n * indexVars('Hello {_gt_} {_gt_} World') => 'Hello {_gt_1_} {_gt_2_} World'\n */\nexport function indexVars(icuString: IcuMessage): string {\n // Check if the string contains _gt_\n if (!icuString.includes(VAR_IDENTIFIER)) {\n return icuString;\n }\n\n // Record the location of the variable\n const variableLocations: Location[] = [];\n function visitor(child: GTUnindexedSelectElement): void {\n variableLocations.push({\n start: child.location?.start.offset ?? 0,\n end: child.location?.end.offset ?? 0,\n otherStart: child.options.other.location?.start.offset ?? 0,\n otherEnd: child.options.other.location?.end.offset ?? 0,\n });\n }\n\n // Find all variable identifiers.\n traverseIcu({\n icuString,\n shouldVisit: isGTUnindexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false, captureLocation: true },\n });\n\n // Index each variable and collapse the other option.\n const result = [];\n let current = 0;\n for (let i = 0; i < variableLocations.length; i++) {\n const { start, end, otherStart, otherEnd } = variableLocations[i];\n // Before the variable\n result.push(icuString.slice(current, start));\n // Replace the variable with the new identifier (+1 is for the curly brace)\n result.push(icuString.slice(start, start + VAR_IDENTIFIER.length + 1));\n\n // Add the new identifier.\n result.push(String(i + 1));\n // After the variable\n result.push(icuString.slice(start + VAR_IDENTIFIER.length + 1, otherStart));\n // Before the other option\n result.push('{}');\n // The other option\n result.push(icuString.slice(otherEnd, end));\n current = end;\n }\n result.push(icuString.slice(current, icuString.length));\n\n return result.join('');\n}\n","import { VAR_IDENTIFIER } from './utils/constants';\nimport { isGTUnindexedSelectElement } from './utils/traverseHelpers';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { GTUnindexedSelectElement } from './utils/types';\n/**\n * Given an unindexed ICU string, extracts all the _gt_ variables and an indexed mapping of the variable to the values\n *\n * extractVars('Hello {_gt_, select, other {World}}') => { _gt_1: 'World' }\n *\n * @param {string} icuString - The ICU string to extract variables from.\n * @returns {Record<string, string>} A mapping of the variable to the value.\n */\nexport function extractVars(icuString: string): Record<string, string> {\n // Check if the string contains _gt_\n if (!icuString.includes(VAR_IDENTIFIER)) {\n return {};\n }\n\n // Extract all the _gt_# variables\n let index = 1;\n const variables: Record<string, string> = {};\n function visitor(child: GTUnindexedSelectElement): void {\n variables[child.value + index] = child.options.other.value.length\n ? child.options.other.value[0]?.value\n : '';\n index += 1;\n }\n\n traverseIcu({\n icuString,\n shouldVisit: isGTUnindexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false },\n });\n\n return variables;\n}\n","import { printAST, TYPE, type ArgumentElement } from '@generaltranslation/icu';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { VAR_IDENTIFIER } from './utils/constants';\nimport { GTIndexedSelectElement } from './utils/types';\nimport { isGTIndexedSelectElement } from './utils/traverseHelpers';\ninterface GTIndexedArgumentElement extends ArgumentElement {\n value: `${typeof VAR_IDENTIFIER}${number}`;\n}\n\nconst CONTAINS_INDEXED_GT_REGEX = new RegExp(`${VAR_IDENTIFIER}\\\\d+`);\n\n/**\n * Given an indexed ICU string, condenses any select to an argument\n * Unindexed _gt_ source strings and indexed _gt_# translation strings\n * are mutually exclusive.\n * indexVars('Hello {_gt_1, select, other {World}}') => 'Hello {_gt_1}'\n * @param {string} icuString - The ICU string to condense.\n * @returns {string} The condensed ICU string.\n */\nexport function condenseVars(icuString: string): string {\n // Check if the string contains an indexed _gt_ identifier.\n if (!CONTAINS_INDEXED_GT_REGEX.test(icuString)) {\n return icuString;\n }\n\n // Replace with argument\n function visitor(child: GTIndexedSelectElement): void {\n (child as unknown as GTIndexedArgumentElement).type = TYPE.argument;\n Reflect.deleteProperty(child, 'options');\n }\n\n const ast = traverseIcu({\n icuString,\n shouldVisit: isGTIndexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false },\n });\n\n // Serialize\n return printAST(ast);\n}\n"],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AAUrE,SAAgB,aAAa,WAA2B;AAEtD,KAAI,CAAC,0BAA0B,KAAK,UAAU,CAC5C,QAAO;CAIT,SAAS,QAAQ,OAAqC;AACnD,QAA8C,OAAOC,wBAAAA,KAAK;AAC3D,UAAQ,eAAe,OAAO,UAAU;;AAW1C,SAAA,GAAA,wBAAA,UARYC,eAAAA,YAAY;EACtB;EACA,aAAaC,eAAAA;EACb;EACA,SAAS,EAAE,oBAAoB,OAAO;EACvC,CAGkB,CAAC"}
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as formatDiagnosticErrorDetails, n as DiagnosticSeverity, r as createDiagnosticMessage, t as DiagnosticMessageInput } from "./diagnostics-CqAHg_Vc.cjs";
|
|
2
|
-
import { Ft as TranslateManyEntry, It as TranslateOptions, N as VariableTransformationSuffix, O as Variable, Pt as RuntimeTranslateManyOptions, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, ft as DownloadedFile, g as JsxChild, k as VariableType, mt as FileFormat, v as JsxElement, y as LocaleProperties } from "./types-
|
|
2
|
+
import { Ft as TranslateManyEntry, It as TranslateOptions, N as VariableTransformationSuffix, O as Variable, Pt as RuntimeTranslateManyOptions, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, ft as DownloadedFile, g as JsxChild, k as VariableType, mt as FileFormat, v as JsxElement, y as LocaleProperties } from "./types-BxgnFr8M.cjs";
|
|
3
3
|
import { n as declareVar, r as decodeVars, t as derive } from "./derive-J2NQLqZm.cjs";
|
|
4
4
|
import * as _$_generaltranslation_api0 from "@generaltranslation/api";
|
|
5
5
|
import { API_VERSION, ApiClientConfig, AwaitJobsOptions, CreateBranchData, CreateProjectApiKeyData, CreateProjectData, CreateTagData, DownloadFilesData, EnqueueFileTranslationsData, GenerateProjectContextData, GetBranchInfoData, GetFileInfoData, GetTranslationJobInfoResponse, GetTranslationStatusData, ModelProvider, ProcessFileMovesData, PublishFilesData, SubmitUserEditDiffsData, UploadAssetsData, UploadSourceFilesData, UploadTranslationsData, createApiClient } from "@generaltranslation/api";
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as formatDiagnosticErrorDetails, n as DiagnosticSeverity, r as createDiagnosticMessage, t as DiagnosticMessageInput } from "./diagnostics-BKjlDmJK.mjs";
|
|
2
|
-
import { Ft as TranslateManyEntry, It as TranslateOptions, N as VariableTransformationSuffix, O as Variable, Pt as RuntimeTranslateManyOptions, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, ft as DownloadedFile, g as JsxChild, k as VariableType, mt as FileFormat, v as JsxElement, y as LocaleProperties } from "./types-
|
|
2
|
+
import { Ft as TranslateManyEntry, It as TranslateOptions, N as VariableTransformationSuffix, O as Variable, Pt as RuntimeTranslateManyOptions, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, ft as DownloadedFile, g as JsxChild, k as VariableType, mt as FileFormat, v as JsxElement, y as LocaleProperties } from "./types-Ix4SHG5H.mjs";
|
|
3
3
|
import { n as declareVar, r as decodeVars, t as derive } from "./derive-VfZjYfIU.mjs";
|
|
4
4
|
import * as _$_generaltranslation_api0 from "@generaltranslation/api";
|
|
5
5
|
import { API_VERSION, ApiClientConfig, AwaitJobsOptions, CreateBranchData, CreateProjectApiKeyData, CreateProjectData, CreateTagData, DownloadFilesData, EnqueueFileTranslationsData, GenerateProjectContextData, GetBranchInfoData, GetFileInfoData, GetTranslationJobInfoResponse, GetTranslationStatusData, ModelProvider, ProcessFileMovesData, PublishFilesData, SubmitUserEditDiffsData, UploadAssetsData, UploadSourceFilesData, UploadTranslationsData, createApiClient } from "@generaltranslation/api";
|
package/dist/internal.mjs
CHANGED
|
@@ -55,7 +55,7 @@ const VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {
|
|
|
55
55
|
number: "n",
|
|
56
56
|
datetime: "d",
|
|
57
57
|
currency: "c",
|
|
58
|
-
|
|
58
|
+
relativetime: "rt"
|
|
59
59
|
};
|
|
60
60
|
function minifyVariableType(variableType) {
|
|
61
61
|
return VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];
|
package/dist/internal.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.mjs","names":[],"sources":["../src/settings/plurals.ts","../src/locales/getPluralForm.ts","../src/utils/minify.ts","../src/derive/indexVars.ts","../src/derive/extractVars.ts","../src/derive/condenseVars.ts"],"sourcesContent":["export const pluralForms = [\n 'singular',\n 'plural',\n 'dual',\n 'zero',\n 'one',\n 'two',\n 'few',\n 'many',\n 'other',\n] as const;\nexport type PluralType = (typeof pluralForms)[number];\nexport function isAcceptedPluralForm(form: string): form is PluralType {\n return pluralForms.includes(form as (typeof pluralForms)[number]);\n}\n","import { getCachedPluralRules } from '@generaltranslation/format/internal';\n\nimport { pluralForms, PluralType } from '../settings/plurals';\nimport { libraryDefaultLocale } from '../settings/settings';\n\n/**\n * Given a number and a list of allowed plural forms, return the plural form that best fits the number.\n *\n * @param {number} n - The number to determine the plural form for.\n * @param {PluralType[]} forms - The allowed plural forms.\n * @returns {PluralType} The determined plural form, or an empty string if none fit.\n */\nexport function _getPluralForm(\n n: number,\n forms: readonly PluralType[] = pluralForms,\n locales: string[] = [libraryDefaultLocale]\n): PluralType | '' {\n const pluralRules = getCachedPluralRules(locales);\n const provisionalBranchName = pluralRules.select(n);\n // aliases\n const absN = Math.abs(n);\n // 0\n if (absN === 0 && forms.includes('zero')) return 'zero'; // override\n // 1\n if (absN === 1) {\n if (forms.includes('singular')) return 'singular'; // override\n if (forms.includes('one')) return 'one'; // override\n }\n if (provisionalBranchName === 'one' && forms.includes('singular'))\n return 'singular';\n // 2\n if (absN === 2) {\n if (forms.includes('dual')) return 'dual'; // override\n if (forms.includes('two')) return 'two'; // override\n }\n if (provisionalBranchName === 'two' && forms.includes('dual')) return 'dual';\n // fallbacks\n if (forms.includes(provisionalBranchName)) return provisionalBranchName;\n if (forms.includes('plural')) return 'plural';\n if (forms.includes('other')) return 'other';\n return '';\n}\n","import { VariableTransformationSuffix, VariableType } from '../types';\n\nconst VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {\n variable: 'v',\n number: 'n',\n datetime: 'd',\n currency: 'c',\n
|
|
1
|
+
{"version":3,"file":"internal.mjs","names":[],"sources":["../src/settings/plurals.ts","../src/locales/getPluralForm.ts","../src/utils/minify.ts","../src/derive/indexVars.ts","../src/derive/extractVars.ts","../src/derive/condenseVars.ts"],"sourcesContent":["export const pluralForms = [\n 'singular',\n 'plural',\n 'dual',\n 'zero',\n 'one',\n 'two',\n 'few',\n 'many',\n 'other',\n] as const;\nexport type PluralType = (typeof pluralForms)[number];\nexport function isAcceptedPluralForm(form: string): form is PluralType {\n return pluralForms.includes(form as (typeof pluralForms)[number]);\n}\n","import { getCachedPluralRules } from '@generaltranslation/format/internal';\n\nimport { pluralForms, PluralType } from '../settings/plurals';\nimport { libraryDefaultLocale } from '../settings/settings';\n\n/**\n * Given a number and a list of allowed plural forms, return the plural form that best fits the number.\n *\n * @param {number} n - The number to determine the plural form for.\n * @param {PluralType[]} forms - The allowed plural forms.\n * @returns {PluralType} The determined plural form, or an empty string if none fit.\n */\nexport function _getPluralForm(\n n: number,\n forms: readonly PluralType[] = pluralForms,\n locales: string[] = [libraryDefaultLocale]\n): PluralType | '' {\n const pluralRules = getCachedPluralRules(locales);\n const provisionalBranchName = pluralRules.select(n);\n // aliases\n const absN = Math.abs(n);\n // 0\n if (absN === 0 && forms.includes('zero')) return 'zero'; // override\n // 1\n if (absN === 1) {\n if (forms.includes('singular')) return 'singular'; // override\n if (forms.includes('one')) return 'one'; // override\n }\n if (provisionalBranchName === 'one' && forms.includes('singular'))\n return 'singular';\n // 2\n if (absN === 2) {\n if (forms.includes('dual')) return 'dual'; // override\n if (forms.includes('two')) return 'two'; // override\n }\n if (provisionalBranchName === 'two' && forms.includes('dual')) return 'dual';\n // fallbacks\n if (forms.includes(provisionalBranchName)) return provisionalBranchName;\n if (forms.includes('plural')) return 'plural';\n if (forms.includes('other')) return 'other';\n return '';\n}\n","import { VariableTransformationSuffix, VariableType } from '../types';\n\nconst VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {\n variable: 'v',\n number: 'n',\n datetime: 'd',\n currency: 'c',\n relativetime: 'rt',\n} as const;\n\nexport function minifyVariableType(\n variableType: VariableTransformationSuffix\n): VariableType {\n return VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];\n}\n","import { VAR_IDENTIFIER } from './utils/constants';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { GTUnindexedSelectElement } from './utils/types';\nimport { isGTUnindexedSelectElement } from './utils/traverseHelpers';\nimport type { IcuMessage } from '@generaltranslation/format/types';\n\ntype Location = {\n start: number;\n end: number;\n otherStart: number;\n otherEnd: number;\n};\n\n/**\n * Given an ICU string adds identifiers to each _gt_ placeholder\n * indexVars('Hello {_gt_} {_gt_} World') => 'Hello {_gt_1_} {_gt_2_} World'\n */\nexport function indexVars(icuString: IcuMessage): string {\n // Check if the string contains _gt_\n if (!icuString.includes(VAR_IDENTIFIER)) {\n return icuString;\n }\n\n // Record the location of the variable\n const variableLocations: Location[] = [];\n function visitor(child: GTUnindexedSelectElement): void {\n variableLocations.push({\n start: child.location?.start.offset ?? 0,\n end: child.location?.end.offset ?? 0,\n otherStart: child.options.other.location?.start.offset ?? 0,\n otherEnd: child.options.other.location?.end.offset ?? 0,\n });\n }\n\n // Find all variable identifiers.\n traverseIcu({\n icuString,\n shouldVisit: isGTUnindexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false, captureLocation: true },\n });\n\n // Index each variable and collapse the other option.\n const result = [];\n let current = 0;\n for (let i = 0; i < variableLocations.length; i++) {\n const { start, end, otherStart, otherEnd } = variableLocations[i];\n // Before the variable\n result.push(icuString.slice(current, start));\n // Replace the variable with the new identifier (+1 is for the curly brace)\n result.push(icuString.slice(start, start + VAR_IDENTIFIER.length + 1));\n\n // Add the new identifier.\n result.push(String(i + 1));\n // After the variable\n result.push(icuString.slice(start + VAR_IDENTIFIER.length + 1, otherStart));\n // Before the other option\n result.push('{}');\n // The other option\n result.push(icuString.slice(otherEnd, end));\n current = end;\n }\n result.push(icuString.slice(current, icuString.length));\n\n return result.join('');\n}\n","import { VAR_IDENTIFIER } from './utils/constants';\nimport { isGTUnindexedSelectElement } from './utils/traverseHelpers';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { GTUnindexedSelectElement } from './utils/types';\n/**\n * Given an unindexed ICU string, extracts all the _gt_ variables and an indexed mapping of the variable to the values\n *\n * extractVars('Hello {_gt_, select, other {World}}') => { _gt_1: 'World' }\n *\n * @param {string} icuString - The ICU string to extract variables from.\n * @returns {Record<string, string>} A mapping of the variable to the value.\n */\nexport function extractVars(icuString: string): Record<string, string> {\n // Check if the string contains _gt_\n if (!icuString.includes(VAR_IDENTIFIER)) {\n return {};\n }\n\n // Extract all the _gt_# variables\n let index = 1;\n const variables: Record<string, string> = {};\n function visitor(child: GTUnindexedSelectElement): void {\n variables[child.value + index] = child.options.other.value.length\n ? child.options.other.value[0]?.value\n : '';\n index += 1;\n }\n\n traverseIcu({\n icuString,\n shouldVisit: isGTUnindexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false },\n });\n\n return variables;\n}\n","import { printAST, TYPE, type ArgumentElement } from '@generaltranslation/icu';\nimport { traverseIcu } from './utils/traverseIcu';\nimport { VAR_IDENTIFIER } from './utils/constants';\nimport { GTIndexedSelectElement } from './utils/types';\nimport { isGTIndexedSelectElement } from './utils/traverseHelpers';\ninterface GTIndexedArgumentElement extends ArgumentElement {\n value: `${typeof VAR_IDENTIFIER}${number}`;\n}\n\nconst CONTAINS_INDEXED_GT_REGEX = new RegExp(`${VAR_IDENTIFIER}\\\\d+`);\n\n/**\n * Given an indexed ICU string, condenses any select to an argument\n * Unindexed _gt_ source strings and indexed _gt_# translation strings\n * are mutually exclusive.\n * indexVars('Hello {_gt_1, select, other {World}}') => 'Hello {_gt_1}'\n * @param {string} icuString - The ICU string to condense.\n * @returns {string} The condensed ICU string.\n */\nexport function condenseVars(icuString: string): string {\n // Check if the string contains an indexed _gt_ identifier.\n if (!CONTAINS_INDEXED_GT_REGEX.test(icuString)) {\n return icuString;\n }\n\n // Replace with argument\n function visitor(child: GTIndexedSelectElement): void {\n (child as unknown as GTIndexedArgumentElement).type = TYPE.argument;\n Reflect.deleteProperty(child, 'options');\n }\n\n const ast = traverseIcu({\n icuString,\n shouldVisit: isGTIndexedSelectElement,\n visitor,\n options: { recurseIntoVisited: false },\n });\n\n // Serialize\n return printAST(ast);\n}\n"],"mappings":";;;;;;;;AAAA,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,qBAAqB,MAAkC;AACrE,QAAO,YAAY,SAAS,KAAqC;;;;;;;;;;;ACDnE,SAAgB,eACd,GACA,QAA+B,aAC/B,UAAoB,CAAA,KAAsB,EACzB;CAEjB,MAAM,wBADc,qBAAqB,QACA,CAAC,OAAO,EAAE;CAEnD,MAAM,OAAO,KAAK,IAAI,EAAE;AAExB,KAAI,SAAS,KAAK,MAAM,SAAS,OAAO,CAAE,QAAO;AAEjD,KAAI,SAAS,GAAG;AACd,MAAI,MAAM,SAAS,WAAW,CAAE,QAAO;AACvC,MAAI,MAAM,SAAS,MAAM,CAAE,QAAO;;AAEpC,KAAI,0BAA0B,SAAS,MAAM,SAAS,WAAW,CAC/D,QAAO;AAET,KAAI,SAAS,GAAG;AACd,MAAI,MAAM,SAAS,OAAO,CAAE,QAAO;AACnC,MAAI,MAAM,SAAS,MAAM,CAAE,QAAO;;AAEpC,KAAI,0BAA0B,SAAS,MAAM,SAAS,OAAO,CAAE,QAAO;AAEtE,KAAI,MAAM,SAAS,sBAAsB,CAAE,QAAO;AAClD,KAAI,MAAM,SAAS,SAAS,CAAE,QAAO;AACrC,KAAI,MAAM,SAAS,QAAQ,CAAE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EAAE;CAIX,IAAI,QAAQ;CACZ,MAAM,YAAoC,EAAE;CAC5C,SAAS,QAAQ,OAAuC;AACtD,YAAU,MAAM,QAAQ,SAAS,MAAM,QAAQ,MAAM,MAAM,SACvD,MAAM,QAAQ,MAAM,MAAM,IAAI,QAC9B;AACJ,WAAS;;AAGX,aAAY;EACV;EACA,aAAa;EACb;EACA,SAAS,EAAE,oBAAoB,OAAO;EACvC,CAAC;AAEF,QAAO;;;;AC1BT,MAAM,4BAA4B,IAAI,OAAO,GAAG,eAAe,MAAM;;;;;;;;;AAUrE,SAAgB,aAAa,WAA2B;AAEtD,KAAI,CAAC,0BAA0B,KAAK,UAAU,CAC5C,QAAO;CAIT,SAAS,QAAQ,OAAqC;AACnD,QAA8C,OAAO,KAAK;AAC3D,UAAQ,eAAe,OAAO,UAAU;;AAW1C,QAAO,SARK,YAAY;EACtB;EACA,aAAa;EACb;EACA,SAAS,EAAE,oBAAoB,OAAO;EACvC,CAGkB,CAAC"}
|
package/dist/runtime.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as TranslationRequestConfig, Ft as TranslateManyEntry, It as TranslateOptions, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult } from "./types-
|
|
1
|
+
import { D as TranslationRequestConfig, Ft as TranslateManyEntry, It as TranslateOptions, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult } from "./types-BxgnFr8M.cjs";
|
|
2
2
|
import { UserTokenProvider } from "@generaltranslation/api";
|
|
3
3
|
import { CustomMapping, CustomRegionMapping, CutoffFormatOptions, FormatVariables, LocaleProperties, StringFormat } from "@generaltranslation/format/types";
|
|
4
4
|
import { LocaleConfig } from "@generaltranslation/format";
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as TranslationRequestConfig, Ft as TranslateManyEntry, It as TranslateOptions, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult } from "./types-
|
|
1
|
+
import { D as TranslationRequestConfig, Ft as TranslateManyEntry, It as TranslateOptions, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult } from "./types-Ix4SHG5H.mjs";
|
|
2
2
|
import { UserTokenProvider } from "@generaltranslation/api";
|
|
3
3
|
import { LocaleConfig } from "@generaltranslation/format";
|
|
4
4
|
import { CustomMapping, CustomRegionMapping, CutoffFormatOptions, FormatVariables, LocaleProperties, StringFormat } from "@generaltranslation/format/types";
|
|
@@ -476,9 +476,9 @@ type SubmitUserEditDiffsPayload = {
|
|
|
476
476
|
* Transformations are made from a prefix and a suffix.
|
|
477
477
|
*/
|
|
478
478
|
type Transformation = BaseTransformation | `${BaseTransformation}-${InjectionType}`;
|
|
479
|
-
type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-
|
|
479
|
+
type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-relativetime' | 'plural' | 'branch' | 'derive';
|
|
480
480
|
type TransformationPrefix = 'translate' | 'variable' | 'plural' | 'branch' | 'fragment' | 'derive';
|
|
481
|
-
type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | '
|
|
481
|
+
type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | 'relativetime';
|
|
482
482
|
type InjectionType = 'automatic' | 'manual';
|
|
483
483
|
//#endregion
|
|
484
484
|
//#region src/types.d.ts
|
|
@@ -529,4 +529,4 @@ type TranslateConfig = Omit<TranslationRequestConfig, 'projectId'> & {
|
|
|
529
529
|
};
|
|
530
530
|
//#endregion
|
|
531
531
|
export { DownloadFileOptions as $, InjectionType as A, GTParsingFlags as At, JobStatus as B, StringContent as C, FileQueryResult as Ct, TranslationRequestConfig as D, GTConfig as Dt, TranslateConfig as E, JsonValue as Et, SubmitUserEditDiffsPayload as F, TranslateManyEntry as Ft, FileDataQuery as G, MoveResult as H, AwaitJobsOptions$1 as I, TranslateOptions as It, BranchDataResult as J, FileDataResult as K, AwaitJobsResult as L, TransformationPrefix as M, ActionType as Mt, VariableTransformationSuffix as N, EntryMetadata as Nt, Variable as O, GTFilesConfig as Ot, SubmitUserEditDiff as P, RuntimeTranslateManyOptions as Pt, TranslationResultReference as Q, JobResult as R, RuntimeFileFormat$1 as S, FileQuery as St, StringMessage$1 as T, JsonPrimitive as Tt, ProcessMovesOptions as U, MoveMapping as V, ProcessMovesResponse as W, TranslationError as X, TranslateManyResult as Y, TranslationResult as Z, JsxChildren$1 as _, FileToUpload as _t, CustomRegionMapping$1 as a, SetupProjectFileReference as at, Metadata as b, Updates as bt, FormatVariables$1 as c, EnqueueFilesOptions as ct, HTML_CONTENT_PROPS as d, DownloadFileBatchResult as dt, PublishFileEntry as et, HtmlContentPropKeysRecord as f, DownloadedFile as ft, JsxChild as g, FileReferenceIds as gt, IcuMessage$1 as h, FileReference as ht, CustomMapping$1 as i, UploadFilesResponse as it, Transformation as j, HashMetadata as jt, VariableType as k, GTOutputFileConfig as kt, GTProp as l, DownloadFileBatchOptions as lt, I18nextMessage$1 as m, FileFormat as mt, CreateTagOptions as n, FileUpload as nt, CutoffFormatOptions$1 as o, SetupProjectOptions as ot, HtmlContentPropValuesRecord as p, BINARY_FILE_FORMATS as pt, BranchQuery as q, CreateTagResult as r, UploadFilesOptions as rt, DataFormat$1 as s, SetupProjectResult as st, Content as t, PublishFilesResult as tt, GetOrphanedFilesResult as u, DownloadFileBatchRequest as ut, JsxElement as v, isBinaryFileFormat as vt, StringFormat$1 as w, JsonObject as wt, OrphanedFile as x, CheckFileTranslationsOptions as xt, LocaleProperties$1 as y, EnqueueFilesResult as yt, CheckJobStatusResult as z };
|
|
532
|
-
//# sourceMappingURL=types-
|
|
532
|
+
//# sourceMappingURL=types-BxgnFr8M.d.cts.map
|
|
@@ -476,9 +476,9 @@ type SubmitUserEditDiffsPayload = {
|
|
|
476
476
|
* Transformations are made from a prefix and a suffix.
|
|
477
477
|
*/
|
|
478
478
|
type Transformation = BaseTransformation | `${BaseTransformation}-${InjectionType}`;
|
|
479
|
-
type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-
|
|
479
|
+
type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-relativetime' | 'plural' | 'branch' | 'derive';
|
|
480
480
|
type TransformationPrefix = 'translate' | 'variable' | 'plural' | 'branch' | 'fragment' | 'derive';
|
|
481
|
-
type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | '
|
|
481
|
+
type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | 'relativetime';
|
|
482
482
|
type InjectionType = 'automatic' | 'manual';
|
|
483
483
|
//#endregion
|
|
484
484
|
//#region src/types.d.ts
|
|
@@ -529,4 +529,4 @@ type TranslateConfig = Omit<TranslationRequestConfig, 'projectId'> & {
|
|
|
529
529
|
};
|
|
530
530
|
//#endregion
|
|
531
531
|
export { DownloadFileOptions as $, InjectionType as A, GTParsingFlags as At, JobStatus as B, StringContent as C, FileQueryResult as Ct, TranslationRequestConfig as D, GTConfig as Dt, TranslateConfig as E, JsonValue as Et, SubmitUserEditDiffsPayload as F, TranslateManyEntry as Ft, FileDataQuery as G, MoveResult as H, AwaitJobsOptions$1 as I, TranslateOptions as It, BranchDataResult as J, FileDataResult as K, AwaitJobsResult as L, TransformationPrefix as M, ActionType as Mt, VariableTransformationSuffix as N, EntryMetadata as Nt, Variable as O, GTFilesConfig as Ot, SubmitUserEditDiff as P, RuntimeTranslateManyOptions as Pt, TranslationResultReference as Q, JobResult as R, RuntimeFileFormat$1 as S, FileQuery as St, StringMessage$1 as T, JsonPrimitive as Tt, ProcessMovesOptions as U, MoveMapping as V, ProcessMovesResponse as W, TranslationError as X, TranslateManyResult as Y, TranslationResult as Z, JsxChildren$1 as _, FileToUpload as _t, CustomRegionMapping$1 as a, SetupProjectFileReference as at, Metadata as b, Updates as bt, FormatVariables$1 as c, EnqueueFilesOptions as ct, HTML_CONTENT_PROPS as d, DownloadFileBatchResult as dt, PublishFileEntry as et, HtmlContentPropKeysRecord as f, DownloadedFile as ft, JsxChild as g, FileReferenceIds as gt, IcuMessage$1 as h, FileReference as ht, CustomMapping$1 as i, UploadFilesResponse as it, Transformation as j, HashMetadata as jt, VariableType as k, GTOutputFileConfig as kt, GTProp as l, DownloadFileBatchOptions as lt, I18nextMessage$1 as m, FileFormat as mt, CreateTagOptions as n, FileUpload as nt, CutoffFormatOptions$1 as o, SetupProjectOptions as ot, HtmlContentPropValuesRecord as p, BINARY_FILE_FORMATS as pt, BranchQuery as q, CreateTagResult as r, UploadFilesOptions as rt, DataFormat$1 as s, SetupProjectResult as st, Content as t, PublishFilesResult as tt, GetOrphanedFilesResult as u, DownloadFileBatchRequest as ut, JsxElement as v, isBinaryFileFormat as vt, StringFormat$1 as w, JsonObject as wt, OrphanedFile as x, CheckFileTranslationsOptions as xt, LocaleProperties$1 as y, EnqueueFilesResult as yt, CheckJobStatusResult as z };
|
|
532
|
-
//# sourceMappingURL=types-
|
|
532
|
+
//# sourceMappingURL=types-Ix4SHG5H.d.mts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Transformations are made from a prefix and a suffix.
|
|
3
3
|
*/
|
|
4
4
|
export type Transformation = BaseTransformation | `${BaseTransformation}-${InjectionType}`;
|
|
5
|
-
export type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-
|
|
5
|
+
export type BaseTransformation = 'translate-client' | 'translate-server' | 'translate-runtime' | 'variable-variable' | 'variable-currency' | 'variable-datetime' | 'variable-number' | 'variable-relativetime' | 'plural' | 'branch' | 'derive';
|
|
6
6
|
export type TransformationPrefix = 'translate' | 'variable' | 'plural' | 'branch' | 'fragment' | 'derive';
|
|
7
|
-
export type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | '
|
|
7
|
+
export type VariableTransformationSuffix = 'variable' | 'number' | 'datetime' | 'currency' | 'relativetime';
|
|
8
8
|
export type InjectionType = 'automatic' | 'manual';
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as DownloadFileOptions, A as InjectionType, At as GTParsingFlags, B as JobStatus, C as StringContent, D as TranslationRequestConfig, Dt as GTConfig, E as TranslateConfig, Et as JsonValue, F as SubmitUserEditDiffsPayload, Ft as TranslateManyEntry, G as FileDataQuery, H as MoveResult, I as AwaitJobsOptions, It as TranslateOptions, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, M as TransformationPrefix, Mt as ActionType, N as VariableTransformationSuffix, Nt as EntryMetadata, O as Variable, Ot as GTFilesConfig, P as SubmitUserEditDiff, Q as TranslationResultReference, R as JobResult, S as RuntimeFileFormat, T as StringMessage, Tt as JsonPrimitive, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, _t as FileToUpload, a as CustomRegionMapping, at as SetupProjectFileReference, b as Metadata, bt as Updates, c as FormatVariables, ct as EnqueueFilesOptions, d as HTML_CONTENT_PROPS, dt as DownloadFileBatchResult, et as PublishFileEntry, f as HtmlContentPropKeysRecord, ft as DownloadedFile, g as JsxChild, h as IcuMessage, ht as FileReference, i as CustomMapping, j as Transformation, jt as HashMetadata, k as VariableType, kt as GTOutputFileConfig, l as GTProp, lt as DownloadFileBatchOptions, m as I18nextMessage, mt as FileFormat, n as CreateTagOptions, nt as FileUpload, o as CutoffFormatOptions, p as HtmlContentPropValuesRecord, pt as BINARY_FILE_FORMATS, q as BranchQuery, r as CreateTagResult, s as DataFormat, t as Content, tt as PublishFilesResult, u as GetOrphanedFilesResult, v as JsxElement, vt as isBinaryFileFormat, w as StringFormat, wt as JsonObject, x as OrphanedFile, xt as CheckFileTranslationsOptions, y as LocaleProperties, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-
|
|
1
|
+
import { $ as DownloadFileOptions, A as InjectionType, At as GTParsingFlags, B as JobStatus, C as StringContent, D as TranslationRequestConfig, Dt as GTConfig, E as TranslateConfig, Et as JsonValue, F as SubmitUserEditDiffsPayload, Ft as TranslateManyEntry, G as FileDataQuery, H as MoveResult, I as AwaitJobsOptions, It as TranslateOptions, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, M as TransformationPrefix, Mt as ActionType, N as VariableTransformationSuffix, Nt as EntryMetadata, O as Variable, Ot as GTFilesConfig, P as SubmitUserEditDiff, Q as TranslationResultReference, R as JobResult, S as RuntimeFileFormat, T as StringMessage, Tt as JsonPrimitive, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, _t as FileToUpload, a as CustomRegionMapping, at as SetupProjectFileReference, b as Metadata, bt as Updates, c as FormatVariables, ct as EnqueueFilesOptions, d as HTML_CONTENT_PROPS, dt as DownloadFileBatchResult, et as PublishFileEntry, f as HtmlContentPropKeysRecord, ft as DownloadedFile, g as JsxChild, h as IcuMessage, ht as FileReference, i as CustomMapping, j as Transformation, jt as HashMetadata, k as VariableType, kt as GTOutputFileConfig, l as GTProp, lt as DownloadFileBatchOptions, m as I18nextMessage, mt as FileFormat, n as CreateTagOptions, nt as FileUpload, o as CutoffFormatOptions, p as HtmlContentPropValuesRecord, pt as BINARY_FILE_FORMATS, q as BranchQuery, r as CreateTagResult, s as DataFormat, t as Content, tt as PublishFilesResult, u as GetOrphanedFilesResult, v as JsxElement, vt as isBinaryFileFormat, w as StringFormat, wt as JsonObject, x as OrphanedFile, xt as CheckFileTranslationsOptions, y as LocaleProperties, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-BxgnFr8M.cjs";
|
|
2
2
|
export { AwaitJobsOptions, AwaitJobsResult, BINARY_FILE_FORMATS, BranchDataResult, BranchQuery, CheckFileTranslationsOptions, CheckJobStatusResult, Content, CreateTagOptions, CreateTagResult, CustomMapping, CustomRegionMapping, CutoffFormatOptions, DataFormat, DownloadFileBatchOptions, DownloadFileBatchResult, DownloadFileOptions, DownloadedFile, EnqueueFilesOptions, EnqueueFilesResult, ActionType as EntryActionType, EntryMetadata, FileDataQuery, FileDataResult, FileFormat, FileReference, FileToUpload, FileUpload, FormatVariables, GTConfig, GTFilesConfig, GTOutputFileConfig, GTParsingFlags, GTProp, GetOrphanedFilesResult, HTML_CONTENT_PROPS, HashMetadata, HtmlContentPropKeysRecord, HtmlContentPropValuesRecord, I18nextMessage, IcuMessage, InjectionType, JobResult, JobStatus, JsonObject, JsonPrimitive, JsonValue, JsxChild, JsxChildren, JsxElement, LocaleProperties, Metadata, MoveMapping, MoveResult, OrphanedFile, ProcessMovesOptions, ProcessMovesResponse, PublishFileEntry, PublishFilesResult, RuntimeFileFormat, SetupProjectFileReference, StringContent, StringFormat, StringMessage, SubmitUserEditDiff, SubmitUserEditDiffsPayload, Transformation, TransformationPrefix, TranslateConfig, TranslateManyEntry, TranslateManyResult, TranslateOptions, TranslationError, TranslationRequestConfig, TranslationResult, TranslationResultReference, Updates, Variable, VariableTransformationSuffix, VariableType, isBinaryFileFormat };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as DownloadFileOptions, A as InjectionType, At as GTParsingFlags, B as JobStatus, C as StringContent, D as TranslationRequestConfig, Dt as GTConfig, E as TranslateConfig, Et as JsonValue, F as SubmitUserEditDiffsPayload, Ft as TranslateManyEntry, G as FileDataQuery, H as MoveResult, I as AwaitJobsOptions, It as TranslateOptions, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, M as TransformationPrefix, Mt as ActionType, N as VariableTransformationSuffix, Nt as EntryMetadata, O as Variable, Ot as GTFilesConfig, P as SubmitUserEditDiff, Q as TranslationResultReference, R as JobResult, S as RuntimeFileFormat, T as StringMessage, Tt as JsonPrimitive, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, _t as FileToUpload, a as CustomRegionMapping, at as SetupProjectFileReference, b as Metadata, bt as Updates, c as FormatVariables, ct as EnqueueFilesOptions, d as HTML_CONTENT_PROPS, dt as DownloadFileBatchResult, et as PublishFileEntry, f as HtmlContentPropKeysRecord, ft as DownloadedFile, g as JsxChild, h as IcuMessage, ht as FileReference, i as CustomMapping, j as Transformation, jt as HashMetadata, k as VariableType, kt as GTOutputFileConfig, l as GTProp, lt as DownloadFileBatchOptions, m as I18nextMessage, mt as FileFormat, n as CreateTagOptions, nt as FileUpload, o as CutoffFormatOptions, p as HtmlContentPropValuesRecord, pt as BINARY_FILE_FORMATS, q as BranchQuery, r as CreateTagResult, s as DataFormat, t as Content, tt as PublishFilesResult, u as GetOrphanedFilesResult, v as JsxElement, vt as isBinaryFileFormat, w as StringFormat, wt as JsonObject, x as OrphanedFile, xt as CheckFileTranslationsOptions, y as LocaleProperties, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-
|
|
1
|
+
import { $ as DownloadFileOptions, A as InjectionType, At as GTParsingFlags, B as JobStatus, C as StringContent, D as TranslationRequestConfig, Dt as GTConfig, E as TranslateConfig, Et as JsonValue, F as SubmitUserEditDiffsPayload, Ft as TranslateManyEntry, G as FileDataQuery, H as MoveResult, I as AwaitJobsOptions, It as TranslateOptions, J as BranchDataResult, K as FileDataResult, L as AwaitJobsResult, M as TransformationPrefix, Mt as ActionType, N as VariableTransformationSuffix, Nt as EntryMetadata, O as Variable, Ot as GTFilesConfig, P as SubmitUserEditDiff, Q as TranslationResultReference, R as JobResult, S as RuntimeFileFormat, T as StringMessage, Tt as JsonPrimitive, U as ProcessMovesOptions, V as MoveMapping, W as ProcessMovesResponse, X as TranslationError, Y as TranslateManyResult, Z as TranslationResult, _ as JsxChildren, _t as FileToUpload, a as CustomRegionMapping, at as SetupProjectFileReference, b as Metadata, bt as Updates, c as FormatVariables, ct as EnqueueFilesOptions, d as HTML_CONTENT_PROPS, dt as DownloadFileBatchResult, et as PublishFileEntry, f as HtmlContentPropKeysRecord, ft as DownloadedFile, g as JsxChild, h as IcuMessage, ht as FileReference, i as CustomMapping, j as Transformation, jt as HashMetadata, k as VariableType, kt as GTOutputFileConfig, l as GTProp, lt as DownloadFileBatchOptions, m as I18nextMessage, mt as FileFormat, n as CreateTagOptions, nt as FileUpload, o as CutoffFormatOptions, p as HtmlContentPropValuesRecord, pt as BINARY_FILE_FORMATS, q as BranchQuery, r as CreateTagResult, s as DataFormat, t as Content, tt as PublishFilesResult, u as GetOrphanedFilesResult, v as JsxElement, vt as isBinaryFileFormat, w as StringFormat, wt as JsonObject, x as OrphanedFile, xt as CheckFileTranslationsOptions, y as LocaleProperties, yt as EnqueueFilesResult, z as CheckJobStatusResult } from "./types-Ix4SHG5H.mjs";
|
|
2
2
|
export { AwaitJobsOptions, AwaitJobsResult, BINARY_FILE_FORMATS, BranchDataResult, BranchQuery, CheckFileTranslationsOptions, CheckJobStatusResult, Content, CreateTagOptions, CreateTagResult, CustomMapping, CustomRegionMapping, CutoffFormatOptions, DataFormat, DownloadFileBatchOptions, DownloadFileBatchResult, DownloadFileOptions, DownloadedFile, EnqueueFilesOptions, EnqueueFilesResult, ActionType as EntryActionType, EntryMetadata, FileDataQuery, FileDataResult, FileFormat, FileReference, FileToUpload, FileUpload, FormatVariables, GTConfig, GTFilesConfig, GTOutputFileConfig, GTParsingFlags, GTProp, GetOrphanedFilesResult, HTML_CONTENT_PROPS, HashMetadata, HtmlContentPropKeysRecord, HtmlContentPropValuesRecord, I18nextMessage, IcuMessage, InjectionType, JobResult, JobStatus, JsonObject, JsonPrimitive, JsonValue, JsxChild, JsxChildren, JsxElement, LocaleProperties, Metadata, MoveMapping, MoveResult, OrphanedFile, ProcessMovesOptions, ProcessMovesResponse, PublishFileEntry, PublishFilesResult, RuntimeFileFormat, SetupProjectFileReference, StringContent, StringFormat, StringMessage, SubmitUserEditDiff, SubmitUserEditDiffsPayload, Transformation, TransformationPrefix, TranslateConfig, TranslateManyEntry, TranslateManyResult, TranslateOptions, TranslationError, TranslationRequestConfig, TranslationResult, TranslationResultReference, Updates, Variable, VariableTransformationSuffix, VariableType, isBinaryFileFormat };
|
package/dist/utils/minify.js
CHANGED
|
@@ -3,7 +3,7 @@ var VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES = {
|
|
|
3
3
|
number: 'n',
|
|
4
4
|
datetime: 'd',
|
|
5
5
|
currency: 'c',
|
|
6
|
-
|
|
6
|
+
relativetime: 'rt',
|
|
7
7
|
};
|
|
8
8
|
export function minifyVariableType(variableType) {
|
|
9
9
|
return VARIABLE_TRANSFORMATION_SUFFIXES_TO_MINIFIED_NAMES[variableType];
|