gt-react 3.1.98 → 4.0.0

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 (380) hide show
  1. package/README.md +6 -2
  2. package/dist/client.d.ts +5 -10
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +8 -18
  5. package/dist/client.js.map +1 -1
  6. package/dist/hooks/useBrowserLocale.d.ts.map +1 -0
  7. package/dist/{client/hooks → hooks}/useBrowserLocale.js +3 -3
  8. package/dist/hooks/useBrowserLocale.js.map +1 -0
  9. package/dist/hooks/useDefaultLocale.d.ts.map +1 -0
  10. package/dist/hooks/useDefaultLocale.js +15 -0
  11. package/dist/hooks/useDefaultLocale.js.map +1 -0
  12. package/dist/hooks/useGT.d.ts.map +1 -0
  13. package/dist/{client/hooks → hooks}/useGT.js +5 -8
  14. package/dist/hooks/useGT.js.map +1 -0
  15. package/dist/hooks/useLocale.d.ts +5 -0
  16. package/dist/hooks/useLocale.d.ts.map +1 -0
  17. package/dist/hooks/useLocale.js +15 -0
  18. package/dist/hooks/useLocale.js.map +1 -0
  19. package/dist/index.d.ts +9 -6
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +17 -11
  22. package/dist/index.js.map +1 -1
  23. package/dist/internal/addGTIdentifier.d.ts +6 -0
  24. package/dist/internal/addGTIdentifier.d.ts.map +1 -0
  25. package/dist/internal/addGTIdentifier.js +110 -0
  26. package/dist/internal/addGTIdentifier.js.map +1 -0
  27. package/dist/internal/calculateHash.d.ts.map +1 -0
  28. package/dist/{primitives → internal}/calculateHash.js +12 -3
  29. package/dist/internal/calculateHash.js.map +1 -0
  30. package/dist/{primitives/dictionary → internal}/flattenDictionary.d.ts +2 -0
  31. package/dist/internal/flattenDictionary.d.ts.map +1 -0
  32. package/dist/{primitives/dictionary → internal}/flattenDictionary.js +12 -1
  33. package/dist/internal/flattenDictionary.js.map +1 -0
  34. package/dist/internal/writeChildrenAsObjects.d.ts +7 -0
  35. package/dist/internal/writeChildrenAsObjects.d.ts.map +1 -0
  36. package/dist/internal/writeChildrenAsObjects.js +74 -0
  37. package/dist/internal/writeChildrenAsObjects.js.map +1 -0
  38. package/dist/internal.d.ts +12 -0
  39. package/dist/internal.d.ts.map +1 -0
  40. package/dist/internal.js +50 -0
  41. package/dist/internal.js.map +1 -0
  42. package/dist/{primitives/variables → plurals}/getPluralBranch.d.ts +1 -6
  43. package/dist/plurals/getPluralBranch.d.ts.map +1 -0
  44. package/dist/{primitives/variables → plurals}/getPluralBranch.js +25 -36
  45. package/dist/plurals/getPluralBranch.js.map +1 -0
  46. package/dist/primitives/primitives.d.ts +13 -0
  47. package/dist/primitives/primitives.d.ts.map +1 -0
  48. package/dist/primitives/primitives.js +15 -0
  49. package/dist/primitives/primitives.js.map +1 -0
  50. package/dist/primitives/settings.d.ts +4 -0
  51. package/dist/primitives/settings.d.ts.map +1 -0
  52. package/dist/primitives/settings.js +7 -0
  53. package/dist/primitives/settings.js.map +1 -0
  54. package/dist/primitives/types.d.ts +53 -0
  55. package/dist/primitives/types.d.ts.map +1 -0
  56. package/dist/{types/Variables.js → primitives/types.js} +1 -1
  57. package/dist/primitives/types.js.map +1 -0
  58. package/dist/provider/GTContext.d.ts +7 -0
  59. package/dist/provider/GTContext.d.ts.map +1 -0
  60. package/dist/provider/GTContext.js +16 -0
  61. package/dist/provider/GTContext.js.map +1 -0
  62. package/dist/provider/GTProvider.d.ts +12 -0
  63. package/dist/provider/GTProvider.d.ts.map +1 -0
  64. package/dist/provider/GTProvider.js +156 -0
  65. package/dist/provider/GTProvider.js.map +1 -0
  66. package/dist/provider/helpers/extractEntryMetadata.d.ts +6 -0
  67. package/dist/provider/helpers/extractEntryMetadata.d.ts.map +1 -0
  68. package/dist/provider/helpers/extractEntryMetadata.js +15 -0
  69. package/dist/provider/helpers/extractEntryMetadata.js.map +1 -0
  70. package/dist/provider/helpers/getDictionaryEntry.d.ts +3 -0
  71. package/dist/provider/helpers/getDictionaryEntry.d.ts.map +1 -0
  72. package/dist/provider/helpers/getDictionaryEntry.js +24 -0
  73. package/dist/provider/helpers/getDictionaryEntry.js.map +1 -0
  74. package/dist/provider/helpers/getGTProp.d.ts +7 -0
  75. package/dist/provider/helpers/getGTProp.d.ts.map +1 -0
  76. package/dist/provider/helpers/getGTProp.js +10 -0
  77. package/dist/provider/helpers/getGTProp.js.map +1 -0
  78. package/dist/provider/helpers/isValidDictionaryEntry.d.ts +20 -0
  79. package/dist/provider/helpers/isValidDictionaryEntry.d.ts.map +1 -0
  80. package/dist/{types/CreateGTProps.js → provider/helpers/isValidDictionaryEntry.js} +1 -1
  81. package/dist/provider/helpers/isValidDictionaryEntry.js.map +1 -0
  82. package/dist/provider/helpers/isVariableObject.d.ts +3 -0
  83. package/dist/provider/helpers/isVariableObject.d.ts.map +1 -0
  84. package/dist/provider/helpers/isVariableObject.js +17 -0
  85. package/dist/provider/helpers/isVariableObject.js.map +1 -0
  86. package/dist/provider/rendering/renderDefaultChildren.d.ts +7 -0
  87. package/dist/provider/rendering/renderDefaultChildren.d.ts.map +1 -0
  88. package/dist/provider/rendering/renderDefaultChildren.js +48 -0
  89. package/dist/provider/rendering/renderDefaultChildren.js.map +1 -0
  90. package/dist/provider/rendering/renderTranslatedChildren.d.ts +15 -0
  91. package/dist/provider/rendering/renderTranslatedChildren.d.ts.map +1 -0
  92. package/dist/provider/rendering/renderTranslatedChildren.js +142 -0
  93. package/dist/provider/rendering/renderTranslatedChildren.js.map +1 -0
  94. package/dist/{client/variables/ClientCurrency.d.ts → variables/Currency.d.ts} +3 -3
  95. package/dist/variables/Currency.d.ts.map +1 -0
  96. package/dist/{client/variables/ClientCurrency.js → variables/Currency.js} +5 -5
  97. package/dist/variables/Currency.js.map +1 -0
  98. package/dist/{client/variables/ClientDateTime.d.ts → variables/DateTime.d.ts} +3 -3
  99. package/dist/variables/DateTime.d.ts.map +1 -0
  100. package/dist/{client/variables/ClientDateTime.js → variables/DateTime.js} +5 -5
  101. package/dist/variables/DateTime.js.map +1 -0
  102. package/dist/{client/variables/ClientNum.d.ts → variables/Num.d.ts} +3 -3
  103. package/dist/variables/Num.d.ts.map +1 -0
  104. package/dist/{client/variables/ClientNum.js → variables/Num.js} +5 -5
  105. package/dist/variables/Num.js.map +1 -0
  106. package/dist/{server/variables/Var → variables}/Var.d.ts +1 -2
  107. package/dist/variables/Var.d.ts.map +1 -0
  108. package/dist/variables/Var.js +12 -0
  109. package/dist/variables/Var.js.map +1 -0
  110. package/dist/variables/_defaultVariableNames.d.ts +8 -0
  111. package/dist/variables/_defaultVariableNames.d.ts.map +1 -0
  112. package/dist/{primitives/variables/defaultVariableNames.js → variables/_defaultVariableNames.js} +2 -2
  113. package/dist/variables/_defaultVariableNames.js.map +1 -0
  114. package/dist/{primitives/variables/getVariableProps.d.ts → variables/_getVariableProps.d.ts} +2 -2
  115. package/dist/variables/_getVariableProps.d.ts.map +1 -0
  116. package/dist/{primitives/variables/getVariableProps.js → variables/_getVariableProps.js} +3 -3
  117. package/dist/variables/_getVariableProps.js.map +1 -0
  118. package/package.json +13 -36
  119. package/scratchpad.js +23 -37
  120. package/dist/client/ClientProvider.d.ts +0 -19
  121. package/dist/client/ClientProvider.d.ts.map +0 -1
  122. package/dist/client/ClientProvider.js +0 -69
  123. package/dist/client/ClientProvider.js.map +0 -1
  124. package/dist/client/client-only/GTClientProvider.d.ts +0 -32
  125. package/dist/client/client-only/GTClientProvider.d.ts.map +0 -1
  126. package/dist/client/client-only/GTClientProvider.js +0 -219
  127. package/dist/client/client-only/GTClientProvider.js.map +0 -1
  128. package/dist/client/helpers/ClientResolver.d.ts +0 -13
  129. package/dist/client/helpers/ClientResolver.d.ts.map +0 -1
  130. package/dist/client/helpers/ClientResolver.js +0 -83
  131. package/dist/client/helpers/ClientResolver.js.map +0 -1
  132. package/dist/client/helpers/handleRender.d.ts +0 -2
  133. package/dist/client/helpers/handleRender.d.ts.map +0 -1
  134. package/dist/client/helpers/handleRender.js +0 -103
  135. package/dist/client/helpers/handleRender.js.map +0 -1
  136. package/dist/client/helpers/renderClientChildren.d.ts +0 -19
  137. package/dist/client/helpers/renderClientChildren.d.ts.map +0 -1
  138. package/dist/client/helpers/renderClientChildren.js +0 -199
  139. package/dist/client/helpers/renderClientChildren.js.map +0 -1
  140. package/dist/client/helpers/renderDefaultLanguage.d.ts +0 -10
  141. package/dist/client/helpers/renderDefaultLanguage.d.ts.map +0 -1
  142. package/dist/client/helpers/renderDefaultLanguage.js +0 -80
  143. package/dist/client/helpers/renderDefaultLanguage.js.map +0 -1
  144. package/dist/client/hooks/useBrowserLocale.d.ts.map +0 -1
  145. package/dist/client/hooks/useBrowserLocale.js.map +0 -1
  146. package/dist/client/hooks/useDefaultLocale.d.ts.map +0 -1
  147. package/dist/client/hooks/useDefaultLocale.js +0 -13
  148. package/dist/client/hooks/useDefaultLocale.js.map +0 -1
  149. package/dist/client/hooks/useGT.d.ts.map +0 -1
  150. package/dist/client/hooks/useGT.js.map +0 -1
  151. package/dist/client/hooks/useLocale.d.ts +0 -5
  152. package/dist/client/hooks/useLocale.d.ts.map +0 -1
  153. package/dist/client/hooks/useLocale.js +0 -13
  154. package/dist/client/hooks/useLocale.js.map +0 -1
  155. package/dist/client/plural/ClientPlural.d.ts +0 -31
  156. package/dist/client/plural/ClientPlural.d.ts.map +0 -1
  157. package/dist/client/plural/ClientPlural.js +0 -51
  158. package/dist/client/plural/ClientPlural.js.map +0 -1
  159. package/dist/client/value/ClientValue.d.ts +0 -15
  160. package/dist/client/value/ClientValue.d.ts.map +0 -1
  161. package/dist/client/value/ClientValue.js +0 -23
  162. package/dist/client/value/ClientValue.js.map +0 -1
  163. package/dist/client/value/RenderClientVariable.d.ts +0 -6
  164. package/dist/client/value/RenderClientVariable.d.ts.map +0 -1
  165. package/dist/client/value/RenderClientVariable.js +0 -93
  166. package/dist/client/value/RenderClientVariable.js.map +0 -1
  167. package/dist/client/variables/ClientCurrency.d.ts.map +0 -1
  168. package/dist/client/variables/ClientCurrency.js.map +0 -1
  169. package/dist/client/variables/ClientDateTime.d.ts.map +0 -1
  170. package/dist/client/variables/ClientDateTime.js.map +0 -1
  171. package/dist/client/variables/ClientNum.d.ts.map +0 -1
  172. package/dist/client/variables/ClientNum.js.map +0 -1
  173. package/dist/client/variables/ClientVar.d.ts +0 -21
  174. package/dist/client/variables/ClientVar.d.ts.map +0 -1
  175. package/dist/client/variables/ClientVar.js +0 -22
  176. package/dist/client/variables/ClientVar.js.map +0 -1
  177. package/dist/config/I18NConfiguration.d.ts +0 -140
  178. package/dist/config/I18NConfiguration.d.ts.map +0 -1
  179. package/dist/config/I18NConfiguration.js +0 -428
  180. package/dist/config/I18NConfiguration.js.map +0 -1
  181. package/dist/config/LocalDictionaryManager.d.ts +0 -31
  182. package/dist/config/LocalDictionaryManager.d.ts.map +0 -1
  183. package/dist/config/LocalDictionaryManager.js +0 -139
  184. package/dist/config/LocalDictionaryManager.js.map +0 -1
  185. package/dist/config/RemoteDictionaryManager.d.ts +0 -59
  186. package/dist/config/RemoteDictionaryManager.d.ts.map +0 -1
  187. package/dist/config/RemoteDictionaryManager.js +0 -181
  188. package/dist/config/RemoteDictionaryManager.js.map +0 -1
  189. package/dist/config/local/getDefaultFromEnv.d.ts +0 -12
  190. package/dist/config/local/getDefaultFromEnv.d.ts.map +0 -1
  191. package/dist/config/local/getDefaultFromEnv.js +0 -21
  192. package/dist/config/local/getDefaultFromEnv.js.map +0 -1
  193. package/dist/dictionary/cloneDictionary.d.ts +0 -2
  194. package/dist/dictionary/cloneDictionary.d.ts.map +0 -1
  195. package/dist/dictionary/cloneDictionary.js +0 -42
  196. package/dist/dictionary/cloneDictionary.js.map +0 -1
  197. package/dist/dictionary/createTFunction.d.ts +0 -6
  198. package/dist/dictionary/createTFunction.d.ts.map +0 -1
  199. package/dist/dictionary/createTFunction.js +0 -73
  200. package/dist/dictionary/createTFunction.js.map +0 -1
  201. package/dist/dictionary/getDictionaryEntry.d.ts +0 -2
  202. package/dist/dictionary/getDictionaryEntry.d.ts.map +0 -1
  203. package/dist/dictionary/getDictionaryEntry.js +0 -15
  204. package/dist/dictionary/getDictionaryEntry.js.map +0 -1
  205. package/dist/index/determineLocale.d.ts +0 -10
  206. package/dist/index/determineLocale.d.ts.map +0 -1
  207. package/dist/index/determineLocale.js +0 -45
  208. package/dist/index/determineLocale.js.map +0 -1
  209. package/dist/middleware/cookieSettings.d.ts +0 -2
  210. package/dist/middleware/cookieSettings.d.ts.map +0 -1
  211. package/dist/middleware/cookieSettings.js +0 -5
  212. package/dist/middleware/cookieSettings.js.map +0 -1
  213. package/dist/middleware/createNextMiddleware.d.ts +0 -10
  214. package/dist/middleware/createNextMiddleware.d.ts.map +0 -1
  215. package/dist/middleware/createNextMiddleware.js +0 -154
  216. package/dist/middleware/createNextMiddleware.js.map +0 -1
  217. package/dist/middleware.d.ts +0 -3
  218. package/dist/middleware.d.ts.map +0 -1
  219. package/dist/middleware.js +0 -9
  220. package/dist/middleware.js.map +0 -1
  221. package/dist/next/imports/imports.d.ts +0 -6
  222. package/dist/next/imports/imports.d.ts.map +0 -1
  223. package/dist/next/imports/imports.js +0 -84
  224. package/dist/next/imports/imports.js.map +0 -1
  225. package/dist/next/requestFunctions.d.ts +0 -21
  226. package/dist/next/requestFunctions.d.ts.map +0 -1
  227. package/dist/next/requestFunctions.js +0 -59
  228. package/dist/next/requestFunctions.js.map +0 -1
  229. package/dist/next.d.ts +0 -38
  230. package/dist/next.d.ts.map +0 -1
  231. package/dist/next.js +0 -71
  232. package/dist/next.js.map +0 -1
  233. package/dist/primitives/calculateHash.d.ts.map +0 -1
  234. package/dist/primitives/calculateHash.js.map +0 -1
  235. package/dist/primitives/dictionary/flattenDictionary.d.ts.map +0 -1
  236. package/dist/primitives/dictionary/flattenDictionary.js.map +0 -1
  237. package/dist/primitives/dictionary/getDictionaryReference.d.ts +0 -8
  238. package/dist/primitives/dictionary/getDictionaryReference.d.ts.map +0 -1
  239. package/dist/primitives/dictionary/getDictionaryReference.js +0 -13
  240. package/dist/primitives/dictionary/getDictionaryReference.js.map +0 -1
  241. package/dist/primitives/rendering/getEntryMetadata.d.ts +0 -5
  242. package/dist/primitives/rendering/getEntryMetadata.d.ts.map +0 -1
  243. package/dist/primitives/rendering/getEntryMetadata.js +0 -42
  244. package/dist/primitives/rendering/getEntryMetadata.js.map +0 -1
  245. package/dist/primitives/rendering/getEntryTranslationType.d.ts +0 -10
  246. package/dist/primitives/rendering/getEntryTranslationType.d.ts.map +0 -1
  247. package/dist/primitives/rendering/getEntryTranslationType.js +0 -45
  248. package/dist/primitives/rendering/getEntryTranslationType.js.map +0 -1
  249. package/dist/primitives/rendering/isValidReactNode.d.ts +0 -15
  250. package/dist/primitives/rendering/isValidReactNode.d.ts.map +0 -1
  251. package/dist/primitives/rendering/isValidReactNode.js +0 -27
  252. package/dist/primitives/rendering/isValidReactNode.js.map +0 -1
  253. package/dist/primitives/translation/addGTIdentifier.d.ts +0 -11
  254. package/dist/primitives/translation/addGTIdentifier.d.ts.map +0 -1
  255. package/dist/primitives/translation/addGTIdentifier.js +0 -171
  256. package/dist/primitives/translation/addGTIdentifier.js.map +0 -1
  257. package/dist/primitives/translation/writeChildrenAsObjects.d.ts +0 -11
  258. package/dist/primitives/translation/writeChildrenAsObjects.d.ts.map +0 -1
  259. package/dist/primitives/translation/writeChildrenAsObjects.js +0 -128
  260. package/dist/primitives/translation/writeChildrenAsObjects.js.map +0 -1
  261. package/dist/primitives/variables/createValues.d.ts +0 -6
  262. package/dist/primitives/variables/createValues.d.ts.map +0 -1
  263. package/dist/primitives/variables/createValues.js +0 -27
  264. package/dist/primitives/variables/createValues.js.map +0 -1
  265. package/dist/primitives/variables/defaultVariableNames.d.ts +0 -3
  266. package/dist/primitives/variables/defaultVariableNames.d.ts.map +0 -1
  267. package/dist/primitives/variables/defaultVariableNames.js.map +0 -1
  268. package/dist/primitives/variables/getPluralBranch.d.ts.map +0 -1
  269. package/dist/primitives/variables/getPluralBranch.js.map +0 -1
  270. package/dist/primitives/variables/getVariableProps.d.ts.map +0 -1
  271. package/dist/primitives/variables/getVariableProps.js.map +0 -1
  272. package/dist/primitives/variables/isTargetVariable.d.ts +0 -3
  273. package/dist/primitives/variables/isTargetVariable.d.ts.map +0 -1
  274. package/dist/primitives/variables/isTargetVariable.js +0 -12
  275. package/dist/primitives/variables/isTargetVariable.js.map +0 -1
  276. package/dist/server/inline/Resolver.d.ts +0 -5
  277. package/dist/server/inline/Resolver.d.ts.map +0 -1
  278. package/dist/server/inline/Resolver.js +0 -59
  279. package/dist/server/inline/Resolver.js.map +0 -1
  280. package/dist/server/inline/T.d.ts +0 -15
  281. package/dist/server/inline/T.d.ts.map +0 -1
  282. package/dist/server/inline/T.js +0 -165
  283. package/dist/server/inline/T.js.map +0 -1
  284. package/dist/server/inline/createTComponent.d.ts +0 -9
  285. package/dist/server/inline/createTComponent.d.ts.map +0 -1
  286. package/dist/server/inline/createTComponent.js +0 -41
  287. package/dist/server/inline/createTComponent.js.map +0 -1
  288. package/dist/server/inline/renderChildren.d.ts +0 -19
  289. package/dist/server/inline/renderChildren.d.ts.map +0 -1
  290. package/dist/server/inline/renderChildren.js +0 -223
  291. package/dist/server/inline/renderChildren.js.map +0 -1
  292. package/dist/server/plural/InnerPlural.d.ts +0 -24
  293. package/dist/server/plural/InnerPlural.d.ts.map +0 -1
  294. package/dist/server/plural/InnerPlural.js +0 -38
  295. package/dist/server/plural/InnerPlural.js.map +0 -1
  296. package/dist/server/plural/createPluralComponent.d.ts +0 -8
  297. package/dist/server/plural/createPluralComponent.d.ts.map +0 -1
  298. package/dist/server/plural/createPluralComponent.js +0 -41
  299. package/dist/server/plural/createPluralComponent.js.map +0 -1
  300. package/dist/server/provider/GTProvider.d.ts +0 -11
  301. package/dist/server/provider/GTProvider.d.ts.map +0 -1
  302. package/dist/server/provider/GTProvider.js +0 -224
  303. package/dist/server/provider/GTProvider.js.map +0 -1
  304. package/dist/server/provider/createGTProviderComponent.d.ts +0 -6
  305. package/dist/server/provider/createGTProviderComponent.d.ts.map +0 -1
  306. package/dist/server/provider/createGTProviderComponent.js +0 -41
  307. package/dist/server/provider/createGTProviderComponent.js.map +0 -1
  308. package/dist/server/translate/createTranslateFunction.d.ts +0 -7
  309. package/dist/server/translate/createTranslateFunction.d.ts.map +0 -1
  310. package/dist/server/translate/createTranslateFunction.js +0 -109
  311. package/dist/server/translate/createTranslateFunction.js.map +0 -1
  312. package/dist/server/value/InnerValue.d.ts +0 -9
  313. package/dist/server/value/InnerValue.d.ts.map +0 -1
  314. package/dist/server/value/InnerValue.js +0 -28
  315. package/dist/server/value/InnerValue.js.map +0 -1
  316. package/dist/server/value/createValueComponent.d.ts +0 -9
  317. package/dist/server/value/createValueComponent.d.ts.map +0 -1
  318. package/dist/server/value/createValueComponent.js +0 -40
  319. package/dist/server/value/createValueComponent.js.map +0 -1
  320. package/dist/server/value/renderVariable.d.ts +0 -9
  321. package/dist/server/value/renderVariable.d.ts.map +0 -1
  322. package/dist/server/value/renderVariable.js +0 -77
  323. package/dist/server/value/renderVariable.js.map +0 -1
  324. package/dist/server/variables/Currency/Currency.d.ts +0 -15
  325. package/dist/server/variables/Currency/Currency.d.ts.map +0 -1
  326. package/dist/server/variables/Currency/Currency.js +0 -41
  327. package/dist/server/variables/Currency/Currency.js.map +0 -1
  328. package/dist/server/variables/Currency/createCurrencyComponent.d.ts +0 -8
  329. package/dist/server/variables/Currency/createCurrencyComponent.d.ts.map +0 -1
  330. package/dist/server/variables/Currency/createCurrencyComponent.js +0 -40
  331. package/dist/server/variables/Currency/createCurrencyComponent.js.map +0 -1
  332. package/dist/server/variables/DateTime/DateTime.d.ts +0 -13
  333. package/dist/server/variables/DateTime/DateTime.d.ts.map +0 -1
  334. package/dist/server/variables/DateTime/DateTime.js +0 -46
  335. package/dist/server/variables/DateTime/DateTime.js.map +0 -1
  336. package/dist/server/variables/DateTime/createDateTimeComponent.d.ts +0 -8
  337. package/dist/server/variables/DateTime/createDateTimeComponent.d.ts.map +0 -1
  338. package/dist/server/variables/DateTime/createDateTimeComponent.js +0 -40
  339. package/dist/server/variables/DateTime/createDateTimeComponent.js.map +0 -1
  340. package/dist/server/variables/Num/Num.d.ts +0 -14
  341. package/dist/server/variables/Num/Num.d.ts.map +0 -1
  342. package/dist/server/variables/Num/Num.js +0 -28
  343. package/dist/server/variables/Num/Num.js.map +0 -1
  344. package/dist/server/variables/Num/createNumComponent.d.ts +0 -8
  345. package/dist/server/variables/Num/createNumComponent.d.ts.map +0 -1
  346. package/dist/server/variables/Num/createNumComponent.js +0 -41
  347. package/dist/server/variables/Num/createNumComponent.js.map +0 -1
  348. package/dist/server/variables/Var/Var.d.ts.map +0 -1
  349. package/dist/server/variables/Var/Var.js +0 -24
  350. package/dist/server/variables/Var/Var.js.map +0 -1
  351. package/dist/server/variables/Var/createVarComponent.d.ts +0 -7
  352. package/dist/server/variables/Var/createVarComponent.d.ts.map +0 -1
  353. package/dist/server/variables/Var/createVarComponent.js +0 -40
  354. package/dist/server/variables/Var/createVarComponent.js.map +0 -1
  355. package/dist/server.d.ts +0 -45
  356. package/dist/server.d.ts.map +0 -1
  357. package/dist/server.js +0 -169
  358. package/dist/server.js.map +0 -1
  359. package/dist/types/CreateGTProps.d.ts +0 -23
  360. package/dist/types/CreateGTProps.d.ts.map +0 -1
  361. package/dist/types/CreateGTProps.js.map +0 -1
  362. package/dist/types/GeneralTranslationInterface.d.ts +0 -122
  363. package/dist/types/GeneralTranslationInterface.d.ts.map +0 -1
  364. package/dist/types/GeneralTranslationInterface.js +0 -3
  365. package/dist/types/GeneralTranslationInterface.js.map +0 -1
  366. package/dist/types/SourceTargetTypes.d.ts +0 -17
  367. package/dist/types/SourceTargetTypes.d.ts.map +0 -1
  368. package/dist/types/SourceTargetTypes.js +0 -3
  369. package/dist/types/SourceTargetTypes.js.map +0 -1
  370. package/dist/types/Variables.d.ts +0 -83
  371. package/dist/types/Variables.d.ts.map +0 -1
  372. package/dist/types/Variables.js.map +0 -1
  373. package/dist/types/defaultGTProps.d.ts +0 -20
  374. package/dist/types/defaultGTProps.d.ts.map +0 -1
  375. package/dist/types/defaultGTProps.js +0 -31
  376. package/dist/types/defaultGTProps.js.map +0 -1
  377. /package/dist/{client/hooks → hooks}/useBrowserLocale.d.ts +0 -0
  378. /package/dist/{client/hooks → hooks}/useDefaultLocale.d.ts +0 -0
  379. /package/dist/{client/hooks → hooks}/useGT.d.ts +0 -0
  380. /package/dist/{primitives → internal}/calculateHash.d.ts +0 -0
