generaltranslation 8.2.11 → 8.2.13

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.
Files changed (264) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{IntlCache-k2qfrDqB.cjs → IntlCache-CAW8tKhd.cjs} +12 -12
  3. package/dist/IntlCache-CAW8tKhd.cjs.map +1 -0
  4. package/dist/{IntlCache-Ccg_cQPR.mjs → IntlCache-WZk0rKvj.mjs} +12 -12
  5. package/dist/IntlCache-WZk0rKvj.mjs.map +1 -0
  6. package/dist/LocaleConfig.d.ts +59 -0
  7. package/dist/LocaleConfig.js +225 -0
  8. package/dist/backwards-compatability/dataConversion.d.ts +23 -0
  9. package/dist/backwards-compatability/dataConversion.js +207 -0
  10. package/dist/backwards-compatability/oldHashJsxChildren.d.ts +23 -0
  11. package/dist/backwards-compatability/oldHashJsxChildren.js +79 -0
  12. package/dist/backwards-compatability/oldTypes.d.ts +21 -0
  13. package/dist/backwards-compatability/oldTypes.js +1 -0
  14. package/dist/backwards-compatability/typeChecking.d.ts +21 -0
  15. package/dist/backwards-compatability/typeChecking.js +61 -0
  16. package/dist/{base64-CUcEPEC5.cjs → base64-2fu94Klt.cjs} +3 -3
  17. package/dist/base64-2fu94Klt.cjs.map +1 -0
  18. package/dist/{base64-C1sogiix.mjs → base64-DH0STixb.mjs} +3 -3
  19. package/dist/base64-DH0STixb.mjs.map +1 -0
  20. package/dist/cache/IntlCache.d.ts +26 -0
  21. package/dist/cache/IntlCache.js +84 -0
  22. package/dist/cache/types.d.ts +32 -0
  23. package/dist/cache/types.js +1 -0
  24. package/dist/{core-3SOQ5ND6.cjs → core-7RP541eY.cjs} +18 -20
  25. package/dist/core-7RP541eY.cjs.map +1 -0
  26. package/dist/{core-6rY3oy32.d.cts → core-I9pWGafA.d.mts} +8 -8
  27. package/dist/{core-BYVWty_t.d.mts → core-TLJoDpJP.d.cts} +8 -8
  28. package/dist/{core-Bx0m6GOp.mjs → core-isLphYAZ.mjs} +18 -20
  29. package/dist/core-isLphYAZ.mjs.map +1 -0
  30. package/dist/core.cjs +1 -1
  31. package/dist/core.d.cts +1 -1
  32. package/dist/core.d.mts +1 -1
  33. package/dist/core.d.ts +128 -0
  34. package/dist/core.js +137 -0
  35. package/dist/core.mjs +1 -1
  36. package/dist/derive/condenseVars.d.ts +7 -0
  37. package/dist/derive/condenseVars.js +30 -0
  38. package/dist/derive/declareVar.d.ts +26 -0
  39. package/dist/derive/declareVar.js +38 -0
  40. package/dist/derive/decodeVars.d.ts +9 -0
  41. package/dist/derive/decodeVars.js +52 -0
  42. package/dist/derive/derive.d.ts +53 -0
  43. package/dist/derive/derive.js +55 -0
  44. package/dist/derive/extractVars.d.ts +9 -0
  45. package/dist/derive/extractVars.js +34 -0
  46. package/dist/derive/index.d.ts +7 -0
  47. package/dist/derive/index.js +7 -0
  48. package/dist/derive/indexVars.d.ts +6 -0
  49. package/dist/derive/indexVars.js +52 -0
  50. package/dist/derive/utils/constants.d.ts +2 -0
  51. package/dist/derive/utils/constants.js +2 -0
  52. package/dist/derive/utils/regex.d.ts +2 -0
  53. package/dist/derive/utils/regex.js +4 -0
  54. package/dist/derive/utils/sanitizeVar.d.ts +12 -0
  55. package/dist/derive/utils/sanitizeVar.js +38 -0
  56. package/dist/derive/utils/traverseHelpers.d.ts +4 -0
  57. package/dist/derive/utils/traverseHelpers.js +22 -0
  58. package/dist/derive/utils/traverseIcu.d.ts +20 -0
  59. package/dist/derive/utils/traverseIcu.js +49 -0
  60. package/dist/derive/utils/types.d.ts +23 -0
  61. package/dist/derive/utils/types.js +1 -0
  62. package/dist/errors/ApiError.d.ts +7 -0
  63. package/dist/errors/ApiError.js +33 -0
  64. package/dist/errors/formattingErrors.d.ts +1 -0
  65. package/dist/errors/formattingErrors.js +3 -0
  66. package/dist/errors.d.ts +1 -0
  67. package/dist/errors.js +1 -0
  68. package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +59 -0
  69. package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.js +147 -0
  70. package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +4 -0
  71. package/dist/formatting/custom-formats/CutoffFormat/constants.js +30 -0
  72. package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +48 -0
  73. package/dist/formatting/custom-formats/CutoffFormat/types.js +2 -0
  74. package/dist/formatting/format.d.ts +1 -0
  75. package/dist/formatting/format.js +257 -0
  76. package/dist/id/hashSource.d.ts +25 -0
  77. package/dist/id/hashSource.js +98 -0
  78. package/dist/id/hashTemplate.d.ts +4 -0
  79. package/dist/id/hashTemplate.js +6 -0
  80. package/dist/id/types.d.ts +7 -0
  81. package/dist/id/types.js +1 -0
  82. package/dist/{id-COlX5v3V.cjs → id-CyiXsQrY.cjs} +9 -9
  83. package/dist/id-CyiXsQrY.cjs.map +1 -0
  84. package/dist/{id-BmOyfaug.mjs → id-DbD7K-HL.mjs} +9 -9
  85. package/dist/id-DbD7K-HL.mjs.map +1 -0
  86. package/dist/id.cjs +1 -1
  87. package/dist/id.d.cts +9 -9
  88. package/dist/id.d.mts +9 -9
  89. package/dist/id.d.ts +3 -0
  90. package/dist/id.js +3 -0
  91. package/dist/id.mjs +1 -1
  92. package/dist/index.cjs +140 -140
  93. package/dist/index.cjs.map +1 -1
  94. package/dist/index.d.cts +88 -88
  95. package/dist/index.d.mts +88 -88
  96. package/dist/index.d.ts +1019 -0
  97. package/dist/index.js +1664 -0
  98. package/dist/index.mjs +140 -140
  99. package/dist/index.mjs.map +1 -1
  100. package/dist/internal.cjs +41 -26
  101. package/dist/internal.cjs.map +1 -1
  102. package/dist/internal.d.cts +38 -23
  103. package/dist/internal.d.mts +38 -23
  104. package/dist/internal.d.ts +19 -0
  105. package/dist/internal.js +17 -0
  106. package/dist/internal.mjs +41 -26
  107. package/dist/internal.mjs.map +1 -1
  108. package/dist/locales/customLocaleMapping.d.ts +11 -0
  109. package/dist/locales/customLocaleMapping.js +23 -0
  110. package/dist/locales/determineLocale.d.ts +1 -0
  111. package/dist/locales/determineLocale.js +72 -0
  112. package/dist/locales/getLocaleDirection.d.ts +1 -0
  113. package/dist/locales/getLocaleDirection.js +89 -0
  114. package/dist/locales/getLocaleEmoji.d.ts +2 -0
  115. package/dist/locales/getLocaleEmoji.js +319 -0
  116. package/dist/locales/getLocaleName.d.ts +1 -0
  117. package/dist/locales/getLocaleName.js +45 -0
  118. package/dist/locales/getLocaleProperties.d.ts +32 -0
  119. package/dist/locales/getLocaleProperties.js +220 -0
  120. package/dist/locales/getPluralForm.d.ts +9 -0
  121. package/dist/locales/getPluralForm.js +63 -0
  122. package/dist/locales/getRegionProperties.d.ts +7 -0
  123. package/dist/locales/getRegionProperties.js +61 -0
  124. package/dist/locales/isSameDialect.d.ts +1 -0
  125. package/dist/locales/isSameDialect.js +41 -0
  126. package/dist/locales/isSameLanguage.d.ts +1 -0
  127. package/dist/locales/isSameLanguage.js +20 -0
  128. package/dist/locales/isSupersetLocale.d.ts +1 -0
  129. package/dist/locales/isSupersetLocale.js +22 -0
  130. package/dist/locales/isValidLocale.d.ts +1 -0
  131. package/dist/locales/isValidLocale.js +75 -0
  132. package/dist/locales/requiresTranslation.d.ts +1 -0
  133. package/dist/locales/requiresTranslation.js +32 -0
  134. package/dist/locales/resolveAliasLocale.d.ts +8 -0
  135. package/dist/locales/resolveAliasLocale.js +21 -0
  136. package/dist/locales/resolveCanonicalLocale.d.ts +8 -0
  137. package/dist/locales/resolveCanonicalLocale.js +13 -0
  138. package/dist/logging/errors.d.ts +10 -0
  139. package/dist/logging/errors.js +29 -0
  140. package/dist/logging/logger.d.ts +121 -0
  141. package/dist/logging/logger.js +259 -0
  142. package/dist/logging/warnings.d.ts +2 -0
  143. package/dist/logging/warnings.js +2 -0
  144. package/dist/projects/getProjectData.d.ts +1 -0
  145. package/dist/projects/getProjectData.js +87 -0
  146. package/dist/settings/plurals.d.ts +3 -0
  147. package/dist/settings/plurals.js +14 -0
  148. package/dist/settings/settings.d.ts +2 -0
  149. package/dist/settings/settings.js +2 -0
  150. package/dist/settings/settingsUrls.d.ts +3 -0
  151. package/dist/settings/settingsUrls.js +3 -0
  152. package/dist/translate/api.d.ts +1 -0
  153. package/dist/translate/api.js +1 -0
  154. package/dist/translate/awaitJobs.d.ts +19 -0
  155. package/dist/translate/awaitJobs.js +112 -0
  156. package/dist/translate/checkJobStatus.d.ts +8 -0
  157. package/dist/translate/checkJobStatus.js +55 -0
  158. package/dist/translate/createBranch.d.ts +10 -0
  159. package/dist/translate/createBranch.js +53 -0
  160. package/dist/translate/createTag.d.ts +19 -0
  161. package/dist/translate/createTag.js +67 -0
  162. package/dist/translate/downloadFileBatch.d.ts +1 -0
  163. package/dist/translate/downloadFileBatch.js +77 -0
  164. package/dist/translate/enqueueFiles.d.ts +8 -0
  165. package/dist/translate/enqueueFiles.js +96 -0
  166. package/dist/translate/getOrphanedFiles.d.ts +8 -0
  167. package/dist/translate/getOrphanedFiles.js +97 -0
  168. package/dist/translate/processFileMoves.d.ts +25 -0
  169. package/dist/translate/processFileMoves.js +90 -0
  170. package/dist/translate/publishFiles.d.ts +17 -0
  171. package/dist/translate/publishFiles.js +56 -0
  172. package/dist/translate/queryBranchData.d.ts +3 -0
  173. package/dist/translate/queryBranchData.js +53 -0
  174. package/dist/translate/queryFileData.d.ts +42 -0
  175. package/dist/translate/queryFileData.js +71 -0
  176. package/dist/translate/querySourceFile.d.ts +1 -0
  177. package/dist/translate/querySourceFile.js +67 -0
  178. package/dist/translate/setupProject.d.ts +11 -0
  179. package/dist/translate/setupProject.js +63 -0
  180. package/dist/translate/submitUserEditDiffs.d.ts +12 -0
  181. package/dist/translate/submitUserEditDiffs.js +68 -0
  182. package/dist/translate/translateMany.d.ts +1 -0
  183. package/dist/translate/translateMany.js +103 -0
  184. package/dist/translate/uploadSourceFiles.d.ts +1 -0
  185. package/dist/translate/uploadSourceFiles.js +87 -0
  186. package/dist/translate/uploadTranslations.d.ts +1 -0
  187. package/dist/translate/uploadTranslations.js +101 -0
  188. package/dist/translate/utils/apiRequest.d.ts +1 -0
  189. package/dist/translate/utils/apiRequest.js +130 -0
  190. package/dist/translate/utils/batch.d.ts +52 -0
  191. package/dist/translate/utils/batch.js +126 -0
  192. package/dist/translate/utils/fetchWithTimeout.d.ts +1 -0
  193. package/dist/translate/utils/fetchWithTimeout.js +93 -0
  194. package/dist/translate/utils/generateRequestHeaders.d.ts +2 -0
  195. package/dist/translate/utils/generateRequestHeaders.js +26 -0
  196. package/dist/translate/utils/handleFetchError.d.ts +1 -0
  197. package/dist/translate/utils/handleFetchError.js +12 -0
  198. package/dist/translate/utils/validateFileFormatTransform.d.ts +16 -0
  199. package/dist/translate/utils/validateFileFormatTransform.js +29 -0
  200. package/dist/translate/utils/validateResponse.d.ts +1 -0
  201. package/dist/translate/utils/validateResponse.js +72 -0
  202. package/dist/{types-Cy8q2XZX.d.mts → types-AHtYZIP-.d.mts} +63 -40
  203. package/dist/{types-NKhpChvT.d.cts → types-Bf8_Apq_.d.cts} +63 -40
  204. package/dist/types-dir/api/branch.d.ts +10 -0
  205. package/dist/types-dir/api/branch.js +1 -0
  206. package/dist/types-dir/api/checkFileTranslations.d.ts +37 -0
  207. package/dist/types-dir/api/checkFileTranslations.js +1 -0
  208. package/dist/types-dir/api/downloadFile.d.ts +3 -0
  209. package/dist/types-dir/api/downloadFile.js +1 -0
  210. package/dist/types-dir/api/downloadFileBatch.d.ts +35 -0
  211. package/dist/types-dir/api/downloadFileBatch.js +1 -0
  212. package/dist/types-dir/api/enqueueEntries.d.ts +21 -0
  213. package/dist/types-dir/api/enqueueEntries.js +1 -0
  214. package/dist/types-dir/api/enqueueFiles.d.ts +70 -0
  215. package/dist/types-dir/api/enqueueFiles.js +1 -0
  216. package/dist/types-dir/api/entry.d.ts +39 -0
  217. package/dist/types-dir/api/entry.js +1 -0
  218. package/dist/types-dir/api/fetchTranslations.d.ts +12 -0
  219. package/dist/types-dir/api/fetchTranslations.js +1 -0
  220. package/dist/types-dir/api/file.d.ts +57 -0
  221. package/dist/types-dir/api/file.js +1 -0
  222. package/dist/types-dir/api/json.d.ts +5 -0
  223. package/dist/types-dir/api/json.js +1 -0
  224. package/dist/types-dir/api/project.d.ts +7 -0
  225. package/dist/types-dir/api/project.js +1 -0
  226. package/dist/types-dir/api/translate.d.ts +34 -0
  227. package/dist/types-dir/api/translate.js +1 -0
  228. package/dist/types-dir/api/translateMany.d.ts +5 -0
  229. package/dist/types-dir/api/translateMany.js +1 -0
  230. package/dist/types-dir/api/translationStatus.d.ts +9 -0
  231. package/dist/types-dir/api/translationStatus.js +1 -0
  232. package/dist/types-dir/api/uploadFiles.d.ts +44 -0
  233. package/dist/types-dir/api/uploadFiles.js +1 -0
  234. package/dist/types-dir/jsx/content.d.ts +61 -0
  235. package/dist/types-dir/jsx/content.js +11 -0
  236. package/dist/types-dir/jsx/variables.d.ts +9 -0
  237. package/dist/types-dir/jsx/variables.js +1 -0
  238. package/dist/types-dir/transformations.d.ts +8 -0
  239. package/dist/types-dir/transformations.js +1 -0
  240. package/dist/types.cjs.map +1 -1
  241. package/dist/types.d.cts +2 -2
  242. package/dist/types.d.mts +2 -2
  243. package/dist/types.d.ts +129 -0
  244. package/dist/types.js +2 -0
  245. package/dist/types.mjs.map +1 -1
  246. package/dist/utils/base64.d.ts +2 -0
  247. package/dist/utils/base64.js +28 -0
  248. package/dist/utils/isSupportedFileFormatTransform.d.ts +8 -0
  249. package/dist/utils/isSupportedFileFormatTransform.js +26 -0
  250. package/dist/utils/isVariable.d.ts +2 -0
  251. package/dist/utils/isVariable.js +22 -0
  252. package/dist/utils/minify.d.ts +2 -0
  253. package/dist/utils/minify.js +10 -0
  254. package/dist/utils/stableStringify.d.ts +1 -0
  255. package/dist/utils/stableStringify.js +40 -0
  256. package/package.json +5 -6
  257. package/dist/IntlCache-Ccg_cQPR.mjs.map +0 -1
  258. package/dist/IntlCache-k2qfrDqB.cjs.map +0 -1
  259. package/dist/base64-C1sogiix.mjs.map +0 -1
  260. package/dist/base64-CUcEPEC5.cjs.map +0 -1
  261. package/dist/core-3SOQ5ND6.cjs.map +0 -1
  262. package/dist/core-Bx0m6GOp.mjs.map +0 -1
  263. package/dist/id-BmOyfaug.mjs.map +0 -1
  264. package/dist/id-COlX5v3V.cjs.map +0 -1
