gt-react 3.1.39 → 3.1.41

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 (289) hide show
  1. package/dist/cjs/client/ClientProvider.d.ts +19 -0
  2. package/dist/cjs/client/ClientProvider.d.ts.map +1 -0
  3. package/dist/cjs/client/ClientProvider.js +29 -0
  4. package/dist/cjs/client/ClientProvider.js.map +1 -0
  5. package/dist/cjs/client/client-only/GTClientProvider.d.ts +13 -0
  6. package/dist/cjs/client/client-only/GTClientProvider.d.ts.map +1 -0
  7. package/dist/cjs/client/client-only/GTClientProvider.js +95 -0
  8. package/dist/cjs/client/client-only/GTClientProvider.js.map +1 -0
  9. package/dist/cjs/client/client-only/helpers/renderDictionary.d.ts +2 -0
  10. package/dist/cjs/client/client-only/helpers/renderDictionary.d.ts.map +1 -0
  11. package/dist/cjs/client/client-only/helpers/renderDictionary.js +150 -0
  12. package/dist/cjs/client/client-only/helpers/renderDictionary.js.map +1 -0
  13. package/dist/cjs/client/hooks/useBrowserLocale.d.ts +7 -0
  14. package/dist/cjs/client/hooks/useBrowserLocale.d.ts.map +1 -0
  15. package/dist/cjs/client/hooks/useBrowserLocale.js +41 -0
  16. package/dist/cjs/client/hooks/useBrowserLocale.js.map +1 -0
  17. package/dist/cjs/client/hooks/useDefaultLocale.d.ts +5 -0
  18. package/dist/cjs/client/hooks/useDefaultLocale.d.ts.map +1 -0
  19. package/dist/cjs/client/hooks/useDefaultLocale.js +13 -0
  20. package/dist/cjs/client/hooks/useDefaultLocale.js.map +1 -0
  21. package/dist/cjs/client/hooks/useGT.d.ts +10 -0
  22. package/dist/cjs/client/hooks/useGT.d.ts.map +1 -0
  23. package/dist/cjs/client/hooks/useGT.js +54 -0
  24. package/dist/cjs/client/hooks/useGT.js.map +1 -0
  25. package/dist/cjs/client/hooks/useLocale.d.ts +5 -0
  26. package/dist/cjs/client/hooks/useLocale.d.ts.map +1 -0
  27. package/dist/cjs/client/hooks/useLocale.js +13 -0
  28. package/dist/cjs/client/hooks/useLocale.js.map +1 -0
  29. package/dist/cjs/client/plural/ClientPlural.d.ts +28 -0
  30. package/dist/cjs/client/plural/ClientPlural.d.ts.map +1 -0
  31. package/dist/cjs/client/plural/ClientPlural.js +78 -0
  32. package/dist/cjs/client/plural/ClientPlural.js.map +1 -0
  33. package/dist/cjs/client/value/ClientValue.d.ts +16 -0
  34. package/dist/cjs/client/value/ClientValue.d.ts.map +1 -0
  35. package/dist/cjs/client/value/ClientValue.js +43 -0
  36. package/dist/cjs/client/value/ClientValue.js.map +1 -0
  37. package/dist/cjs/client/value/RenderClientVariable.d.ts +6 -0
  38. package/dist/cjs/client/value/RenderClientVariable.d.ts.map +1 -0
  39. package/dist/cjs/client/value/RenderClientVariable.js +106 -0
  40. package/dist/cjs/client/value/RenderClientVariable.js.map +1 -0
  41. package/dist/cjs/client/variables/ClientCurrency.d.ts +13 -0
  42. package/dist/cjs/client/variables/ClientCurrency.d.ts.map +1 -0
  43. package/dist/cjs/client/variables/ClientCurrency.js +31 -0
  44. package/dist/cjs/client/variables/ClientCurrency.js.map +1 -0
  45. package/dist/cjs/client/variables/ClientDateTime.d.ts +12 -0
  46. package/dist/cjs/client/variables/ClientDateTime.d.ts.map +1 -0
  47. package/dist/cjs/client/variables/ClientDateTime.js +45 -0
  48. package/dist/cjs/client/variables/ClientDateTime.js.map +1 -0
  49. package/dist/cjs/client/variables/ClientNum.d.ts +12 -0
  50. package/dist/cjs/client/variables/ClientNum.d.ts.map +1 -0
  51. package/dist/cjs/client/variables/ClientNum.js +29 -0
  52. package/dist/cjs/client/variables/ClientNum.js.map +1 -0
  53. package/dist/cjs/client/variables/ClientVar.d.ts +21 -0
  54. package/dist/cjs/client/variables/ClientVar.d.ts.map +1 -0
  55. package/dist/cjs/client/variables/ClientVar.js +26 -0
  56. package/dist/cjs/client/variables/ClientVar.js.map +1 -0
  57. package/dist/cjs/client.d.ts +12 -0
  58. package/dist/cjs/client.d.ts.map +1 -0
  59. package/dist/cjs/client.js +27 -0
  60. package/dist/cjs/client.js.map +1 -0
  61. package/dist/cjs/config/I18NConfiguration.d.ts +135 -0
  62. package/dist/cjs/config/I18NConfiguration.d.ts.map +1 -0
  63. package/dist/cjs/config/I18NConfiguration.js +343 -0
  64. package/dist/cjs/config/I18NConfiguration.js.map +1 -0
  65. package/dist/cjs/config/LocalDictionaryManager.d.ts +31 -0
  66. package/dist/cjs/config/LocalDictionaryManager.d.ts.map +1 -0
  67. package/dist/cjs/config/LocalDictionaryManager.js +95 -0
  68. package/dist/cjs/config/LocalDictionaryManager.js.map +1 -0
  69. package/dist/cjs/config/RemoteDictionaryManager.d.ts +59 -0
  70. package/dist/cjs/config/RemoteDictionaryManager.d.ts.map +1 -0
  71. package/dist/cjs/config/RemoteDictionaryManager.js +120 -0
  72. package/dist/cjs/config/RemoteDictionaryManager.js.map +1 -0
  73. package/dist/cjs/config/determineLocale.d.ts +2 -0
  74. package/dist/cjs/config/determineLocale.d.ts.map +1 -0
  75. package/dist/cjs/config/determineLocale.js +32 -0
  76. package/dist/cjs/config/determineLocale.js.map +1 -0
  77. package/dist/cjs/config/local/getDefaultFromEnv.d.ts +12 -0
  78. package/dist/cjs/config/local/getDefaultFromEnv.d.ts.map +1 -0
  79. package/dist/cjs/config/local/getDefaultFromEnv.js +21 -0
  80. package/dist/cjs/config/local/getDefaultFromEnv.js.map +1 -0
  81. package/dist/cjs/dictionary/createDictFunction.d.ts +3 -0
  82. package/dist/cjs/dictionary/createDictFunction.d.ts.map +1 -0
  83. package/dist/cjs/dictionary/createDictFunction.js +14 -0
  84. package/dist/cjs/dictionary/createDictFunction.js.map +1 -0
  85. package/dist/cjs/dictionary/createExecuteTFunction.d.ts +12 -0
  86. package/dist/cjs/dictionary/createExecuteTFunction.d.ts.map +1 -0
  87. package/dist/cjs/dictionary/createExecuteTFunction.js +94 -0
  88. package/dist/cjs/dictionary/createExecuteTFunction.js.map +1 -0
  89. package/dist/cjs/dictionary/createGetGTFunction.d.ts +3 -0
  90. package/dist/cjs/dictionary/createGetGTFunction.d.ts.map +1 -0
  91. package/dist/cjs/dictionary/createGetGTFunction.js +10 -0
  92. package/dist/cjs/dictionary/createGetGTFunction.js.map +1 -0
  93. package/dist/cjs/dictionary/getDictionaryEntry.d.ts +2 -0
  94. package/dist/cjs/dictionary/getDictionaryEntry.d.ts.map +1 -0
  95. package/dist/cjs/dictionary/getDictionaryEntry.js +14 -0
  96. package/dist/cjs/dictionary/getDictionaryEntry.js.map +1 -0
  97. package/dist/cjs/index.d.ts +6 -0
  98. package/dist/cjs/index.d.ts.map +1 -0
  99. package/dist/cjs/index.js +15 -0
  100. package/dist/cjs/index.js.map +1 -0
  101. package/dist/cjs/intl/createIntlFunction.d.ts +6 -0
  102. package/dist/cjs/intl/createIntlFunction.d.ts.map +1 -0
  103. package/dist/cjs/intl/createIntlFunction.js +48 -0
  104. package/dist/cjs/intl/createIntlFunction.js.map +1 -0
  105. package/dist/cjs/middleware/cookieSettings.d.ts +2 -0
  106. package/dist/cjs/middleware/cookieSettings.d.ts.map +1 -0
  107. package/dist/cjs/middleware/cookieSettings.js +5 -0
  108. package/dist/cjs/middleware/cookieSettings.js.map +1 -0
  109. package/dist/cjs/middleware/createNextMiddleware.d.ts +10 -0
  110. package/dist/cjs/middleware/createNextMiddleware.d.ts.map +1 -0
  111. package/dist/cjs/middleware/createNextMiddleware.js +151 -0
  112. package/dist/cjs/middleware/createNextMiddleware.js.map +1 -0
  113. package/dist/cjs/middleware.d.ts +3 -0
  114. package/dist/cjs/middleware.d.ts.map +1 -0
  115. package/dist/cjs/middleware.js +9 -0
  116. package/dist/cjs/middleware.js.map +1 -0
  117. package/dist/cjs/next/imports/imports.d.ts +6 -0
  118. package/dist/cjs/next/imports/imports.d.ts.map +1 -0
  119. package/dist/cjs/next/imports/imports.js +84 -0
  120. package/dist/cjs/next/imports/imports.js.map +1 -0
  121. package/dist/cjs/next/requestFunctions.d.ts +21 -0
  122. package/dist/cjs/next/requestFunctions.d.ts.map +1 -0
  123. package/dist/cjs/next/requestFunctions.js +58 -0
  124. package/dist/cjs/next/requestFunctions.js.map +1 -0
  125. package/dist/cjs/next.d.ts +38 -0
  126. package/dist/cjs/next.d.ts.map +1 -0
  127. package/dist/cjs/next.js +58 -0
  128. package/dist/cjs/next.js.map +1 -0
  129. package/dist/cjs/primitives/calculateID.d.ts +2 -0
  130. package/dist/cjs/primitives/calculateID.d.ts.map +1 -0
  131. package/dist/cjs/primitives/calculateID.js +49 -0
  132. package/dist/cjs/primitives/calculateID.js.map +1 -0
  133. package/dist/cjs/primitives/createValues.d.ts +6 -0
  134. package/dist/cjs/primitives/createValues.d.ts.map +1 -0
  135. package/dist/cjs/primitives/createValues.js +16 -0
  136. package/dist/cjs/primitives/createValues.js.map +1 -0
  137. package/dist/cjs/primitives/defaultVariableNames.d.ts +3 -0
  138. package/dist/cjs/primitives/defaultVariableNames.d.ts.map +1 -0
  139. package/dist/cjs/primitives/defaultVariableNames.js +10 -0
  140. package/dist/cjs/primitives/defaultVariableNames.js.map +1 -0
  141. package/dist/cjs/primitives/flattenDictionary.d.ts +9 -0
  142. package/dist/cjs/primitives/flattenDictionary.d.ts.map +1 -0
  143. package/dist/cjs/primitives/flattenDictionary.js +29 -0
  144. package/dist/cjs/primitives/flattenDictionary.js.map +1 -0
  145. package/dist/cjs/primitives/getDictionaryReference.d.ts +8 -0
  146. package/dist/cjs/primitives/getDictionaryReference.d.ts.map +1 -0
  147. package/dist/cjs/primitives/getDictionaryReference.js +13 -0
  148. package/dist/cjs/primitives/getDictionaryReference.js.map +1 -0
  149. package/dist/cjs/primitives/getEntryMetadata.d.ts +5 -0
  150. package/dist/cjs/primitives/getEntryMetadata.d.ts.map +1 -0
  151. package/dist/cjs/primitives/getEntryMetadata.js +17 -0
  152. package/dist/cjs/primitives/getEntryMetadata.js.map +1 -0
  153. package/dist/cjs/primitives/getEntryTranslationType.d.ts +2 -0
  154. package/dist/cjs/primitives/getEntryTranslationType.d.ts.map +1 -0
  155. package/dist/cjs/primitives/getEntryTranslationType.js +31 -0
  156. package/dist/cjs/primitives/getEntryTranslationType.js.map +1 -0
  157. package/dist/cjs/primitives/getPluralBranch.d.ts +14 -0
  158. package/dist/cjs/primitives/getPluralBranch.d.ts.map +1 -0
  159. package/dist/cjs/primitives/getPluralBranch.js +88 -0
  160. package/dist/cjs/primitives/getPluralBranch.js.map +1 -0
  161. package/dist/cjs/primitives/getRenderAttributes.d.ts +5 -0
  162. package/dist/cjs/primitives/getRenderAttributes.d.ts.map +1 -0
  163. package/dist/cjs/primitives/getRenderAttributes.js +24 -0
  164. package/dist/cjs/primitives/getRenderAttributes.js.map +1 -0
  165. package/dist/cjs/primitives/getValueBranch.d.ts +9 -0
  166. package/dist/cjs/primitives/getValueBranch.d.ts.map +1 -0
  167. package/dist/cjs/primitives/getValueBranch.js +67 -0
  168. package/dist/cjs/primitives/getValueBranch.js.map +1 -0
  169. package/dist/cjs/primitives/hasTransformation.d.ts +3 -0
  170. package/dist/cjs/primitives/hasTransformation.d.ts.map +1 -0
  171. package/dist/cjs/primitives/hasTransformation.js +16 -0
  172. package/dist/cjs/primitives/hasTransformation.js.map +1 -0
  173. package/dist/cjs/primitives/isValidReactNode.d.ts +15 -0
  174. package/dist/cjs/primitives/isValidReactNode.d.ts.map +1 -0
  175. package/dist/cjs/primitives/isValidReactNode.js +27 -0
  176. package/dist/cjs/primitives/isValidReactNode.js.map +1 -0
  177. package/dist/cjs/server/T.d.ts +15 -0
  178. package/dist/cjs/server/T.d.ts.map +1 -0
  179. package/dist/cjs/server/T.js +98 -0
  180. package/dist/cjs/server/T.js.map +1 -0
  181. package/dist/cjs/server/createTComponent.d.ts +12 -0
  182. package/dist/cjs/server/createTComponent.d.ts.map +1 -0
  183. package/dist/cjs/server/createTComponent.js +31 -0
  184. package/dist/cjs/server/createTComponent.js.map +1 -0
  185. package/dist/cjs/server/helpers/Resolver.d.ts +5 -0
  186. package/dist/cjs/server/helpers/Resolver.d.ts.map +1 -0
  187. package/dist/cjs/server/helpers/Resolver.js +25 -0
  188. package/dist/cjs/server/helpers/Resolver.js.map +1 -0
  189. package/dist/cjs/server/helpers/addGTIdentifier.d.ts +11 -0
  190. package/dist/cjs/server/helpers/addGTIdentifier.d.ts.map +1 -0
  191. package/dist/cjs/server/helpers/addGTIdentifier.js +148 -0
  192. package/dist/cjs/server/helpers/addGTIdentifier.js.map +1 -0
  193. package/dist/cjs/server/helpers/writeChildrenAsObjects.d.ts +11 -0
  194. package/dist/cjs/server/helpers/writeChildrenAsObjects.d.ts.map +1 -0
  195. package/dist/cjs/server/helpers/writeChildrenAsObjects.js +116 -0
  196. package/dist/cjs/server/helpers/writeChildrenAsObjects.js.map +1 -0
  197. package/dist/cjs/server/plural/InnerPlural.d.ts +24 -0
  198. package/dist/cjs/server/plural/InnerPlural.d.ts.map +1 -0
  199. package/dist/cjs/server/plural/InnerPlural.js +35 -0
  200. package/dist/cjs/server/plural/InnerPlural.js.map +1 -0
  201. package/dist/cjs/server/plural/createPluralComponent.d.ts +12 -0
  202. package/dist/cjs/server/plural/createPluralComponent.d.ts.map +1 -0
  203. package/dist/cjs/server/plural/createPluralComponent.js +30 -0
  204. package/dist/cjs/server/plural/createPluralComponent.js.map +1 -0
  205. package/dist/cjs/server/provider/GTProvider.d.ts +13 -0
  206. package/dist/cjs/server/provider/GTProvider.d.ts.map +1 -0
  207. package/dist/cjs/server/provider/GTProvider.js +61 -0
  208. package/dist/cjs/server/provider/GTProvider.js.map +1 -0
  209. package/dist/cjs/server/provider/createGTProviderComponent.d.ts +10 -0
  210. package/dist/cjs/server/provider/createGTProviderComponent.d.ts.map +1 -0
  211. package/dist/cjs/server/provider/createGTProviderComponent.js +30 -0
  212. package/dist/cjs/server/provider/createGTProviderComponent.js.map +1 -0
  213. package/dist/cjs/server/renderChildren.d.ts +24 -0
  214. package/dist/cjs/server/renderChildren.d.ts.map +1 -0
  215. package/dist/cjs/server/renderChildren.js +177 -0
  216. package/dist/cjs/server/renderChildren.js.map +1 -0
  217. package/dist/cjs/server/value/InnerValue.d.ts +12 -0
  218. package/dist/cjs/server/value/InnerValue.d.ts.map +1 -0
  219. package/dist/cjs/server/value/InnerValue.js +30 -0
  220. package/dist/cjs/server/value/InnerValue.js.map +1 -0
  221. package/dist/cjs/server/value/createValueComponent.d.ts +13 -0
  222. package/dist/cjs/server/value/createValueComponent.d.ts.map +1 -0
  223. package/dist/cjs/server/value/createValueComponent.js +29 -0
  224. package/dist/cjs/server/value/createValueComponent.js.map +1 -0
  225. package/dist/cjs/server/value/renderVariable.d.ts +9 -0
  226. package/dist/cjs/server/value/renderVariable.d.ts.map +1 -0
  227. package/dist/cjs/server/value/renderVariable.js +66 -0
  228. package/dist/cjs/server/value/renderVariable.js.map +1 -0
  229. package/dist/cjs/server/variables/Currency/Currency.d.ts +15 -0
  230. package/dist/cjs/server/variables/Currency/Currency.d.ts.map +1 -0
  231. package/dist/cjs/server/variables/Currency/Currency.js +29 -0
  232. package/dist/cjs/server/variables/Currency/Currency.js.map +1 -0
  233. package/dist/cjs/server/variables/Currency/createCurrencyComponent.d.ts +8 -0
  234. package/dist/cjs/server/variables/Currency/createCurrencyComponent.d.ts.map +1 -0
  235. package/dist/cjs/server/variables/Currency/createCurrencyComponent.js +29 -0
  236. package/dist/cjs/server/variables/Currency/createCurrencyComponent.js.map +1 -0
  237. package/dist/cjs/server/variables/DateTime/DateTime.d.ts +13 -0
  238. package/dist/cjs/server/variables/DateTime/DateTime.d.ts.map +1 -0
  239. package/dist/cjs/server/variables/DateTime/DateTime.js +45 -0
  240. package/dist/cjs/server/variables/DateTime/DateTime.js.map +1 -0
  241. package/dist/cjs/server/variables/DateTime/createDateTimeComponent.d.ts +8 -0
  242. package/dist/cjs/server/variables/DateTime/createDateTimeComponent.d.ts.map +1 -0
  243. package/dist/cjs/server/variables/DateTime/createDateTimeComponent.js +29 -0
  244. package/dist/cjs/server/variables/DateTime/createDateTimeComponent.js.map +1 -0
  245. package/dist/cjs/server/variables/Num/Num.d.ts +14 -0
  246. package/dist/cjs/server/variables/Num/Num.d.ts.map +1 -0
  247. package/dist/cjs/server/variables/Num/Num.js +27 -0
  248. package/dist/cjs/server/variables/Num/Num.js.map +1 -0
  249. package/dist/cjs/server/variables/Num/createNumComponent.d.ts +8 -0
  250. package/dist/cjs/server/variables/Num/createNumComponent.d.ts.map +1 -0
  251. package/dist/cjs/server/variables/Num/createNumComponent.js +30 -0
  252. package/dist/cjs/server/variables/Num/createNumComponent.js.map +1 -0
  253. package/dist/cjs/server/variables/Var/Var.d.ts +12 -0
  254. package/dist/cjs/server/variables/Var/Var.d.ts.map +1 -0
  255. package/dist/cjs/server/variables/Var/Var.js +24 -0
  256. package/dist/cjs/server/variables/Var/Var.js.map +1 -0
  257. package/dist/cjs/server/variables/Var/createVarComponent.d.ts +7 -0
  258. package/dist/cjs/server/variables/Var/createVarComponent.d.ts.map +1 -0
  259. package/dist/cjs/server/variables/Var/createVarComponent.js +29 -0
  260. package/dist/cjs/server/variables/Var/createVarComponent.js.map +1 -0
  261. package/dist/cjs/server.d.ts +45 -0
  262. package/dist/cjs/server.d.ts.map +1 -0
  263. package/dist/cjs/server.js +149 -0
  264. package/dist/cjs/server.js.map +1 -0
  265. package/dist/cjs/types/CreateGTProps.d.ts +23 -0
  266. package/dist/cjs/types/CreateGTProps.d.ts.map +1 -0
  267. package/dist/cjs/types/CreateGTProps.js +3 -0
  268. package/dist/cjs/types/CreateGTProps.js.map +1 -0
  269. package/dist/cjs/types/GeneralTranslationInterface.d.ts +118 -0
  270. package/dist/cjs/types/GeneralTranslationInterface.d.ts.map +1 -0
  271. package/dist/cjs/types/GeneralTranslationInterface.js +3 -0
  272. package/dist/cjs/types/GeneralTranslationInterface.js.map +1 -0
  273. package/dist/cjs/types/Variables.d.ts +83 -0
  274. package/dist/cjs/types/Variables.d.ts.map +1 -0
  275. package/dist/cjs/types/Variables.js +3 -0
  276. package/dist/cjs/types/Variables.js.map +1 -0
  277. package/dist/cjs/types/defaultGTProps.d.ts +20 -0
  278. package/dist/cjs/types/defaultGTProps.d.ts.map +1 -0
  279. package/dist/cjs/types/defaultGTProps.js +31 -0
  280. package/dist/cjs/types/defaultGTProps.js.map +1 -0
  281. package/dist/mjs/client/client-only/helpers/renderDictionary.d.ts.map +1 -1
  282. package/dist/mjs/client/client-only/helpers/renderDictionary.js +59 -3
  283. package/dist/mjs/client/client-only/helpers/renderDictionary.js.map +1 -1
  284. package/dist/mjs/client/hooks/useGT.d.ts.map +1 -1
  285. package/dist/mjs/client/hooks/useGT.js +4 -11
  286. package/dist/mjs/client/hooks/useGT.js.map +1 -1
  287. package/dist/mjs/server/renderChildren.d.ts +1 -1
  288. package/dist/mjs/server/renderChildren.d.ts.map +1 -1
  289. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Configuration type for RemoteDictionaryManager.