@@ -1,428 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- var __generator = (this && this.__generator) || function (thisArg, body) {
46
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
- function verb(n) { return function (v) { return step([n, v]); }; }
49
- function step(op) {
50
- if (f) throw new TypeError("Generator is already executing.");
51
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
- if (y = 0, t) op = [op[0] & 2, t.value];
54
- switch (op[0]) {
55
- case 0: case 1: t = op; break;
56
- case 4: _.label++; return { value: op[1], done: false };
57
- case 5: _.label++; y = op[1]; op = [0]; continue;
58
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
- default:
60
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
- if (t[2]) _.ops.pop();
65
- _.trys.pop(); continue;
66
- }
67
- op = body.call(thisArg, _);
68
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
- }
71
- };
72
- var __rest = (this && this.__rest) || function (s, e) {
73
- var t = {};
74
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75
- t[p] = s[p];
76
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
77
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
78
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
79
- t[p[i]] = s[p[i]];
80
- }
81
- return t;
82
- };
83
- var __importDefault = (this && this.__importDefault) || function (mod) {
84
- return (mod && mod.__esModule) ? mod : { "default": mod };
85
- };
86
- Object.defineProperty(exports, "__esModule", { value: true });
87
- var generaltranslation_1 = __importStar(require("generaltranslation"));
88
- var RemoteDictionaryManager_1 = __importDefault(require("./RemoteDictionaryManager"));
89
- var getDictionaryEntry_1 = __importDefault(require("../dictionary/getDictionaryEntry"));
90
- var LocalDictionaryManager_1 = __importDefault(require("./LocalDictionaryManager"));
91
- var defaultGTProps_1 = __importDefault(require("../types/defaultGTProps"));
92
- var I18NConfiguration = /** @class */ (function () {
93
- function I18NConfiguration(_a) {
94
- var
95
- // Cloud integration
96
- apiKey = _a.apiKey, projectID = _a.projectID, baseURL = _a.baseURL, cacheURL = _a.cacheURL, remoteSource = _a.remoteSource, automaticTranslation = _a.automaticTranslation,
97
- // Locale info
98
- getLocale = _a.getLocale, defaultLocale = _a.defaultLocale, approvedLocales = _a.approvedLocales,
99
- // Render method
100
- renderPrevious = _a.renderPrevious, renderMethod = _a.renderMethod, renderTimeout = _a.renderTimeout,
101
- // Dictionaries
102
- dictionary = _a.dictionary, dictionaryName = _a.dictionaryName,
103
- // Translations
104
- translations = _a.translations,
105
- // Batching config
106
- maxConcurrentRequests = _a.maxConcurrentRequests, batchInterval = _a.batchInterval,
107
- // Other metadata
108
- getMetadata = _a.getMetadata, metadata = __rest(_a, ["apiKey", "projectID", "baseURL", "cacheURL", "remoteSource", "automaticTranslation", "getLocale", "defaultLocale", "approvedLocales", "renderPrevious", "renderMethod", "renderTimeout", "dictionary", "dictionaryName", "translations", "maxConcurrentRequests", "batchInterval", "getMetadata"]);
109
- // Cloud integration
110
- this.projectID = projectID;
111
- this.remoteSource = (cacheURL && remoteSource) ? true : false;
112
- this.automaticTranslation = (baseURL && automaticTranslation && apiKey) ? true : false;
113
- // Validate required parameters
114
- if (!projectID && ((this.automaticTranslation && baseURL === defaultGTProps_1.default.baseURL) || (this.remoteSource && cacheURL === defaultGTProps_1.default.cacheURL))) {
115
- throw new Error("gt-react Error: General Translation cloud services require a project ID! Find yours at www.generaltranslation.com/dashboard.");
116
- }
117
- // Locales
118
- this.getLocale = getLocale;
119
- this.defaultLocale = defaultLocale;
120
- this.approvedLocales = approvedLocales;
121
- // Render method
122
- this.renderPrevious = renderPrevious;
123
- this.renderMethod = renderMethod;
124
- this.renderTimeout = renderTimeout;
125
- // Dictionaries
126
- this.dictionary = dictionary;
127
- this.dictionaryName = dictionaryName;
128
- // Local translations
129
- this.translations = translations;
130
- // GT
131
- this.gt = new generaltranslation_1.default({ projectID: projectID, apiKey: apiKey, defaultLanguage: defaultLocale, baseURL: baseURL });
132
- // Other metadata
133
- this.getMetadata = getMetadata;
134
- this.metadata = __assign(__assign({ projectID: this.projectID, defaultLanguage: this.defaultLocale, dictionaryName: dictionaryName }, (this.renderTimeout && { timeout: this.renderTimeout - batchInterval })), metadata);
135
- // Dictionary managers
136
- if (this.translations) {
137
- this._localDictionaryManager = new LocalDictionaryManager_1.default({
138
- translations: this.translations
139
- });
140
- }
141
- if (this.remoteSource) {
142
- this._remoteDictionaryManager = RemoteDictionaryManager_1.default;
143
- this._remoteDictionaryManager.setConfig({
144
- cacheURL: cacheURL,
145
- projectID: projectID
146
- });
147
- }
148
- // Batching
149
- this.maxConcurrentRequests = maxConcurrentRequests;
150
- this.batchInterval = batchInterval;
151
- this._queue = [];
152
- this._activeRequests = 0;
153
- this._translationCache = new Map(); // cache for ongoing promises, so things aren't translated twice
154
- this._startBatching();
155
- }
156
- /**
157
- * Gets the application's default locale
158
- * @returns {string} A BCP-47 language tag
159
- */
160
- I18NConfiguration.prototype.getDefaultLocale = function () {
161
- return this.defaultLocale;
162
- };
163
- /**
164
- * Gets the list of approved locales for this app
165
- * @returns {string[] | undefined} A list of BCP-47 language tags, or undefined if none were provided
166
- */
167
- I18NConfiguration.prototype.getApprovedLocales = function () {
168
- return this.approvedLocales;
169
- };
170
- /**
171
- * Get dictionary
172
- * @returns The entire dictionary, or an empty object if none found
173
- */
174
- I18NConfiguration.prototype.getDictionary = function () {
175
- return this.dictionary;
176
- };
177
- /**
178
- * Gets the name of the current dictionary
179
- * @returns {string} A BCP-47 language tag
180
- */
181
- I18NConfiguration.prototype.getDictionaryName = function () {
182
- return this.dictionaryName;
183
- };
184
- /**
185
- * Get an entry from the dictionary
186
- * @returns An entry from the dictionary determined by id
187
- */
188
- I18NConfiguration.prototype.getDictionaryEntry = function (id) {
189
- return (0, getDictionaryEntry_1.default)(id, this.dictionary);
190
- };
191
- /**
192
- * Get an entry from the dictionary
193
- * @returns An entry from the dictionary determined by id
194
- */
195
- I18NConfiguration.prototype.automaticTranslationEnabled = function () {
196
- return this.automaticTranslation;
197
- };
198
- /**
199
- * Get the rendering instructions
200
- * @returns An object containing the current method and timeout.
201
- * As of 7/31/24: method is "skeleton", "replace", "hang", "subtle".
202
- * Timeout is a number or null, representing no assigned timeout.
203
- * renderPrevious determines whether a non-matching previous entry should be rendered while the new translation loads.
204
- */
205
- I18NConfiguration.prototype.getRenderSettings = function () {
206
- return {
207
- method: this.renderMethod,
208
- timeout: this.renderTimeout,
209
- renderPrevious: this.renderPrevious
210
- };
211
- };
212
- /**
213
- * Check if translation is required based on the user's locale
214
- * @param locale - The user's locale
215
- * @returns True if translation is required, otherwise false
216
- */
217
- I18NConfiguration.prototype.translationRequired = function (locale) {
218
- if (!locale)
219
- return false;
220
- if (this.approvedLocales && !this.approvedLocales.some(function (approvedLocale) { return (0, generaltranslation_1.isSameLanguage)(locale, approvedLocale); }))
221
- return false;
222
- if ((0, generaltranslation_1.isSameLanguage)(locale, this.defaultLocale))
223
- return false;
224
- return true;
225
- };
226
- /**
227
- * Get the translation dictionaries for this user's locale, if they exist
228
- * @param locale - The language set by the user
229
- * @param dictionaryName - User-defined dictionary name, for distinguishing between multiple translation dictionaries for a single language.
230
- * @returns A promise that resolves to the translations.
231
- */
232
- I18NConfiguration.prototype.getTranslations = function (locale_1) {
233
- return __awaiter(this, arguments, void 0, function (locale, dictionaryName) {
234
- var translations, localPromise, remotePromise, _a, local, remote;
235
- if (dictionaryName === void 0) { dictionaryName = this.dictionaryName; }
236
- return __generator(this, function (_b) {
237
- switch (_b.label) {
238
- case 0:
239
- translations = {};
240
- localPromise = this._localDictionaryManager ? this._localDictionaryManager.getDictionary(locale) : Promise.resolve(undefined);
241
- remotePromise = this._remoteDictionaryManager ? this._remoteDictionaryManager.getDictionary(locale, dictionaryName) : Promise.resolve(undefined);
242
- return [4 /*yield*/, Promise.all([localPromise, remotePromise])];
243
- case 1:
244
- _a = _b.sent(), local = _a[0], remote = _a[1];
245
- if (local !== undefined) {
246
- translations.local = local;
247
- }
248
- if (remote !== undefined) {
249
- translations.remote = remote;
250
- }
251
- return [2 /*return*/, translations];
252
- }
253
- });
254
- });
255
- };
256
- /**
257
- * Get the entry in the translation dictionary for the user's locale, if it exists
258
- * @param locale - The user's locale
259
- * @param key - Key in the dictionary. For strings, the original language version of that string. For React children, a hash.
260
- * @param dictionaryName - User-defined dictionary name, for distinguishing between multiple translation dictionaries for a single language.
261
- * @param translations - Optional translations to search.
262
- * @returns A promise that resolves to the a value in the translations.
263
- */
264
- I18NConfiguration.prototype.getTranslation = function (locale_1, key_1) {
265
- return __awaiter(this, arguments, void 0, function (locale, key, id, dictionaryName, translations) {
266
- var _a, translation;
267
- if (id === void 0) { id = key; }
268
- if (dictionaryName === void 0) { dictionaryName = this.dictionaryName; }
269
- return __generator(this, function (_b) {
270
- switch (_b.label) {
271
- case 0:
272
- _a = translations;
273
- if (_a) return [3 /*break*/, 2];
274
- return [4 /*yield*/, this.getTranslations(locale, dictionaryName)];
275
- case 1:
276
- _a = (_b.sent());
277
- _b.label = 2;
278
- case 2:
279
- translations = _a;
280
- if (translations.local) {
281
- translation = (0, getDictionaryEntry_1.default)(id, translations.local);
282
- if (translation)
283
- return [2 /*return*/, translation];
284
- }
285
- if (translations.remote) {
286
- if (translations.remote[id] && translations.remote[id].k === key)
287
- return [2 /*return*/, translations.remote[id].t];
288
- }
289
- return [2 /*return*/, null];
290
- }
291
- });
292
- });
293
- };
294
- /**
295
- * Translate content into language
296
- * @param params - Parameters for translation
297
- * @returns Translated string
298
- */
299
- I18NConfiguration.prototype.translate = function (params) {
300
- return __awaiter(this, void 0, void 0, function () {
301
- var cacheKey, content, targetLanguage, options, dictionaryName, translationPromise;
302
- var _this = this;
303
- var _a;
304
- return __generator(this, function (_b) {
305
- cacheKey = JSON.stringify(params);
306
- if (this._translationCache.has(cacheKey)) {
307
- return [2 /*return*/, this._translationCache.get(cacheKey)];
308
- }
309
- content = params.content, targetLanguage = params.targetLanguage, options = params.options;
310
- dictionaryName = ((_a = params.options) === null || _a === void 0 ? void 0 : _a.dictionaryName) || this.dictionaryName;
311
- translationPromise = new Promise(function (resolve, reject) {
312
- _this._queue.push({
313
- type: "string",
314
- data: {
315
- content: content,
316
- targetLanguage: targetLanguage,
317
- projectID: _this.projectID,
318
- metadata: __assign(__assign(__assign({}, _this.metadata), _this.getMetadata()), options)
319
- },
320
- revalidate: (_this._remoteDictionaryManager) ? _this._remoteDictionaryManager.getTranslationRequested(targetLanguage, dictionaryName) : false,
321
- resolve: resolve,
322
- reject: reject
323
- });
324
- });
325
- this._translationCache.set(cacheKey, translationPromise);
326
- return [2 /*return*/, translationPromise.finally(function () { return _this._translationCache.delete(cacheKey); })];
327
- });
328
- });
329
- };
330
- /**
331
- * Translate the children components
332
- * @param params - Parameters for translation
333
- * @returns A promise that resolves when translation is complete
334
- */
335
- I18NConfiguration.prototype.translateChildren = function (params) {
336
- return __awaiter(this, void 0, void 0, function () {
337
- var cacheKey, children, targetLanguage, metadata, dictionaryName, translationPromise;
338
- var _this = this;
339
- var _a;
340
- return __generator(this, function (_b) {
341
- cacheKey = JSON.stringify(params);
342
- if (this._translationCache.has(cacheKey)) {
343
- return [2 /*return*/, this._translationCache.get(cacheKey)];
344
- }
345
- children = params.children, targetLanguage = params.targetLanguage, metadata = params.metadata;
346
- dictionaryName = ((_a = params.options) === null || _a === void 0 ? void 0 : _a.dictionaryName) || this.dictionaryName;
347
- translationPromise = new Promise(function (resolve, reject) {
348
- _this._queue.push({
349
- type: "react",
350
- data: {
351
- children: children,
352
- targetLanguage: targetLanguage,
353
- metadata: __assign(__assign(__assign({}, _this.metadata), _this.getMetadata()), metadata)
354
- },
355
- revalidate: (_this._remoteDictionaryManager) ? _this._remoteDictionaryManager.getTranslationRequested(targetLanguage, dictionaryName) : false,
356
- resolve: resolve,
357
- reject: reject
358
- });
359
- });
360
- this._translationCache.set(cacheKey, translationPromise);
361
- return [2 /*return*/, translationPromise.finally(function () { return _this._translationCache.delete(cacheKey); })];
362
- });
363
- });
364
- };
365
- /**
366
- * Send a batch request for React translation
367
- * @param batch - The batch of requests to be sent
368
- */
369
- I18NConfiguration.prototype._sendBatchRequest = function (batch) {
370
- return __awaiter(this, void 0, void 0, function () {
371
- var bundlePromise, results_1, error_1;
372
- var _this = this;
373
- return __generator(this, function (_a) {
374
- switch (_a.label) {
375
- case 0:
376
- this._activeRequests++;
377
- _a.label = 1;
378
- case 1:
379
- _a.trys.push([1, 3, 4, 5]);
380
- bundlePromise = this.gt.translateBundle(batch);
381
- batch.forEach(function (item) {
382
- if (_this._remoteDictionaryManager && item.cache)
383
- _this._remoteDictionaryManager.setTranslationRequested(item.data.targetLanguage, item.data.metadata.dictionaryName);
384
- });
385
- return [4 /*yield*/, bundlePromise];
386
- case 2:
387
- results_1 = _a.sent();
388
- batch.forEach(function (item, index) {
389
- var result = results_1[index];
390
- if (!result)
391
- return item.reject('Translation failed.');
392
- if (result && typeof result === 'object') {
393
- item.resolve(result.translation);
394
- if (result.translation && result.language && result.reference && _this._remoteDictionaryManager) {
395
- _this._remoteDictionaryManager.setDictionary(result.language, result.reference.dictionaryName, result.reference.key, result.reference.id, result.translation);
396
- }
397
- }
398
- });
399
- return [3 /*break*/, 5];
400
- case 3:
401
- error_1 = _a.sent();
402
- console.error(error_1);
403
- batch.forEach(function (item) { return item.reject(error_1); });
404
- return [3 /*break*/, 5];
405
- case 4:
406
- this._activeRequests--;
407
- return [7 /*endfinally*/];
408
- case 5: return [2 /*return*/];
409
- }
410
- });
411
- });
412
- };
413
- /**
414
- * Start the batching process with a set interval
415
- */
416
- I18NConfiguration.prototype._startBatching = function () {
417
- var _this = this;
418
- setInterval(function () {
419
- if (_this._queue.length > 0 && _this._activeRequests < _this.maxConcurrentRequests) {
420
- _this._sendBatchRequest(_this._queue);
421
- _this._queue = [];
422
- }
423
- }, this.batchInterval);
424
- };
425
- return I18NConfiguration;
426
- }());
427
- exports.default = I18NConfiguration;
428
- //# sourceMappingURL=I18NConfiguration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"I18NConfiguration.js","sourceRoot":"","sources":["../../src/config/I18NConfiguration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAwD;AACxD,sFAA6F;AAC7F,wFAAkE;AAClE,oFAA8D;AAC9D,2EAAqD;AAwBrD;IAgCI,2BAAY,EAoBc;QAlBtB;QADA,oBAAoB;QACpB,MAAM,YAAA,EAAE,SAAS,eAAA,EACjB,OAAO,aAAA,EAAE,QAAQ,cAAA,EACjB,YAAY,kBAAA,EAAE,oBAAoB,0BAAA;QAClC,cAAc;QACd,SAAS,eAAA,EACT,aAAa,mBAAA,EACb,eAAe,qBAAA;QACf,gBAAgB;QAChB,cAAc,oBAAA,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,aAAa,CACvC,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,SAAS,CAAC,cAAc,EAC/B,MAAM,CAAC,SAAS,CAAC,GAAG,EACpB,MAAM,CAAC,SAAS,CAAC,EAAE,EACnB,MAAM,CAAC,WAAW,CACrB,CAAC;gCACN,CAAC;4BACL,CAAC;wBACL,CAAC,CAAC,CAAC;;;;wBAEH,OAAO,CAAC,KAAK,CAAC,OAAK,CAAC,CAAC;wBACrB,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,MAAM,CAAC,OAAK,CAAC,EAAlB,CAAkB,CAAC,CAAC;;;wBAE1C,IAAI,CAAC,eAAe,EAAE,CAAC;;;;;;KAE9B;IAED;;MAEE;IACM,0CAAc,GAAtB;QAAA,iBAOC;QANG,WAAW,CAAC;YACR,IAAI,KAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,KAAI,CAAC,eAAe,GAAG,KAAI,CAAC,qBAAqB,EAAE,CAAC;gBAC9E,KAAI,CAAC,iBAAiB,CAAC,KAAI,CAAC,MAAM,CAAC,CAAC;gBACpC,KAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACrB,CAAC;QACL,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3B,CAAC;IAEL,wBAAC;AAAD,CAAC,AA3UD,IA2UC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * LocalDictionaryManager is responsible for managing dictionaries loaded from local file paths.
3
- * @class
4
- */
5
- export default class LocalDictionaryManager {
6
- private translations;
7
- private localeCache;
8
- private dictionaryMap;
9
- private fetchPromises;
10
- /**
11
- * Creates an instance of LocalDictionaryManager.
12
- * @param {Object} params - Parameters object.
13
- * @param {Record<string, () => Promise<Record<string, any>>>} params.translations - A mapping of locale to a function that imports the corresponding dictionary.
14
- */
15
- constructor({ translations }: {
16
- translations: Record<string, () => Promise<Record<string, any>>>;
17
- });
18
- /**
19
- * Retrieves a dictionary based on locale.
20
- * @param {string} locale - The locale of the dictionary.
21
- * @returns {Promise<Record<string, any> | null>} The dictionary data or null if not found.
22
- */
23
- getDictionary(locale: string): Promise<Record<string, any> | null>;
24
- /**
25
- * Fetches a dictionary from the translations object using the provided function.
26
- * @param {string} locale - The locale of the dictionary.
27
- * @returns {Promise<Record<string, any> | null>} The fetched dictionary data or null if not found.
28
- */
29
- private _fetchDictionary;
30
- }
31
- //# sourceMappingURL=LocalDictionaryManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LocalDictionaryManager.d.ts","sourceRoot":"","sources":["../../src/config/LocalDictionaryManager.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IACvC,OAAO,CAAC,YAAY,CAAqD;IACzE,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,aAAa,CAAmD;IAExE;;;;OAIG;gBACS,EAAE,YAAY,EAAE,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;KAAE;IAOlG;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IA6CxE;;;;OAIG;YACW,gBAAgB;CAWjC"}
@@ -1,139 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var generaltranslation_1 = require("generaltranslation");
40
- /**
41
- * LocalDictionaryManager is responsible for managing dictionaries loaded from local file paths.
42
- * @class
43
- */
44
- var LocalDictionaryManager = /** @class */ (function () {
45
- /**
46
- * Creates an instance of LocalDictionaryManager.
47
- * @param {Object} params - Parameters object.
48
- * @param {Record<string, () => Promise<Record<string, any>>>} params.translations - A mapping of locale to a function that imports the corresponding dictionary.
49
- */
50
- function LocalDictionaryManager(_a) {
51
- var translations = _a.translations;
52
- this.translations = translations;
53
- this.localeCache = new Map();
54
- this.dictionaryMap = new Map();
55
- this.fetchPromises = new Map();
56
- }
57
- /**
58
- * Retrieves a dictionary based on locale.
59
- * @param {string} locale - The locale of the dictionary.
60
- * @returns {Promise<Record<string, any> | null>} The dictionary data or null if not found.
61
- */
62
- LocalDictionaryManager.prototype.getDictionary = function (locale) {
63
- return __awaiter(this, void 0, void 0, function () {
64
- var finalLocale, _i, _a, key, fetchPromise, retrievedDictionary;
65
- return __generator(this, function (_b) {
66
- switch (_b.label) {
67
- case 0:
68
- // Check if the dictionary is already cached
69
- if (this.dictionaryMap.has(locale)) {
70
- return [2 /*return*/, this.dictionaryMap.get(locale) || null];
71
- }
72
- if (!this.fetchPromises.has(locale)) return [3 /*break*/, 2];
73
- return [4 /*yield*/, this.fetchPromises.get(locale)];
74
- case 1: return [2 /*return*/, (_b.sent()) || null];
75
- case 2:
76
- finalLocale = locale;
77
- if (!this.translations[finalLocale]) {
78
- finalLocale = this.localeCache.get(locale) || '';
79
- if (!finalLocale) {
80
- for (_i = 0, _a = Object.keys(this.translations); _i < _a.length; _i++) {
81
- key = _a[_i];
82
- if ((0, generaltranslation_1.isSameLanguage)(key, locale)) {
83
- finalLocale = key;
84
- break;
85
- }
86
- }
87
- this.localeCache.set(locale, finalLocale);
88
- }
89
- }
90
- // If no valid finalLocale is found, return null
91
- if (!finalLocale || !this.translations[finalLocale]) {
92
- return [2 /*return*/, null];
93
- }
94
- fetchPromise = this._fetchDictionary(finalLocale);
95
- this.fetchPromises.set(locale, fetchPromise);
96
- return [4 /*yield*/, fetchPromise];
97
- case 3:
98
- retrievedDictionary = _b.sent();
99
- this.fetchPromises.delete(locale);
100
- if (retrievedDictionary) {
101
- this.dictionaryMap.set(locale, retrievedDictionary);
102
- }
103
- return [2 /*return*/, retrievedDictionary];
104
- }
105
- });
106
- });
107
- };
108
- /**
109
- * Fetches a dictionary from the translations object using the provided function.
110
- * @param {string} locale - The locale of the dictionary.
111
- * @returns {Promise<Record<string, any> | null>} The fetched dictionary data or null if not found.
112
- */
113
- LocalDictionaryManager.prototype._fetchDictionary = function (locale) {
114
- return __awaiter(this, void 0, void 0, function () {
115
- var loadDictionary, dictionary, error_1;
116
- return __generator(this, function (_a) {
117
- switch (_a.label) {
118
- case 0:
119
- _a.trys.push([0, 2, , 3]);
120
- loadDictionary = this.translations[locale];
121
- if (!loadDictionary)
122
- throw new Error("No translation function for locale: ".concat(locale));
123
- return [4 /*yield*/, loadDictionary()];
124
- case 1:
125
- dictionary = _a.sent();
126
- return [2 /*return*/, dictionary];
127
- case 2:
128
- error_1 = _a.sent();
129
- console.error("Error loading dictionary for locale ".concat(locale, ":"), error_1);
130
- return [2 /*return*/, null];
131
- case 3: return [2 /*return*/];
132
- }
133
- });
134
- });
135
- };
136
- return LocalDictionaryManager;
137
- }());
138
- exports.default = LocalDictionaryManager;
139
- //# sourceMappingURL=LocalDictionaryManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LocalDictionaryManager.js","sourceRoot":"","sources":["../../src/config/LocalDictionaryManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAoD;AAEpD;;;GAGG;AACH;IAMI;;;;OAIG;IACH,gCAAY,EAAsF;YAApF,YAAY,kBAAA;QACtB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACG,8CAAa,GAAnB,UAAoB,MAAc;;;;;;wB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