@@ -0,0 +1,1019 @@
1
+ import { CustomMapping, FormatVariables, TranslateManyResult, TranslationError, TranslationResult, EnqueueFilesResult, CheckFileTranslationsOptions, DownloadFileBatchOptions, DownloadFileBatchResult, DownloadFileOptions, TranslateManyEntry } from './types';
2
+ import { LocaleProperties } from './locales/getLocaleProperties';
3
+ import { SetupProjectResult, SetupProjectOptions } from './translate/setupProject';
4
+ import { EnqueueOptions } from './translate/enqueueFiles';
5
+ import { CreateTagOptions, CreateTagResult } from './translate/createTag';
6
+ import { FileQuery, FileQueryResult } from './types-dir/api/checkFileTranslations';
7
+ import { SubmitUserEditDiffsPayload } from './translate/submitUserEditDiffs';
8
+ import { CustomRegionMapping } from './locales/getRegionProperties';
9
+ import { FileUpload, UploadFilesOptions, UploadFilesResponse } from './types-dir/api/uploadFiles';
10
+ import { ProjectData } from './types-dir/api/project';
11
+ import { DownloadFileBatchRequest } from './types-dir/api/downloadFileBatch';
12
+ import { CheckJobStatusResult } from './translate/checkJobStatus';
13
+ import { AwaitJobsOptions, AwaitJobsResult } from './translate/awaitJobs';
14
+ import type { FileDataQuery, FileDataResult } from './translate/queryFileData';
15
+ import type { BranchQuery } from './translate/queryBranchData';
16
+ import type { BranchDataResult } from './types-dir/api/branch';
17
+ import type { CreateBranchQuery, CreateBranchResult } from './translate/createBranch';
18
+ import type { FileReference, FileReferenceIds } from './types-dir/api/file';
19
+ import { type MoveMapping, type ProcessMovesResponse, type ProcessMovesOptions } from './translate/processFileMoves';
20
+ import { type GetOrphanedFilesResult } from './translate/getOrphanedFiles';
21
+ import { type PublishFileEntry, type PublishFilesResult } from './translate/publishFiles';
22
+ import { CutoffFormatOptions } from './formatting/custom-formats/CutoffFormat/types';
23
+ import { TranslateOptions } from './types-dir/api/entry';
24
+ import { StringFormat } from './types-dir/jsx/content';
25
+ import { LocaleConfig } from './LocaleConfig';
26
+ export { LocaleConfig, type LocaleConfigConstructorParams, } from './LocaleConfig';
27
+ export { formatCutoff, formatMessage, isValidLocale, resolveCanonicalLocale, standardizeLocale, } from './core';
28
+ /**
29
+ * Type representing the constructor parameters for the GT class.
30
+ * @typedef {Object} GTConstructorParams
31
+ * @property {string} [apiKey] - The API key for accessing the translation service
32
+ * @property {string} [devApiKey] - The development API key for accessing the translation service
33
+ * @property {string} [sourceLocale] - The default source locale for translations
34
+ * @property {string} [targetLocale] - The default target locale for translations
35
+ * @property {string[]} [locales] - Array of supported locales
36
+ * @property {string} [projectId] - The project ID for the translation service
37
+ * @property {string} [baseUrl] - The base URL for the translation service
38
+ * @property {CustomMapping} [customMapping] - Custom mapping of locale codes to their names
39
+ */
40
+ type GTConstructorParams = {
41
+ apiKey?: string;
42
+ devApiKey?: string;
43
+ sourceLocale?: string;
44
+ targetLocale?: string;
45
+ locales?: string[];
46
+ projectId?: string;
47
+ baseUrl?: string;
48
+ customMapping?: CustomMapping;
49
+ };
50
+ /**
51
+ * GT is the core driver for the General Translation library.
52
+ * This class provides functionality for locale management, formatting, and translation operations.
53
+ *
54
+ * @class GT
55
+ * @description A comprehensive toolkit for handling internationalization and localization.
56
+ *
57
+ * @example
58
+ * const gt = new GT({
59
+ * sourceLocale: 'en-US',
60
+ * targetLocale: 'es-ES',
61
+ * locales: ['en-US', 'es-ES', 'fr-FR']
62
+ * });
63
+ */
64
+ export declare class GT {
65
+ /** Base URL for the translation service API */
66
+ baseUrl?: string;
67
+ /** Project ID for the translation service */
68
+ projectId?: string;
69
+ /** API key for accessing the translation service */
70
+ apiKey?: string;
71
+ /** Development API key for accessing the translation service */
72
+ devApiKey?: string;
73
+ /** Source locale for translations */
74
+ sourceLocale?: string;
75
+ /** Target locale for translations */
76
+ targetLocale?: string;
77
+ /** Array of supported locales */
78
+ locales?: string[];
79
+ /** Custom mapping for locale codes to their names */
80
+ customMapping?: CustomMapping;
81
+ /** Lazily derived reverse custom mapping for alias locales */
82
+ reverseCustomMapping?: Record<string, string>;
83
+ /** Lazily derived custom mapping for regions */
84
+ customRegionMapping?: CustomRegionMapping;
85
+ /** Runtime-safe locale and formatting helpers (backing field) */
86
+ private _localeConfig;
87
+ /** Runtime-safe locale and formatting helpers */
88
+ get localeConfig(): LocaleConfig;
89
+ /**
90
+ * Constructs an instance of the GT class.
91
+ *
92
+ * @param {GTConstructorParams} [params] - The parameters for initializing the GT instance
93
+ * @throws {Error} If an invalid locale is provided
94
+ * @throws {Error} If any of the provided locales are invalid
95
+ *
96
+ * @example
97
+ * const gt = new GT({
98
+ * apiKey: 'your-api-key',
99
+ * sourceLocale: 'en-US',
100
+ * targetLocale: 'es-ES',
101
+ * locales: ['en-US', 'es-ES', 'fr-FR']
102
+ * });
103
+ */
104
+ constructor(params?: GTConstructorParams);
105
+ setConfig({ apiKey, devApiKey, sourceLocale, targetLocale, locales, projectId, customMapping, baseUrl, }: GTConstructorParams): void;
106
+ private _getTranslationConfig;
107
+ private _validateAuth;
108
+ /**
109
+ * Queries branch information from the API.
110
+ *
111
+ * @param {BranchQuery} query - Object mapping the current branch and incoming branches
112
+ * @returns {Promise<BranchDataResult>} The branch information.
113
+ */
114
+ queryBranchData(query: BranchQuery): Promise<BranchDataResult>;
115
+ /**
116
+ * Creates a new branch in the API. If the branch already exists, it will be returned.
117
+ *
118
+ * @param {CreateBranchQuery} query - Object mapping the branch name and default branch flag
119
+ * @returns {Promise<CreateBranchResult>} The created branch information.
120
+ */
121
+ createBranch(query: CreateBranchQuery): Promise<CreateBranchResult>;
122
+ /**
123
+ * Processes file moves by cloning source files and translations with new fileIds.
124
+ * This is called when files have been moved/renamed and we want to preserve translations.
125
+ *
126
+ * @param {MoveMapping[]} moves - Array of move mappings (old fileId to new fileId)
127
+ * @param {ProcessMovesOptions} options - Options including branchId and timeout
128
+ * @returns {Promise<ProcessMovesResponse>} The move processing results.
129
+ *
130
+ * @example
131
+ * const result = await gt.processFileMoves([
132
+ * { oldFileId: 'abc123', newFileId: 'def456', newFileName: 'locales/en.json' }
133
+ * ], { branchId: 'main' });
134
+ */
135
+ processFileMoves(moves: MoveMapping[], options?: ProcessMovesOptions): Promise<ProcessMovesResponse>;
136
+ /**
137
+ * Gets orphaned files for a branch - files that exist on the branch
138
+ * but whose fileIds are not in the provided list.
139
+ * Used for move detection.
140
+ *
141
+ * @param {string} branchId - The branch to check for orphaned files.
142
+ * @param {string[]} fileIds - List of current file IDs (files that are NOT orphaned)
143
+ * @param {Object} options - Options including timeout.
144
+ * @returns {Promise<GetOrphanedFilesResult>} The orphaned files.
145
+ *
146
+ * @example
147
+ * const result = await gt.getOrphanedFiles('branch-id', ['file-1', 'file-2']);
148
+ */
149
+ getOrphanedFiles(branchId: string, fileIds: string[], options?: {
150
+ timeout?: number;
151
+ }): Promise<GetOrphanedFilesResult>;
152
+ /**
153
+ * Enqueues project setup job using the specified file references
154
+ *
155
+ * This method creates setup jobs that will process source file references
156
+ * and generate a project setup. The files parameter contains references (IDs) to source
157
+ * files that have already been uploaded via uploadSourceFiles. The setup jobs are queued
158
+ * for processing and will generate a project setup based on the source files.
159
+ *
160
+ * @param {FileReference[]} files - Array of file references containing IDs of previously uploaded source files
161
+ * @param {SetupProjectOptions} [options] - Optional settings for target locales and timeout.
162
+ * @returns {Promise<SetupProjectResult>} Object containing the jobId and status
163
+ */
164
+ setupProject(files: FileReference[], options?: SetupProjectOptions): Promise<SetupProjectResult>;
165
+ /**
166
+ * Checks the current status of one or more project jobs by their unique identifiers.
167
+ *
168
+ * This method polls the API to determine whether one or more jobs are still running,
169
+ * have completed successfully, or have failed. Jobs are created after calling either enqueueFiles or setupProject.
170
+ *
171
+ * @param {string[]} jobIds - The unique identifiers of the jobs to check.
172
+ * @param {number} [timeoutMs] - Optional timeout in milliseconds for the API request.
173
+ * @returns {Promise<CheckJobStatusResult>} Object containing the job status.
174
+ *
175
+ * @example
176
+ * const result = await gt.checkJobStatus([
177
+ * 'job-123',
178
+ * 'job-456',
179
+ * ], {
180
+ * timeout: 10000,
181
+ * });
182
+ */
183
+ checkJobStatus(jobIds: string[], timeoutMs?: number): Promise<CheckJobStatusResult>;
184
+ /**
185
+ * Polls job statuses until all jobs from enqueueFiles are finished or the timeout is reached.
186
+ *
187
+ * @param {EnqueueFilesResult} enqueueResult - The result returned from enqueueFiles.
188
+ * @param {AwaitJobsOptions} [options] - Polling configuration (interval, timeout).
189
+ * @returns {Promise<AwaitJobsResult>} The final status of all jobs and whether they all completed.
190
+ */
191
+ awaitJobs(enqueueResult: EnqueueFilesResult, options?: AwaitJobsOptions): Promise<AwaitJobsResult>;
192
+ /**
193
+ * Enqueues translation jobs for previously uploaded source files.
194
+ *
195
+ * This method creates translation jobs that will process existing source files
196
+ * and generate translations in the specified target languages. The files parameter
197
+ * contains references (IDs) to source files that have already been uploaded via
198
+ * uploadSourceFiles. The translation jobs are queued for processing and will
199
+ * generate translated content based on the source files and target locales provided.
200
+ *
201
+ * @param {FileReferenceIds[]} files - Array of file references containing IDs of previously uploaded source files
202
+ * @param {EnqueueOptions} options - Configuration options including source locale, target locales, and job settings.
203
+ * @returns {Promise<EnqueueFilesResult>} Result containing job IDs, queue status, and processing information.
204
+ */
205
+ enqueueFiles(files: FileReferenceIds[], options: EnqueueOptions): Promise<EnqueueFilesResult>;
206
+ /**
207
+ * Creates or upserts a file tag, associating a set of source files
208
+ * with a user-defined tag ID and optional message.
209
+ *
210
+ * @param {CreateTagOptions} options - Tag creation options including tagId, sourceFileIds, and optional message
211
+ * @returns {Promise<CreateTagResult>} The created or updated tag.
212
+ */
213
+ createTag(options: CreateTagOptions): Promise<CreateTagResult>;
214
+ /**
215
+ * Publishes or unpublishes files on the CDN.
216
+ *
217
+ * @param {PublishFileEntry[]} files - Array of file entries with publish flags
218
+ * @returns {Promise<PublishFilesResult>} Result containing per-file success/failure
219
+ */
220
+ publishFiles(files: PublishFileEntry[]): Promise<PublishFilesResult>;
221
+ /**
222
+ * Submits user edit diffs for existing translations so future generations preserve user intent.
223
+ *
224
+ * @param {SubmitUserEditDiffsPayload} payload - Project-scoped diff payload.
225
+ * @returns {Promise<void>} Resolves when submission succeeds.
226
+ */
227
+ submitUserEditDiffs(payload: SubmitUserEditDiffsPayload): Promise<void>;
228
+ /**
229
+ * Queries data about one or more source or translation files.
230
+ *
231
+ * @param {FileDataQuery} data - Object mapping source and translation file information.
232
+ * @param {CheckFileTranslationsOptions} options - Options for the API call.
233
+ * @returns {Promise<FileDataResult>} The source and translation file data information.
234
+ *
235
+ * @example
236
+ * const result = await gt.queryFileData({
237
+ * sourceFiles: [
238
+ * { fileId: '1234567890', versionId: '1234567890', branchId: '1234567890' },
239
+ * ],
240
+ * translatedFiles: [
241
+ * { fileId: '1234567890', versionId: '1234567890', branchId: '1234567890', locale: 'es-ES' },
242
+ * ],
243
+ * }, {
244
+ * timeout: 10000,
245
+ * });
246
+ *
247
+ */
248
+ queryFileData(data: FileDataQuery, options?: CheckFileTranslationsOptions): Promise<FileDataResult>;
249
+ /**
250
+ * Gets source and translation information for a given file ID and version ID.
251
+ *
252
+ * @param {FileQuery} data - File query containing file ID and version ID.
253
+ * @param {CheckFileTranslationsOptions} options - Options for getting source and translation information.
254
+ * @returns {Promise<FileQueryResult>} The source file and translation information.
255
+ *
256
+ * @example
257
+ * const result = await gt.querySourceFile(
258
+ * { fileId: '1234567890', versionId: '1234567890' },
259
+ * { timeout: 10000 }
260
+ * );
261
+ *
262
+ */
263
+ querySourceFile(data: FileQuery, options?: CheckFileTranslationsOptions): Promise<FileQueryResult>;
264
+ /**
265
+ * Get project data for a given project ID.
266
+ *
267
+ * @param {string} projectId - The ID of the project to get the data for.
268
+ * @returns {Promise<ProjectData>} The project data.
269
+ *
270
+ * @example
271
+ * const result = await gt.getProjectData(
272
+ * '1234567890'
273
+ * );
274
+ *
275
+ */
276
+ getProjectData(projectId: string, options?: {
277
+ timeout?: number;
278
+ }): Promise<ProjectData>;
279
+ /**
280
+ * Downloads a single file.
281
+ *
282
+ * @param file - The file query object.
283
+ * @param {string} file.fileId - The ID of the file to download.
284
+ * @param {string} [file.branchId] - The ID of the branch to download the file from. If not provided, the default branch will be used.
285
+ * @param {string} [file.locale] - The locale to download the file for. If not provided, the source file will be downloaded.
286
+ * @param {string} [file.versionId] - The version ID to download the file from. If not provided, the latest version will be used.
287
+ * @param {DownloadFileOptions} options - Options for downloading the file.
288
+ * @returns {Promise<string>} The downloaded file content.
289
+ *
290
+ * @example
291
+ * const result = await gt.downloadFile({
292
+ * fileId: '1234567890',
293
+ * branchId: '1234567890',
294
+ * locale: 'es-ES',
295
+ * versionId: '1234567890',
296
+ * }, {
297
+ * timeout: 10000,
298
+ * });
299
+ */
300
+ downloadFile(file: {
301
+ fileId: string;
302
+ branchId?: string;
303
+ locale?: string;
304
+ versionId?: string;
305
+ useLatestAvailableVersion?: boolean;
306
+ }, options?: DownloadFileOptions): Promise<string>;
307
+ /**
308
+ * Downloads multiple files in a batch.
309
+ *
310
+ * @param {DownloadFileBatchRequest} requests - Array of file query objects to download.
311
+ * @param {DownloadFileBatchOptions} options - Options for the batch download.
312
+ * @returns {Promise<DownloadFileBatchResult>} The batch download results.
313
+ *
314
+ * @example
315
+ * const result = await gt.downloadFileBatch([{
316
+ * fileId: '1234567890',
317
+ * locale: 'es-ES',
318
+ * versionId: '1234567890',
319
+ * }], {
320
+ * timeout: 10000,
321
+ * });
322
+ */
323
+ downloadFileBatch(requests: DownloadFileBatchRequest, options?: DownloadFileBatchOptions): Promise<DownloadFileBatchResult>;
324
+ /**
325
+ * Translates a single source string to the target locale.
326
+ * Routes through {@link translateMany} under the hood.
327
+ *
328
+ * @param {string} source - The source string to translate.
329
+ * @param {object} options - Translation options including targetLocale and optional entry metadata.
330
+ * @returns {Promise<TranslationResult | TranslationError>} The translated content.
331
+ *
332
+ * @example
333
+ * const result = await gt.translate('Hello, world!', { targetLocale: 'es' });
334
+ *
335
+ * @example
336
+ * const result = await gt.translate('Hello, world!', {
337
+ * targetLocale: 'es',
338
+ * dataFormat: 'ICU',
339
+ * context: 'A formal greeting',
340
+ * });
341
+ */
342
+ translate(source: TranslateManyEntry, options: string | TranslateOptions, timeout?: number): Promise<TranslationResult | TranslationError>;
343
+ /**
344
+ * Translates multiple source strings to the target locale.
345
+ * Each entry can be a plain string or an object with source and metadata fields.
346
+ *
347
+ * @param {TranslateManyEntry[] | Record<string, TranslateManyEntry>} sources - The source entries to translate. Can be an array or a record keyed by hash.
348
+ * @param {object} options - Translation options including targetLocale.
349
+ * @returns {Promise<TranslateManyResult | Record<string, TranslationResult>>} The translated contents. An array if sources was an array, a record if sources was a record.
350
+ *
351
+ * @example
352
+ * const result = await gt.translateMany(
353
+ * ['Hello, world!', 'Goodbye, world!'],
354
+ * { targetLocale: 'es' }
355
+ * );
356
+ *
357
+ * @example
358
+ * const result = await gt.translateMany(
359
+ * [{ source: 'Hello, world!', dataFormat: 'ICU' }],
360
+ * { targetLocale: 'es' }
361
+ * );
362
+ *
363
+ * @example
364
+ * const result = await gt.translateMany(
365
+ * { 'my-hash': 'Hello, world!' },
366
+ * { targetLocale: 'es' }
367
+ * );
368
+ */
369
+ translateMany(sources: TranslateManyEntry[], options: string | TranslateOptions, timeout?: number): Promise<TranslateManyResult>;
370
+ translateMany(sources: Record<string, TranslateManyEntry>, options: string | TranslateOptions, timeout?: number): Promise<Record<string, TranslationResult>>;
371
+ /**
372
+ * Uploads source files to the translation service without any translation content.
373
+ *
374
+ * This method creates or replaces source file entries in your project. Each uploaded
375
+ * file becomes a source that can later be translated into target languages. The files
376
+ * are processed and stored as base entries that serve as the foundation for generating
377
+ * translations through the translation workflow.
378
+ *
379
+ * @param {Array<{source: FileUpload}>} files - Array of objects containing source file data to upload
380
+ * @param {UploadFilesOptions} options - Configuration options including source locale and other upload settings.
381
+ * @returns {Promise<UploadFilesResponse>} Upload result containing file IDs, version information, and upload status.
382
+ */
383
+ uploadSourceFiles(files: {
384
+ source: FileUpload;
385
+ }[], options: UploadFilesOptions): Promise<UploadFilesResponse>;
386
+ /**
387
+ * Uploads translation files that correspond to previously uploaded source files.
388
+ *
389
+ * This method allows you to provide translated content for existing source files in your project.
390
+ * Each translation must reference an existing source file and include the translated content
391
+ * along with the target locale information. This is used when you have pre-existing translations
392
+ * that you want to upload directly rather than generating them through the translation service.
393
+ *
394
+ * @param {Array<{source: FileUpload, translations: FileUpload[]}>} files - Array of file objects where:
395
+ * - `source`: Reference to the existing source file (contains IDs but no content).
396
+ * - `translations`: Array of translated files, each containing content, locale, and reference IDs
397
+ * @param {UploadFilesOptions} options - Configuration options including source locale and upload settings.
398
+ * @returns {Promise<UploadFilesResponse>} Upload result containing translation IDs, status, and processing information.
399
+ */
400
+ uploadTranslations(files: {
401
+ source: FileUpload;
402
+ translations: FileUpload[];
403
+ }[], options: UploadFilesOptions): Promise<UploadFilesResponse>;
404
+ /**
405
+ * Formats a string with cutoff behavior, applying a terminator when the string exceeds the maximum character limit.
406
+ *
407
+ * This method uses the GT instance's rendering locales by default for locale-specific terminator selection,
408
+ * but can be overridden with custom locales in the options.
409
+ *
410
+ * @param {string} value - The string value to format with cutoff behavior.
411
+ * @param {Object} [options] - Configuration options for cutoff formatting.
412
+ * @param {string | string[]} [options.locales] - The locales to use for terminator selection. Defaults to instance's rendering locales.
413
+ * @param {number} [options.maxChars] - The maximum number of characters to display.
414
+ * - Undefined values are treated as no cutoff.
415
+ * - Negative values follow .slice() behavior and terminator will be added before the value.
416
+ * - 0 will result in an empty string.
417
+ * - If cutoff results in an empty string, no terminator is added.
418
+ * @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.
419
+ * @param {string} [options.terminator] - Optional override the terminator to use.
420
+ * @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.
421
+ * - If no terminator is provided, then separator is ignored.
422
+ * @returns {string} The formatted string with terminator applied if cutoff occurs.
423
+ *
424
+ * @example
425
+ * const gt = new GT({ targetLocale: 'en-US' });
426
+ * gt.formatCutoff('Hello, world!', { maxChars: 8 });
427
+ * // Returns: 'Hello, w...'
428
+ *
429
+ * @example
430
+ * gt.formatCutoff('Hello, world!', { maxChars: -3 });
431
+ * // Returns: '...ld!'
432
+ */
433
+ formatCutoff(value: string, options?: {
434
+ locales?: string | string[];
435
+ } & CutoffFormatOptions): string;
436
+ /**
437
+ * Formats a message according to the specified locales and options.
438
+ *
439
+ * @param {string} message - The message to format.
440
+ * @param {string | string[]} [locales='en'] - The locales to use for formatting.
441
+ * @param {FormatVariables} [variables={}] - The variables to use for formatting.
442
+ * @param {StringFormat} [dataFormat='ICU'] - The format of the message.
443
+ * @returns {string} The formatted message.
444
+ *
445
+ * @example
446
+ * gt.formatMessage('Hello {name}', { name: 'John' });
447
+ * // Returns: "Hello John"
448
+ *
449
+ * gt.formatMessage('Hello {name}', { name: 'John' }, { locales: ['fr'] });
450
+ * // Returns: "Bonjour John"
451
+ */
452
+ formatMessage(message: string, options?: {
453
+ locales?: string | string[];
454
+ variables?: FormatVariables;
455
+ dataFormat?: StringFormat;
456
+ }): string;
457
+ /**
458
+ * Formats a number according to the specified locales and options.
459
+ *
460
+ * @param {number} number - The number to format.
461
+ * @param {Object} [options] - Additional options for number formatting.
462
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
463
+ * @param {Intl.NumberFormatOptions} [options] - Additional Intl.NumberFormat options.
464
+ * @returns {string} The formatted number.
465
+ *
466
+ * @example
467
+ * gt.formatNum(1234.56, { style: 'currency', currency: 'USD' });
468
+ * // Returns: "$1,234.56"
469
+ */
470
+ formatNum(number: number, options?: {
471
+ locales?: string | string[];
472
+ } & Intl.NumberFormatOptions): string;
473
+ /**
474
+ * Formats a date according to the specified locales and options.
475
+ *
476
+ * @param {Date} date - The date to format.
477
+ * @param {Object} [options] - Additional options for date formatting.
478
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
479
+ * @param {Intl.DateTimeFormatOptions} [options] - Additional Intl.DateTimeFormat options.
480
+ * @returns {string} The formatted date.
481
+ *
482
+ * @example
483
+ * gt.formatDateTime(new Date(), { dateStyle: 'full', timeStyle: 'long' });
484
+ * // Returns: "Thursday, March 14, 2024 at 2:30:45 PM GMT-7"
485
+ */
486
+ formatDateTime(date: Date, options?: {
487
+ locales?: string | string[];
488
+ } & Intl.DateTimeFormatOptions): string;
489
+ /**
490
+ * Formats a currency value according to the specified locales and options.
491
+ *
492
+ * @param {number} value - The currency value to format.
493
+ * @param {string} currency - The currency code (e.g., 'USD', 'EUR')
494
+ * @param {Object} [options] - Additional options for currency formatting.
495
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
496
+ * @param {Intl.NumberFormatOptions} [options] - Additional Intl.NumberFormat options.
497
+ * @returns {string} The formatted currency value.
498
+ *
499
+ * @example
500
+ * gt.formatCurrency(1234.56, 'USD', { style: 'currency' });
501
+ * // Returns: "$1,234.56"
502
+ */
503
+ formatCurrency(value: number, currency: string, options?: {
504
+ locales?: string | string[];
505
+ } & Intl.NumberFormatOptions): string;
506
+ /**
507
+ * Formats a list of items according to the specified locales and options.
508
+ *
509
+ * @param {Array<string | number>} array - The list of items to format.
510
+ * @param {Object} [options] - Additional options for list formatting.
511
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
512
+ * @param {Intl.ListFormatOptions} [options] - Additional Intl.ListFormat options.
513
+ * @returns {string} The formatted list.
514
+ *
515
+ * @example
516
+ * gt.formatList(['apple', 'banana', 'orange'], { type: 'conjunction' });
517
+ * // Returns: "apple, banana, and orange"
518
+ */
519
+ formatList(array: Array<string | number>, options?: {
520
+ locales?: string | string[];
521
+ } & Intl.ListFormatOptions): string;
522
+ /**
523
+ * Formats a list of items according to the specified locales and options.
524
+ * @param {Array<T>} array - The list of items to format.
525
+ * @param {Object} [options] - Additional options for list formatting.
526
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
527
+ * @param {Intl.ListFormatOptions} [options] - Additional Intl.ListFormat options.
528
+ * @returns {Array<T | string>} The formatted list parts.
529
+ *
530
+ * @example
531
+ * gt.formatListToParts(['apple', 42, { foo: 'bar' }], { type: 'conjunction', style: 'short', locales: ['en'] });
532
+ * // Returns: ['apple', ', ', 42, ' and ', '{ foo: "bar" }']
533
+ */
534
+ formatListToParts<T>(array: Array<T>, options?: {
535
+ locales?: string | string[];
536
+ } & Intl.ListFormatOptions): Array<T | string>;
537
+ /**
538
+ * Formats a relative time value according to the specified locales and options.
539
+ *
540
+ * @param {number} value - The relative time value to format.
541
+ * @param {Intl.RelativeTimeFormatUnit} unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year')
542
+ * @param {Object} options - Additional options for relative time formatting.
543
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
544
+ * @param {Intl.RelativeTimeFormatOptions} [options] - Additional Intl.RelativeTimeFormat options.
545
+ * @returns {string} The formatted relative time string.
546
+ *
547
+ * @example
548
+ * gt.formatRelativeTime(-1, 'day', { locales: ['en-US'], numeric: 'auto' });
549
+ * // Returns: "yesterday"
550
+ */
551
+ formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, options?: {
552
+ locales?: string | string[];
553
+ } & Omit<Intl.RelativeTimeFormatOptions, 'locales'>): string;
554
+ /**
555
+ * Formats a relative time string from a Date, automatically selecting the best unit.
556
+ *
557
+ * @param {Date} date - The date to format relative to now.
558
+ * @param {Object} [options] - Additional options for relative time formatting.
559
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
560
+ * @returns {string} The formatted relative time string (e.g., "2 hours ago", "in 3 days")
561
+ *
562
+ * @example
563
+ * gt.formatRelativeTimeFromDate(new Date(Date.now() - 3600000));
564
+ * // Returns: "1 hour ago"
565
+ */
566
+ formatRelativeTimeFromDate(date: Date, options?: {
567
+ locales?: string | string[];
568
+ baseDate?: Date;
569
+ } & Omit<Intl.RelativeTimeFormatOptions, 'locales'>): string;
570
+ /**
571
+ * Retrieves the display name of a locale code using Intl.DisplayNames, returning an empty string if no name is found.
572
+ *
573
+ * @param {string} [locale=this.targetLocale] - A BCP-47 locale code.
574
+ * @returns {string} The display name corresponding to the code.
575
+ * @throws {Error} If no target locale is provided.
576
+ *
577
+ * @example
578
+ * gt.getLocaleName('es-ES');
579
+ * // Returns: "Spanish (Spain)"
580
+ */
581
+ getLocaleName(locale?: string | undefined): string;
582
+ /**
583
+ * Retrieves an emoji based on a given locale code.
584
+ * Uses the locale's region (if present) to select an emoji or falls back on default emojis.
585
+ *
586
+ * @param {string} [locale=this.targetLocale] - A BCP-47 locale code (e.g., 'en-US', 'fr-CA')
587
+ * @returns {string} The emoji representing the locale or its region.
588
+ * @throws {Error} If no target locale is provided.
589
+ *
590
+ * @example
591
+ * gt.getLocaleEmoji('es-ES');
592
+ * // Returns: "🇪🇸"
593
+ */
594
+ getLocaleEmoji(locale?: string | undefined): string;
595
+ /**
596
+ * Generates linguistic details for a given locale code.
597
+ *
598
+ * This function returns information about the locale,
599
+ * script, and region of a given language code both in a standard form and in a maximized form (with likely script and region).
600
+ * The function provides these names in both your default language and native forms, and an associated emoji.
601
+ *
602
+ * @param {string} [locale=this.targetLocale] - The locale code to get properties for (e.g., "de-AT").
603
+ * @returns {LocaleProperties} - An object containing detailed information about the locale.
604
+ *
605
+ * @property {string} code - The full locale code, e.g., "de-AT".
606
+ * @property {string} name - Language name in the default display language, e.g., "Austrian German".
607
+ * @property {string} nativeName - Language name in the locale's native language, e.g., "Österreichisches Deutsch".
608
+ * @property {string} languageCode - The base language code, e.g., "de".
609
+ * @property {string} languageName - The language name in the default display language, e.g., "German".
610
+ * @property {string} nativeLanguageName - The language name in the native language, e.g., "Deutsch".
611
+ * @property {string} nameWithRegionCode - Language name with region in the default language, e.g., "German (AT)".
612
+ * @property {string} nativeNameWithRegionCode - Language name with region in the native language, e.g., "Deutsch (AT)".
613
+ * @property {string} regionCode - The region code from maximization, e.g., "AT".
614
+ * @property {string} regionName - The region name in the default display language, e.g., "Austria".
615
+ * @property {string} nativeRegionName - The region name in the native language, e.g., "Österreich".
616
+ * @property {string} scriptCode - The script code from maximization, e.g., "Latn".
617
+ * @property {string} scriptName - The script name in the default display language, e.g., "Latin".
618
+ * @property {string} nativeScriptName - The script name in the native language, e.g., "Lateinisch".
619
+ * @property {string} maximizedCode - The maximized locale code, e.g., "de-Latn-AT".
620
+ * @property {string} maximizedName - Maximized locale name with likely script in the default language, e.g., "Austrian German (Latin)".
621
+ * @property {string} nativeMaximizedName - Maximized locale name in the native language, e.g., "Österreichisches Deutsch (Lateinisch)".
622
+ * @property {string} minimizedCode - Minimized locale code, e.g., "de-AT" (or "de" for "de-DE").
623
+ * @property {string} minimizedName - Minimized language name in the default language, e.g., "Austrian German".
624
+ * @property {string} nativeMinimizedName - Minimized language name in the native language, e.g., "Österreichisches Deutsch".
625
+ * @property {string} emoji - The emoji associated with the locale's region, if applicable.
626
+ */
627
+ getLocaleProperties(locale?: string | undefined): LocaleProperties;
628
+ /**
629
+ * Retrieves multiple properties for a given region code, including:
630
+ * - `code`: the original region code
631
+ * - `name`: the localized display name
632
+ * - `emoji`: the associated flag or symbol
633
+ *
634
+ * Behavior:
635
+ * - Accepts ISO 3166-1 alpha-2 or UN M.49 region codes (e.g., `"US"`, `"FR"`, `"419"`).
636
+ * - Uses the instance's `targetLocale` to localize the region name for the user.
637
+ * - If `customMapping` contains a `name` or `emoji` for the region, those override the default values.
638
+ * - Otherwise, uses `Intl.DisplayNames` to get the localized region name, falling back to `libraryDefaultLocale`.
639
+ * - Falls back to the region code as `name` if display name resolution fails.
640
+ * - Falls back to a default emoji if no emoji mapping is found in built-in data or `customMapping`.
641
+ *
642
+ * @param {string} [region=this.getLocaleProperties().regionCode] - The region code to look up (e.g., `"US"`, `"GB"`, `"DE"`).
643
+ * @param {CustomRegionMapping} [customMapping] - Optional mapping of region codes to custom names and/or emojis.
644
+ * @returns {{ code: string, name: string, emoji: string }} An object containing:
645
+ * - `code`: the input region code
646
+ * - `name`: the localized or custom region name
647
+ * - `emoji`: the matching emoji flag or symbol
648
+ *
649
+ * @throws {Error} If no target locale is available to determine region properties.
650
+ *
651
+ * @example
652
+ * const gt = new GT({ targetLocale: 'en-US' });
653
+ * gt.getRegionProperties('US');
654
+ * // => { code: 'US', name: 'United States', emoji: '🇺🇸' }
655
+ *
656
+ * @example
657
+ * const gt = new GT({ targetLocale: 'fr-FR' });
658
+ * gt.getRegionProperties('US');
659
+ * // => { code: 'US', name: 'États-Unis', emoji: '🇺🇸' }
660
+ *
661
+ * @example
662
+ * gt.getRegionProperties('US', { US: { name: 'USA', emoji: '🗽' } });
663
+ * // => { code: 'US', name: 'USA', emoji: '🗽' }
664
+ */
665
+ getRegionProperties(region?: string, customMapping?: CustomRegionMapping): {
666
+ code: string;
667
+ name: string;
668
+ emoji: string;
669
+ };
670
+ /**
671
+ * Determines whether a translation is required based on the source and target locales.
672
+ *
673
+ * @param {string} [sourceLocale=this.sourceLocale] - The locale code for the original content.
674
+ * @param {string} [targetLocale=this.targetLocale] - The locale code to translate into.
675
+ * @param {string[]} [approvedLocales=this.locales] - Optional array of approved target locales.
676
+ * @returns {boolean} True if translation is required, false otherwise
677
+ * @throws {Error} If no source locale is provided.
678
+ * @throws {Error} If no target locale is provided.
679
+ *
680
+ * @example
681
+ * gt.requiresTranslation('en-US', 'es-ES');
682
+ * // Returns: true
683
+ */
684
+ requiresTranslation(sourceLocale?: string | undefined, targetLocale?: string | undefined, approvedLocales?: string[] | undefined, customMapping?: CustomMapping | undefined): boolean;
685
+ /**
686
+ * Determines the best matching locale from the provided approved locales list.
687
+ *
688
+ * @param {string | string[]} locales - A single locale or array of locales in preference order.
689
+ * @param {string[]} [approvedLocales=this.locales] - Array of approved locales in preference order.
690
+ * @returns {string | undefined} The best matching locale, or undefined if no match is found.
691
+ *
692
+ * @example
693
+ * gt.determineLocale(['fr-CA', 'fr-FR'], ['en-US', 'fr-FR', 'es-ES']);
694
+ * // Returns: "fr-FR"
695
+ */
696
+ determineLocale(locales: string | string[], approvedLocales?: string[] | undefined, customMapping?: CustomMapping | undefined): string | undefined;
697
+ /**
698
+ * Gets the text direction for a given locale code.
699
+ *
700
+ * @param {string} [locale=this.targetLocale] - A BCP-47 locale code.
701
+ * @returns {'ltr' | 'rtl'} 'rtl' if the locale is right-to-left; otherwise 'ltr'.
702
+ * @throws {Error} If no target locale is provided.
703
+ *
704
+ * @example
705
+ * gt.getLocaleDirection('ar-SA');
706
+ * // Returns: "rtl"
707
+ */
708
+ getLocaleDirection(locale?: string | undefined): 'ltr' | 'rtl';
709
+ /**
710
+ * Checks if a given BCP 47 locale code is valid.
711
+ *
712
+ * @param {string} [locale=this.targetLocale] - The BCP 47 locale code to validate.
713
+ * @param {CustomMapping} [customMapping=this.customMapping] - The custom mapping to use for validation.
714
+ * @returns {boolean} True if the locale code is valid, false otherwise
715
+ * @throws {Error} If no target locale is provided.
716
+ *
717
+ * @example
718
+ * gt.isValidLocale('en-US');
719
+ * // Returns: true
720
+ */
721
+ isValidLocale(locale?: string | undefined, customMapping?: CustomMapping | undefined): boolean;
722
+ /**
723
+ * Resolves the canonical locale for a given locale.
724
+ * @param locale - The locale to resolve the canonical locale for
725
+ * @param customMapping - The custom mapping to use for resolving the canonical locale
726
+ * @returns The canonical locale, or the input locale when no canonical mapping exists.
727
+ */
728
+ resolveCanonicalLocale(locale?: string | undefined, customMapping?: CustomMapping | undefined): string;
729
+ /**
730
+ * Resolves the alias locale for a given locale.
731
+ * @param locale - The locale to resolve the alias locale for
732
+ * @param customMapping - The custom mapping to use for resolving the alias locale
733
+ * @returns The configured alias for a canonical locale, or the input locale when already an alias or no alias mapping exists.
734
+ */
735
+ resolveAliasLocale(locale: string, customMapping?: CustomMapping | undefined): string;
736
+ /**
737
+ * Standardizes a BCP 47 locale code to ensure correct formatting.
738
+ *
739
+ * @param {string} [locale=this.targetLocale] - The BCP 47 locale code to standardize.
740
+ * @returns {string} The standardized locale code, or the input string if it cannot be standardized.
741
+ * @throws {Error} If no target locale is provided.
742
+ *
743
+ * @example
744
+ * gt.standardizeLocale('en_us');
745
+ * // Returns: "en-US"
746
+ */
747
+ standardizeLocale(locale?: string | undefined): string;
748
+ /**
749
+ * Checks if multiple BCP 47 locale codes represent the same dialect.
750
+ *
751
+ * @param {...(string | string[])} locales - The BCP 47 locale codes to compare.
752
+ * @returns {boolean} True if all codes represent the same dialect, false otherwise
753
+ *
754
+ * @example
755
+ * gt.isSameDialect('en-US', 'en-GB');
756
+ * // Returns: false
757
+ *
758
+ * gt.isSameDialect('en', 'en-US');
759
+ * // Returns: true
760
+ */
761
+ isSameDialect(...locales: (string | string[])[]): boolean;
762
+ /**
763
+ * Checks if multiple BCP 47 locale codes represent the same language.
764
+ *
765
+ * @param {...(string | string[])} locales - The BCP 47 locale codes to compare.
766
+ * @returns {boolean} True if all codes represent the same language, false otherwise
767
+ *
768
+ * @example
769
+ * gt.isSameLanguage('en-US', 'en-GB');
770
+ * // Returns: true
771
+ */
772
+ isSameLanguage(...locales: (string | string[])[]): boolean;
773
+ /**
774
+ * Checks if a locale is a superset of another locale.
775
+ *
776
+ * @param {string} superLocale - The locale to check if it is a superset
777
+ * @param {string} subLocale - The locale to check if it is a subset
778
+ * @returns {boolean} True if superLocale is a superset of subLocale, false otherwise
779
+ *
780
+ * @example
781
+ * gt.isSupersetLocale('en', 'en-US');
782
+ * // Returns: true
783
+ *
784
+ * gt.isSupersetLocale('en-US', 'en');
785
+ * // Returns: false
786
+ */
787
+ isSupersetLocale(superLocale: string, subLocale: string): boolean;
788
+ }
789
+ /**
790
+ * Formats a number according to the specified locales and options.
791
+ * @param {Object} params - The parameters for the number formatting.
792
+ * @param {number} params.value - The number to format.
793
+ * @param {Intl.NumberFormatOptions} [params.options] - Additional options for number formatting.
794
+ * @param {string | string[]} [params.options.locales] - The locales to use for formatting.
795
+ * @returns {string} The formatted number.
796
+ */
797
+ export declare function formatNum(number: number, options: {
798
+ locales: string | string[];
799
+ } & Intl.NumberFormatOptions): string;
800
+ /**
801
+ * Formats a date according to the specified languages and options.
802
+ * @param {Object} params - The parameters for the date formatting.
803
+ * @param {Date} params.value - The date to format.
804
+ * @param {Intl.DateTimeFormatOptions} [params.options] - Additional options for date formatting.
805
+ * @param {string | string[]} [params.options.locales] - The languages to use for formatting.
806
+ * @returns {string} The formatted date.
807
+ */
808
+ export declare function formatDateTime(date: Date, options?: {
809
+ locales?: string | string[];
810
+ } & Intl.DateTimeFormatOptions): string;
811
+ /**
812
+ * Formats a currency value according to the specified languages, currency, and options.
813
+ * @param {Object} params - The parameters for the currency formatting.
814
+ * @param {number} params.value - The currency value to format.
815
+ * @param {string} params.currency - The currency code (e.g., 'USD').
816
+ * @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
817
+ * @param {string | string[]} [params.options.locales] - The locale codes to use for formatting.
818
+ * @returns {string} The formatted currency value.
819
+ */
820
+ export declare function formatCurrency(value: number, currency: string, options: {
821
+ locales: string | string[];
822
+ } & Intl.NumberFormatOptions): string;
823
+ /**
824
+ * Formats a list of items according to the specified locales and options.
825
+ * @param {Object} params - The parameters for the list formatting.
826
+ * @param {Array<string | number>} params.value - The list of items to format.
827
+ * @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.
828
+ * @param {string | string[]} [params.options.locales] - The locales to use for formatting.
829
+ * @returns {string} The formatted list.
830
+ */
831
+ export declare function formatList(array: Array<string | number>, options: {
832
+ locales: string | string[];
833
+ } & Intl.ListFormatOptions): string;
834
+ /**
835
+ * Formats a list of items according to the specified locales and options.
836
+ * @param {Array<T>} array - The list of items to format.
837
+ * @param {Object} [options] - Additional options for list formatting.
838
+ * @param {string | string[]} [options.locales] - The locales to use for formatting.
839
+ * @param {Intl.ListFormatOptions} [options] - Additional Intl.ListFormat options.
840
+ * @returns {Array<T | string>} The formatted list parts.
841
+ */
842
+ export declare function formatListToParts<T>(array: Array<T>, options?: {
843
+ locales?: string | string[];
844
+ } & Intl.ListFormatOptions): Array<T | string>;
845
+ /**
846
+ * Formats a relative time value according to the specified locales and options.
847
+ * @param {Object} params - The parameters for the relative time formatting.
848
+ * @param {number} params.value - The relative time value to format.
849
+ * @param {Intl.RelativeTimeFormatUnit} params.unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year').
850
+ * @param {Intl.RelativeTimeFormatOptions} [params.options={}] - Additional options for relative time formatting.
851
+ * @param {string | string[]} [params.options.locales] - The locales to use for formatting.
852
+ * @returns {string} The formatted relative time string.
853
+ */
854
+ export declare function formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, options: {
855
+ locales: string | string[];
856
+ } & Omit<Intl.RelativeTimeFormatOptions, 'locales'>): string;
857
+ /**
858
+ * Formats a relative time string from a Date, automatically selecting the best unit.
859
+ * @param {Date} date - The date to format relative to now.
860
+ * @param {Object} options - Formatting options.
861
+ * @param {string | string[]} options.locales - The locales to use for formatting.
862
+ * @param {Intl.RelativeTimeFormatOptions} [options] - Additional Intl.RelativeTimeFormat options.
863
+ * @returns {string} The formatted relative time string (e.g., "2 hours ago", "in 3 days").
864
+ */
865
+ export declare function formatRelativeTimeFromDate(date: Date, options: {
866
+ locales: string | string[];
867
+ baseDate?: Date;
868
+ } & Omit<Intl.RelativeTimeFormatOptions, 'locales'>): string;
869
+ /**
870
+ * Retrieves the display name of locale code using Intl.DisplayNames.
871
+ *
872
+ * @param {string} locale - A BCP-47 locale code.
873
+ * @param {string} [defaultLocale] - The default locale to use for formatting.
874
+ * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
875
+ * @returns {string} The display name corresponding to the code.
876
+ */
877
+ export declare function getLocaleName(locale: string, defaultLocale?: string, customMapping?: CustomMapping): string;
878
+ /**
879
+ * Retrieves an emoji based on a given locale code, taking into account region, language, and specific exceptions.
880
+ *
881
+ * This function uses the locale's region (if present) to select an emoji or falls back on default emojis for certain languages.
882
+ *
883
+ * @param locale - A string representing the locale code (e.g., 'en-US', 'fr-CA').
884
+ * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
885
+ * @returns The emoji representing the locale or its region, or a default emoji if no specific match is found.
886
+ */
887
+ export declare function getLocaleEmoji(locale: string, customMapping?: CustomMapping): string;
888
+ /**
889
+ * Generates linguistic details for a given locale code.
890
+ *
891
+ * This function returns information about the locale,
892
+ * script, and region of a given language code both in a standard form and in a maximized form (with likely script and region).
893
+ * The function provides these names in both your default language and native forms, and an associated emoji.
894
+ *
895
+ * @param {string} locale - The locale code to get properties for (e.g., "de-AT").
896
+ * @param {string} [defaultLocale] - The default locale to use for formatting.
897
+ * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
898
+ * @returns {LocaleProperties} - An object containing detailed information about the locale.
899
+ *
900
+ * @property {string} code - The full locale code, e.g., "de-AT".
901
+ * @property {string} name - Language name in the default display language, e.g., "Austrian German".
902
+ * @property {string} nativeName - Language name in the locale's native language, e.g., "Österreichisches Deutsch".
903
+ * @property {string} languageCode - The base language code, e.g., "de".
904
+ * @property {string} languageName - The language name in the default display language, e.g., "German".
905
+ * @property {string} nativeLanguageName - The language name in the native language, e.g., "Deutsch".
906
+ * @property {string} nameWithRegionCode - Language name with region in the default language, e.g., "German (AT)".
907
+ * @property {string} nativeNameWithRegionCode - Language name with region in the native language, e.g., "Deutsch (AT)".
908
+ * @property {string} regionCode - The region code from maximization, e.g., "AT".
909
+ * @property {string} regionName - The region name in the default display language, e.g., "Austria".
910
+ * @property {string} nativeRegionName - The region name in the native language, e.g., "Österreich".
911
+ * @property {string} scriptCode - The script code from maximization, e.g., "Latn".
912
+ * @property {string} scriptName - The script name in the default display language, e.g., "Latin".
913
+ * @property {string} nativeScriptName - The script name in the native language, e.g., "Lateinisch".
914
+ * @property {string} maximizedCode - The maximized locale code, e.g., "de-Latn-AT".
915
+ * @property {string} maximizedName - Maximized locale name with likely script in the default language, e.g., "Austrian German (Latin)".
916
+ * @property {string} nativeMaximizedName - Maximized locale name in the native language, e.g., "Österreichisches Deutsch (Lateinisch)".
917
+ * @property {string} minimizedCode - Minimized locale code, e.g., "de-AT" (or "de" for "de-DE").
918
+ * @property {string} minimizedName - Minimized language name in the default language, e.g., "Austrian German".
919
+ * @property {string} nativeMinimizedName - Minimized language name in the native language, e.g., "Österreichisches Deutsch".
920
+ * @property {string} emoji - The emoji associated with the locale's region, if applicable.
921
+ */
922
+ export declare function getLocaleProperties(locale: string, defaultLocale?: string, customMapping?: CustomMapping): LocaleProperties;
923
+ /**
924
+ * Retrieves multiple properties for a given region code, including:
925
+ * - `code`: the original region code
926
+ * - `name`: the localized display name
927
+ * - `emoji`: the associated flag or symbol
928
+ *
929
+ * Behavior:
930
+ * - Accepts ISO 3166-1 alpha-2 or UN M.49 region codes (e.g., `"US"`, `"FR"`, `"419"`).
931
+ * - If `customMapping` contains a `name` or `emoji` for the region, those override the default values.
932
+ * - Otherwise, uses `Intl.DisplayNames` to get the localized region name in the given `defaultLocale`,
933
+ * falling back to `libraryDefaultLocale`.
934
+ * - Falls back to the region code as `name` if display name resolution fails.
935
+ * - Falls back to `defaultEmoji` if no emoji mapping is found in `emojis` or `customMapping`.
936
+ *
937
+ * @param {string} region - The region code to look up (e.g., `"US"`, `"GB"`, `"DE"`).
938
+ * @param {string} [defaultLocale=libraryDefaultLocale] - The locale to use when localizing the region name.
939
+ * @param {CustomRegionMapping} [customMapping] - Optional mapping of region codes to custom names and/or emojis.
940
+ * @returns {{ code: string, name: string, emoji: string }} An object containing:
941
+ * - `code`: the input region code
942
+ * - `name`: the localized or custom region name
943
+ * - `emoji`: the matching emoji flag or symbol
944
+ *
945
+ * @example
946
+ * getRegionProperties('US', 'en');
947
+ * // => { code: 'US', name: 'United States', emoji: '🇺🇸' }
948
+ *
949
+ * @example
950
+ * getRegionProperties('US', 'fr');
951
+ * // => { code: 'US', name: 'États-Unis', emoji: '🇺🇸' }
952
+ *
953
+ * @example
954
+ * getRegionProperties('US', 'en', { US: { name: 'USA', emoji: '🗽' } });
955
+ * // => { code: 'US', name: 'USA', emoji: '🗽' }
956
+ */
957
+ export declare function getRegionProperties(region: string, defaultLocale?: string, customMapping?: CustomRegionMapping): {
958
+ code: string;
959
+ name: string;
960
+ emoji: string;
961
+ };
962
+ /**
963
+ * Determines whether a translation is required based on the source and target locales.
964
+ *
965
+ * - If the target locale is not specified, the function returns `false`, as translation is not needed.
966
+ * - If the source and target locale are the same, returns `false`, indicating that no translation is necessary.
967
+ * - If the `approvedLocales` array is provided, and the target locale is not within that array, the function also returns `false`.
968
+ * - Otherwise, it returns `true`, meaning that a translation is required.
969
+ *
970
+ * @param {string} sourceLocale - The locale code for the original content (BCP 47 locale code).
971
+ * @param {string} targetLocale - The locale code of the language to translate the content into (BCP 47 locale code).
972
+ * @param {string[]} [approvedLocale] - An optional array of approved target locales.
973
+ *
974
+ * @returns {boolean} - Returns `true` if translation is required, otherwise `false`.
975
+ */
976
+ export declare function requiresTranslation(sourceLocale: string, targetLocale: string, approvedLocales?: string[], customMapping?: CustomMapping): boolean;
977
+ /**
978
+ * Determines the best matching locale from the provided approved locales list.
979
+ * @param {string | string[]} locales - A single locale or an array of locales sorted in preference order.
980
+ * @param {string[]} [approvedLocales=this.locales] - An array of approved locales, also sorted by preference.
981
+ * @returns {string | undefined} - The best matching locale from the approvedLocales list, or undefined if no match is found.
982
+ */
983
+ export declare function determineLocale(locales: string | string[], approvedLocales?: string[] | undefined, customMapping?: CustomMapping | undefined): string | undefined;
984
+ /**
985
+ * Get the text direction for a given locale code using the Intl.Locale API.
986
+ *
987
+ * @param {string} locale - A BCP-47 locale code.
988
+ * @returns {string} 'rtl' if the locale is right-to-left; otherwise 'ltr'.
989
+ */
990
+ export declare function getLocaleDirection(locale: string): 'ltr' | 'rtl';
991
+ /**
992
+ * Resolves the alias locale for a given locale.
993
+ * @param {string} locale - The locale to resolve the alias locale for
994
+ * @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the alias locale
995
+ * @returns {string} The alias locale
996
+ */
997
+ export declare function resolveAliasLocale(locale: string, customMapping?: CustomMapping): string;
998
+ /**
999
+ * Checks if multiple BCP 47 locale codes represent the same dialect.
1000
+ * @param {string[]} locales - The BCP 47 locale codes to compare.
1001
+ * @returns {boolean} True if all BCP 47 codes represent the same dialect, false otherwise.
1002
+ */
1003
+ export declare function isSameDialect(...locales: (string | string[])[]): boolean;
1004
+ /**
1005
+ * Checks if multiple BCP 47 locale codes represent the same language.
1006
+ * @param {string[]} locales - The BCP 47 locale codes to compare.
1007
+ * @returns {boolean} True if all BCP 47 codes represent the same language, false otherwise.
1008
+ */
1009
+ export declare function isSameLanguage(...locales: (string | string[])[]): boolean;
1010
+ /**
1011
+ * Checks if a locale is a superset of another locale.
1012
+ * A subLocale is a subset of superLocale if it is an extension of superLocale or are otherwise identical.
1013
+ *
1014
+ * @param {string} superLocale - The locale to check if it is a superset of the other locale.
1015
+ * @param {string} subLocale - The locale to check if it is a subset of the other locale.
1016
+ * @returns {boolean} True if the first locale is a superset of the second locale, false otherwise.
1017
+ */
1018
+ export declare function isSupersetLocale(superLocale: string, subLocale: string): boolean;
1019
+ export declare const API_VERSION = "2026-03-06.v1";