3
+ */
4
+ type RemoteDictionaryConfig = {
5
+ cacheURL: string;
6
+ projectID: string;
7
+ };
8
+ /**
9
+ * Manages remote dictionaries for translation purposes.
10
+ */
11
+ export declare class RemoteDictionaryManager {
12
+ private config;
13
+ private dictionaryMap;
14
+ private fetchPromises;
15
+ private requestedTranslations;
16
+ /**
17
+ * Creates an instance of RemoteDictionaryManager.
18
+ */
19
+ constructor();
20
+ /**
21
+ * Sets the configuration for the RemoteDictionaryManager.
22
+ * @param {Partial<RemoteDictionaryConfig>} newConfig - The new configuration to apply.
23
+ */
24
+ setConfig(newConfig: Partial<RemoteDictionaryConfig>): void;
25
+ /**
26
+ * Fetches a dictionary from the remote cache.
27
+ * @param {string} reference - The dictionary reference.
28
+ * @returns {Promise<Record<string, any> | null>} The fetched dictionary or null if not found.
29
+ */
30
+ private _fetchDictionary;
31
+ /**
32
+ * Retrieves a dictionary based on locale and dictionary name.
33
+ * @param {string} locale - The locale of the dictionary.
34
+ * @param {string} dictionaryName - The name of the dictionary.
35
+ * @returns {Promise<Record<string, any> | null>} The dictionary data or null if not found.
36
+ */
37
+ getDictionary(locale: string, dictionaryName: string): Promise<Record<string, any> | null>;
38
+ /**
39
+ * Sets a new entry in the specified dictionary.
40
+ * @param {string} locale - The locale of the dictionary.
41
+ * @param {string} dictionaryName - The name of the dictionary.
42
+ * @param {string} key - The key for the new entry.
43
+ * @param {string} [id=key] - The id for the new entry, defaults to key if not provided.
44
+ * @param {any} translation - The translation value.
45
+ * @returns {boolean} True if the entry was set successfully, false otherwise.
46
+ */
47
+ setDictionary(locale: string, dictionaryName: string, key: string, id: string | undefined, translation: any): boolean;
48
+ /**
49
+ * Marks a translation as requested for a given locale and dictionary
50
+ */
51
+ setTranslationRequested(locale: string, dictionaryName: string): void;
52
+ /**
53
+ * Checks if a translation has been requested for a given locale and dictionary
54
+ */
55
+ getTranslationRequested(locale: string, dictionaryName: string): boolean;
56
+ }
57
+ declare const remoteDictionaryManager: RemoteDictionaryManager;
58
+ export default remoteDictionaryManager;
59
+ //# sourceMappingURL=RemoteDictionaryManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteDictionaryManager.d.ts","sourceRoot":"","sources":["../../../src/config/RemoteDictionaryManager.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,KAAK,sBAAsB,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAA;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAChC,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,aAAa,CAAmD;IACxE,OAAO,CAAC,qBAAqB,CAAuB;IAEpD;;OAEG;;IAWH;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,IAAI;IAI3D;;;;OAIG;YACW,gBAAgB;IAa9B;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAqBhG;;;;;;;;OAQG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,YAAM,EAAE,WAAW,EAAE,GAAG,GAAG,OAAO;IAQ/G;;OAEG;IACH,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAK9D;;OAEG;IACH,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO;CAK3E;AAED,QAAA,MAAM,uBAAuB,yBAAgC,CAAC;AAC9D,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,120 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.RemoteDictionaryManager = void 0;
16
+ const getDictionaryReference_1 = __importDefault(require("../primitives/getDictionaryReference"));
17
+ /**
18
+ * Manages remote dictionaries for translation purposes.
19
+ */
20
+ class RemoteDictionaryManager {
21
+ /**
22
+ * Creates an instance of RemoteDictionaryManager.
23
+ */
24
+ constructor() {
25
+ this.config = {
26
+ cacheURL: "https://cache.gtx.dev",
27
+ projectID: ""
28
+ };
29
+ this.dictionaryMap = new Map();
30
+ this.fetchPromises = new Map();
31
+ this.requestedTranslations = new Map();
32
+ }
33
+ /**
34
+ * Sets the configuration for the RemoteDictionaryManager.
35
+ * @param {Partial<RemoteDictionaryConfig>} newConfig - The new configuration to apply.
36
+ */
37
+ setConfig(newConfig) {
38
+ this.config = Object.assign(Object.assign({}, this.config), newConfig);
39
+ }
40
+ /**
41
+ * Fetches a dictionary from the remote cache.
42
+ * @param {string} reference - The dictionary reference.
43
+ * @returns {Promise<Record<string, any> | null>} The fetched dictionary or null if not found.
44
+ */
45
+ _fetchDictionary(reference) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ try {
48
+ const response = yield fetch(`${this.config.cacheURL}/${this.config.projectID}/${reference}`);
49
+ const result = yield response.json();
50
+ if (Object.keys(result).length) {
51
+ return result;
52
+ }
53
+ }
54
+ catch (error) {
55
+ console.error('Remote dictionary error:', error);
56
+ }
57
+ return null;
58
+ });
59
+ }
60
+ /**
61
+ * Retrieves a dictionary based on locale and dictionary name.
62
+ * @param {string} locale - The locale of the dictionary.
63
+ * @param {string} dictionaryName - The name of the dictionary.
64
+ * @returns {Promise<Record<string, any> | null>} The dictionary data or null if not found.
65
+ */
66
+ getDictionary(locale, dictionaryName) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
69
+ if (this.dictionaryMap.has(reference)) {
70
+ return this.dictionaryMap.get(reference) || null;
71
+ }
72
+ if (this.fetchPromises.has(reference)) {
73
+ return (yield this.fetchPromises.get(reference)) || null;
74
+ }
75
+ const fetchPromise = this._fetchDictionary(reference);
76
+ this.fetchPromises.set(reference, fetchPromise);
77
+ const retrievedDictionary = yield fetchPromise;
78
+ this.fetchPromises.delete(reference);
79
+ if (retrievedDictionary) {
80
+ this.dictionaryMap.set(reference, retrievedDictionary);
81
+ }
82
+ return retrievedDictionary;
83
+ });
84
+ }
85
+ /**
86
+ * Sets a new entry in the specified dictionary.
87
+ * @param {string} locale - The locale of the dictionary.
88
+ * @param {string} dictionaryName - The name of the dictionary.
89
+ * @param {string} key - The key for the new entry.
90
+ * @param {string} [id=key] - The id for the new entry, defaults to key if not provided.
91
+ * @param {any} translation - The translation value.
92
+ * @returns {boolean} True if the entry was set successfully, false otherwise.
93
+ */
94
+ setDictionary(locale, dictionaryName, key, id = key, translation) {
95
+ if (!(locale && dictionaryName && key && id && translation))
96
+ return false;
97
+ const reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
98
+ const currentDictionary = this.dictionaryMap.get(reference) || {};
99
+ this.dictionaryMap.set(reference, Object.assign(Object.assign({}, currentDictionary), { [id]: { k: key, t: translation } }));
100
+ return true;
101
+ }
102
+ /**
103
+ * Marks a translation as requested for a given locale and dictionary
104
+ */
105
+ setTranslationRequested(locale, dictionaryName) {
106
+ const reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
107
+ this.requestedTranslations.set(reference, true);
108
+ }
109
+ /**
110
+ * Checks if a translation has been requested for a given locale and dictionary
111
+ */
112
+ getTranslationRequested(locale, dictionaryName) {
113
+ const reference = (0, getDictionaryReference_1.default)(locale, dictionaryName);
114
+ return this.requestedTranslations.get(reference) ? true : false;
115
+ }
116
+ }
117
+ exports.RemoteDictionaryManager = RemoteDictionaryManager;
118
+ const remoteDictionaryManager = new RemoteDictionaryManager();
119
+ exports.default = remoteDictionaryManager;
120
+ //# sourceMappingURL=RemoteDictionaryManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteDictionaryManager.js","sourceRoot":"","sources":["../../../src/config/RemoteDictionaryManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kGAA0E;AAU1E;;GAEG;AACH,MAAa,uBAAuB;IAMhC;;OAEG;IACH;QACI,IAAI,CAAC,MAAM,GAAG;YACV,QAAQ,EAAE,uBAAuB;YACjC,SAAS,EAAE,EAAE;SAChB,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC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M,SAAS,GAAG,IAAA,gCAAsB,EAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACpE,CAAC;CAEJ;AAzGD,0DAyGC;AAED,MAAM,uBAAuB,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAC9D,kBAAe,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function determineLocale(approvedLocales?: string[], possibleLocales?: string[] | string, defaultLocale?: string): string;
2
+ //# sourceMappingURL=determineLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determineLocale.d.ts","sourceRoot":"","sources":["../../../src/config/determineLocale.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,aAAa,GAAE,MAAW,GAAG,MAAM,CA4B3I"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = determineLocale;
4
+ const generaltranslation_1 = require("generaltranslation");
5
+ function determineLocale(approvedLocales, possibleLocales, defaultLocale = '') {
6
+ if (typeof possibleLocales === 'string')
7
+ possibleLocales = [possibleLocales];
8
+ if (!possibleLocales || !Array.isArray(possibleLocales))
9
+ return defaultLocale;
10
+ // if no approved locales, anything goes
11
+ if (!approvedLocales)
12
+ return possibleLocales[0];
13
+ // check for an exact match
14
+ for (const locale of possibleLocales) {
15
+ for (const approvedLocale of approvedLocales) {
16
+ if (locale === approvedLocale) {
17
+ return approvedLocale;
18
+ }
19
+ }
20
+ }
21
+ // check for a linguistic match
22
+ for (const locale of possibleLocales) {
23
+ for (const approvedLocale of approvedLocales) {
24
+ if ((0, generaltranslation_1.isSameLanguage)(locale, approvedLocale)) {
25
+ return approvedLocale;
26
+ }
27
+ }
28
+ }
29
+ // default
30
+ return defaultLocale;
31
+ }
32
+ //# sourceMappingURL=determineLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determineLocale.js","sourceRoot":"","sources":["../../../src/config/determineLocale.ts"],"names":[],"mappings":";;AAEA,kCA4BC;AA9BD,2DAAoD;AAEpD,SAAwB,eAAe,CAAC,eAA0B,EAAE,eAAmC,EAAE,gBAAwB,EAAE;IAE/H,IAAI,OAAO,eAAe,KAAK,QAAQ;QAAE,eAAe,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7E,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;QAAE,OAAO,aAAa,CAAC;IAE9E,wCAAwC;IACxC,IAAI,CAAC,eAAe;QAAE,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;IAEhD,2BAA2B;IAC3B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACnC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;gBAC5B,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,+BAA+B;IAC/B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACnC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,IAAA,mCAAc,EAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC;gBACzC,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,UAAU;IACV,OAAO,aAAa,CAAC;AACzB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Retrieves the value of an environment variable as a string.
3
+ *
4
+ * This function checks if the `process` object is defined and if the specified environment
5
+ * variable is set. If both conditions are met, it returns the value of the environment
6
+ * variable. If not, it returns an empty string.
7
+ *
8
+ * @param {string} VARIABLE - The name of the environment variable to retrieve.
9
+ * @returns {string} The value of the environment variable, or an empty string if the variable is not set.
10
+ */
11
+ export default function getDefaultFromEnv(VARIABLE: string): string;
12
+ //# sourceMappingURL=getDefaultFromEnv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultFromEnv.d.ts","sourceRoot":"","sources":["../../../../src/config/local/getDefaultFromEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKlE"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = getDefaultFromEnv;
4
+ /**
5
+ * Retrieves the value of an environment variable as a string.
6
+ *
7
+ * This function checks if the `process` object is defined and if the specified environment
8
+ * variable is set. If both conditions are met, it returns the value of the environment
9
+ * variable. If not, it returns an empty string.
10
+ *
11
+ * @param {string} VARIABLE - The name of the environment variable to retrieve.
12
+ * @returns {string} The value of the environment variable, or an empty string if the variable is not set.
13
+ */
14
+ function getDefaultFromEnv(VARIABLE) {
15
+ var _a;
16
+ if (typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a[VARIABLE])) {
17
+ return process.env[VARIABLE];
18
+ }
19
+ return '';
20
+ }
21
+ //# sourceMappingURL=getDefaultFromEnv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultFromEnv.js","sourceRoot":"","sources":["../../../../src/config/local/getDefaultFromEnv.ts"],"names":[],"mappings":";;AAUA,oCAKC;AAfD;;;;;;;;;GASG;AACH,SAAwB,iBAAiB,CAAC,QAAgB;;IACtD,IAAI,OAAO,OAAO,KAAK,WAAW,KAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,0CAAG,QAAQ,CAAC,CAAA,EAAE,CAAC;QAC7D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAW,CAAC;IAC3C,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ import I18NConfiguration from "../config/I18NConfiguration";
2
+ export default function createDictFunction(I18NConfig: I18NConfiguration): (id: string) => any;
3
+ //# sourceMappingURL=createDictFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDictFunction.d.ts","sourceRoot":"","sources":["../../../src/dictionary/createDictFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAG5D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,UAAU,EAAE,iBAAiB,QACxD,MAAM,SAIrB"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = createDictFunction;
7
+ const getEntryMetadata_1 = __importDefault(require("../primitives/getEntryMetadata"));
8
+ function createDictFunction(I18NConfig) {
9
+ return (id) => {
10
+ const { entry } = (0, getEntryMetadata_1.default)(I18NConfig.getDictionaryEntry(id));
11
+ return entry;
12
+ };
13
+ }
14
+ //# sourceMappingURL=createDictFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDictFunction.js","sourceRoot":"","sources":["../../../src/dictionary/createDictFunction.tsx"],"names":[],"mappings":";;;;;AAGA,qCAKC;AAPD,sFAA8D;AAE9D,SAAwB,kBAAkB,CAAC,UAA6B;IACpE,OAAO,CAAC,EAAU,EAAE,EAAE;QAClB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,0BAAgB,EAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACjB,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ import I18NConfiguration from "../config/I18NConfiguration";
2
+ export type tOptions = {
3
+ n?: number;
4
+ values?: Record<string, any>;
5
+ [key: string]: any;
6
+ };
7
+ export default function createExecuteTFunction({ I18NConfig, T, intl }: {
8
+ I18NConfig: I18NConfiguration;
9
+ T: any;
10
+ intl: any;
11
+ }): (dictionary: Record<string, any>, id: string, options?: tOptions) => JSX.Element | Promise<string>;
12
+ //# sourceMappingURL=createExecuteTFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createExecuteTFunction.d.ts","sourceRoot":"","sources":["../../../src/dictionary/createExecuteTFunction.tsx"],"names":[],"mappings":"AACA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAO5D,MAAM,MAAM,QAAQ,GAAG;IACnB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,UAAU,EAAE,iBAAiB,CAAC;IAAC,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,gBACpG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,YAAY,QAAQ,KAAG,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAkG1G"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.default = createExecuteTFunction;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const react_1 = require("react");
20
+ const InnerValue_1 = __importDefault(require("../server/value/InnerValue"));
21
+ const InnerPlural_1 = __importDefault(require("../server/plural/InnerPlural"));
22
+ const getEntryMetadata_1 = __importDefault(require("../primitives/getEntryMetadata"));
23
+ const getEntryTranslationType_1 = __importDefault(require("../primitives/getEntryTranslationType"));
24
+ const getDictionaryEntry_1 = __importDefault(require("./getDictionaryEntry"));
25
+ function createExecuteTFunction({ I18NConfig, T, intl }) {
26
+ return (dictionary, id, options) => {
27
+ const raw = (0, getDictionaryEntry_1.default)(id, dictionary);
28
+ const { entry, metadata } = (0, getEntryMetadata_1.default)(raw);
29
+ options = Object.assign(Object.assign({}, options), metadata);
30
+ // Checks to see if options are valid
31
+ const translationType = (0, getEntryTranslationType_1.default)(raw);
32
+ if (translationType === "plural") {
33
+ if (!options.n) {
34
+ throw new Error(`Entry ${id} requires a "n" option.`);
35
+ }
36
+ else if ((0, react_1.isValidElement)(entry) || typeof entry !== 'object') {
37
+ throw new Error(`Entry id: ${id}. Plural structured incorrectly in dictionary. See https://docs.generaltranslation.com/dictionaries/plurals. If you just need to pass a value n, try t('your_id', { values: { n: /* your value */ }}).`);
38
+ }
39
+ }
40
+ // Turn into an async function if the target is a string
41
+ if (typeof entry === 'string')
42
+ return intl(entry, Object.assign({ id }, options));
43
+ // If a plural or value is required
44
+ if (options) {
45
+ const locales = [I18NConfig.getLocale(), I18NConfig.getDefaultLocale()];
46
+ const { n, values, ranges, zero, one, two, few, many, other, singular, dual, plural } = options, tOptions = __rest(options, ["n", "values", "ranges", "zero", "one", "two", "few", "many", "other", "singular", "dual", "plural"]);
47
+ if (typeof n === 'number') {
48
+ if (!(0, react_1.isValidElement)(entry) && typeof entry === 'object') {
49
+ const innerProps = {
50
+ n,
51
+ ranges: entry.ranges,
52
+ zero: entry.zero,
53
+ one: entry.one,
54
+ two: entry.two,
55
+ few: entry.few,
56
+ many: entry.many,
57
+ other: entry.other,
58
+ singular: entry.singular,
59
+ plural: entry.plural,
60
+ dual: entry.dual,
61
+ values
62
+ };
63
+ return ((0, jsx_runtime_1.jsx)(T, Object.assign({ id: id }, tOptions, { children: (0, jsx_runtime_1.jsx)(InnerPlural_1.default, Object.assign({ locales: locales }, innerProps, { children: entry.plural
64
+ || entry.other
65
+ || entry.singular
66
+ || entry.one
67
+ || entry.many
68
+ || entry.few
69
+ || entry.two
70
+ || entry.dual
71
+ || entry.zero })) })));
72
+ }
73
+ else { // where singular/plural/etc. are supplied in the dictionary options
74
+ const innerProps = {
75
+ n,
76
+ ranges,
77
+ zero, one,
78
+ two, few,
79
+ many, other,
80
+ singular, dual, plural,
81
+ };
82
+ return ((0, jsx_runtime_1.jsx)(T, Object.assign({ id: id }, tOptions, { children: (0, jsx_runtime_1.jsx)(InnerPlural_1.default, Object.assign({ locales: locales }, innerProps, { children: entry })) })));
83
+ }
84
+ }
85
+ else if (values) {
86
+ // Value only
87
+ return ((0, jsx_runtime_1.jsx)(T, Object.assign({ id: id }, tOptions, { children: (0, jsx_runtime_1.jsx)(InnerValue_1.default, { values: values, locales: locales, children: entry }) })));
88
+ }
89
+ }
90
+ // base case, just return T with a <Value> for consistency but no content
91
+ return ((0, jsx_runtime_1.jsx)(T, Object.assign({ id: id }, options, { children: (0, jsx_runtime_1.jsx)(InnerValue_1.default, { children: entry }) })));
92
+ };
93
+ }
94
+ //# sourceMappingURL=createExecuteTFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createExecuteTFunction.js","sourceRoot":"","sources":["../../../src/dictionary/createExecuteTFunction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAcA,yCAmGC;;AAjHD,iCAA8C;AAE9C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AM;qBACzB,CAAC;oBACF,OAAO,CACH,uBAAC,CAAC,kBAAC,EAAE,EAAE,EAAE,IAAM,QAAQ,cACnB,uBAAC,qBAAM,kBAAC,OAAO,EAAE,OAAO,IAAM,UAAU,cACnC,KAAK,IACD,IACT,CACP,CAAC;gBACN,CAAC;YACL,CAAC;iBAAM,IAAI,MAAM,EAAE,CAAC;gBAChB,aAAa;gBACb,OAAO,CACH,uBAAC,CAAC,kBAAC,EAAE,EAAE,EAAE,IAAM,QAAQ,cACnB,uBAAC,oBAAK,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,YAClC,KAAK,GACF,IACR,CACP,CAAA;YACL,CAAC;QACL,CAAC;QAED,yEAAyE;QACzE,OAAO,CACH,uBAAC,CAAC,kBAAC,EAAE,EAAE,EAAE,IAAM,OAAO,cAClB,uBAAC,oBAAK,cACD,KAAK,GACF,IACR,CACP,CAAA;IACL,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { tOptions } from "./createExecuteTFunction";
2
+ export default function createGetGTFunction(t: (id: string, options?: tOptions) => Promise<string> | JSX.Element): (id?: string) => (id: string, options?: tOptions) => Promise<string> | JSX.Element;
3
+ //# sourceMappingURL=createGetGTFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGetGTFunction.d.ts","sourceRoot":"","sources":["../../../src/dictionary/createGetGTFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,SAC/F,MAAM,UAD6B,MAAM,YAAY,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAK/G"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = createGetGTFunction;
4
+ function createGetGTFunction(t) {
5
+ return (id) => {
6
+ let innerID = id;
7
+ return innerID ? (id, options) => t(`${innerID}.${id}`, options) : t;
8
+ };
9
+ }
10
+ //# sourceMappingURL=createGetGTFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGetGTFunction.js","sourceRoot":"","sources":["../../../src/dictionary/createGetGTFunction.ts"],"names":[],"mappings":";;AAEA,sCAKC;AALD,SAAwB,mBAAmB,CAAC,CAAoE;IAC5G,OAAO,CAAC,EAAW,EAAE,EAAE;QACnB,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,EAAU,EAAE,OAAkB,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function getDictionaryEntry(id: string, dictionary: Record<string, any>): any | null;
2
+ //# sourceMappingURL=getDictionaryEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDictionaryEntry.d.ts","sourceRoot":"","sources":["../../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAQlG"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = getDictionaryEntry;
4
+ function getDictionaryEntry(id, dictionary) {
5
+ if (!id || typeof id !== 'string' || !dictionary || typeof dictionary !== 'object')
6
+ return null;
7
+ let current = dictionary;
8
+ let dictionaryPath = id.split(".");
9
+ for (const key of dictionaryPath) {
10
+ current = current === null || current === void 0 ? void 0 : current[key];
11
+ }
12
+ return current;
13
+ }
14
+ //# sourceMappingURL=getDictionaryEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDictionaryEntry.js","sourceRoot":"","sources":["../../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":";;AAAA,qCAQC;AARD,SAAwB,kBAAkB,CAAC,EAAU,EAAE,UAA+B;IAClF,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChG,IAAI,OAAO,GAAG,UAAU,CAAC;IACzB,IAAI,cAAc,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAC/B,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import calculateID from "./primitives/calculateID";
2
+ import flattenDictionary from "./primitives/flattenDictionary";
3
+ import addGTIdentifier from "./server/helpers/addGTIdentifier";
4
+ import writeChildrenAsObjects from "./server/helpers/writeChildrenAsObjects";
5
+ export { calculateID, flattenDictionary, writeChildrenAsObjects, addGTIdentifier };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,eAAe,MAAM,kCAAkC,CAAC;AAC/D,OAAO,sBAAsB,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EACH,WAAW,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,eAAe,EAC1E,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.addGTIdentifier = exports.writeChildrenAsObjects = exports.flattenDictionary = exports.calculateID = void 0;
7
+ const calculateID_1 = __importDefault(require("./primitives/calculateID"));
8
+ exports.calculateID = calculateID_1.default;
9
+ const flattenDictionary_1 = __importDefault(require("./primitives/flattenDictionary"));
10
+ exports.flattenDictionary = flattenDictionary_1.default;
11
+ const addGTIdentifier_1 = __importDefault(require("./server/helpers/addGTIdentifier"));
12
+ exports.addGTIdentifier = addGTIdentifier_1.default;
13
+ const writeChildrenAsObjects_1 = __importDefault(require("./server/helpers/writeChildrenAsObjects"));
14
+ exports.writeChildrenAsObjects = writeChildrenAsObjects_1.default;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,2EAAmD;AAK/C,sBALG,qBAAW,CAKH;AAJf,uFAA+D;AAI9C,4BAJV,2BAAiB,CAIU;AAHlC,uFAA+D;AAGH,0BAHrD,yBAAe,CAGqD;AAF3E,qGAA6E;AAEzC,iCAF7B,gCAAsB,CAE6B"}
@@ -0,0 +1,6 @@
1
+ import I18NConfiguration from "../config/I18NConfiguration";
2
+ export default function createIntlFunction({ I18NConfig, ...defaultOptions }: {
3
+ I18NConfig: I18NConfiguration;
4
+ [key: string]: any;
5
+ }): (content: string, options?: Record<string, any>) => Promise<string>;
6
+ //# sourceMappingURL=createIntlFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createIntlFunction.d.ts","sourceRoot":"","sources":["../../../src/intl/createIntlFunction.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAA;AAG3D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACvC,UAAU,EAAE,GAAG,cAAc,EAChC,EAAE;IAAE,UAAU,EAAE,iBAAiB,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,aAEvC,MAAM,YAAW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC9C,OAAO,CAAC,MAAM,CAAC,CAerB"}
@@ -0,0 +1,48 @@
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 __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.default = createIntlFunction;
27
+ const calculateID_1 = __importDefault(require("../primitives/calculateID"));
28
+ function createIntlFunction(_a) {
29
+ var { I18NConfig } = _a, defaultOptions = __rest(_a, ["I18NConfig"]);
30
+ return (content_1, ...args_1) => __awaiter(this, [content_1, ...args_1], void 0, function* (content, options = Object.assign({}, defaultOptions)) {
31
+ options.targetLanguage = options.targetLanguage || I18NConfig.getLocale();
32
+ if (!content || typeof content !== 'string' || !I18NConfig.translationRequired(options.targetLanguage))
33
+ return content;
34
+ const key = yield (0, calculateID_1.default)(content);
35
+ const translation = yield I18NConfig.getTranslation(options.targetLanguage, key, options.id, options.dictionaryName);
36
+ if (translation)
37
+ return translation;
38
+ if (I18NConfig.automaticTranslationEnabled()) {
39
+ const translationPromise = I18NConfig.intl({ content, targetLanguage: options.targetLanguage, options: Object.assign(Object.assign({}, options), { hash: key }) });
40
+ const renderSettings = I18NConfig.getRenderSettings();
41
+ if (renderSettings.method !== "subtle") {
42
+ return yield translationPromise;
43
+ }
44
+ }
45
+ return content;
46
+ });
47
+ }
48
+ //# sourceMappingURL=createIntlFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createIntlFunction.js","sourceRoot":"","sources":["../../../src/intl/createIntlFunction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,qCAoBC;AAtBD,4EAAoD;AAEpD,SAAwB,kBAAkB,CAAC,EAEa;QAFb,EACvC,UAAU,OAC0C,EADrC,cAAc,cADU,cAE1C,CADgC;IAE7B,OAAO,uBAEY,EAAE,4DADjB,OAAe,EAAE,4BAAoC,cAAc,CAAE;QAErE,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;QAC1E,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,CAAC;YAAE,OAAO,OAAO,CAAC;QACvH,MAAM,GAAG,GAAG,MAAM,IAAA,qBAAW,EAAC,OAAO,CAAC,CAAC;QACvC,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QACrH,IAAI,WAAW;YAAE,OAAO,WAAW,CAAC;QACpC,IAAI,UAAU,CAAC,2BAA2B,EAAE,EAAE,CAAC;YAC3C,MAAM,kBAAkB,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,kCAAO,OAAO,KAAE,IAAI,EAAE,GAAG,GAAE,EAAE,CAAC,CAAC;YACpI,MAAM,cAAc,GAAG,UAAU,CAAC,iBAAiB,EAAE,CAAA;YACrD,IAAI,cAAc,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACrC,OAAO,MAAM,kBAAkB,CAAC;YACpC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC,CAAA,CAAA;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const localeCookieName = "generaltranslation-locale";
2
+ //# sourceMappingURL=cookieSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookieSettings.d.ts","sourceRoot":"","sources":["../../../src/middleware/cookieSettings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.localeCookieName = void 0;
4
+ exports.localeCookieName = "generaltranslation-locale";
5
+ //# sourceMappingURL=cookieSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookieSettings.js","sourceRoot":"","sources":["../../../src/middleware/cookieSettings.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,2BAA2B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Middleware to set a cookie based on the locale.
3
+ * @param {NextRequest} req - The incoming request object.
4
+ */
5
+ export default function createNextMiddleware({ defaultLocale, approvedLocales, localeRouting }?: {
6
+ defaultLocale: string;
7
+ approvedLocales?: string[];
8
+ localeRouting: boolean;
9
+ }): (req: any) => any;
10
+ //# sourceMappingURL=createNextMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNextMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/createNextMiddleware.ts"],"names":[],"mappings":"AAoDA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EACzC,aAAoB,EAAE,eAAe,EAAE,aAAoB,EAC9D,GAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAChC,SAE7B,GAAG,SAoHnB"}