use-intl 2.9.2 → 2.10.0-alpha.4

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 (128) hide show
  1. package/CHANGELOG.md +471 -0
  2. package/dist/core/use-intl.esm.js +38 -41
  3. package/dist/core/use-intl.esm.js.map +1 -1
  4. package/dist/core/use-intl.esm2.js +41 -38
  5. package/dist/core/use-intl.esm2.js.map +1 -1
  6. package/dist/core/use-intl.esm3.js +2 -2
  7. package/dist/core/use-intl.esm4.js +12 -56
  8. package/dist/core/use-intl.esm4.js.map +1 -1
  9. package/dist/core/use-intl.esm5.js +56 -12
  10. package/dist/core/use-intl.esm5.js.map +1 -1
  11. package/dist/core/use-intl.esm6.js +1 -1
  12. package/dist/core/use-intl.esm7.js +2 -2
  13. package/dist/react/use-intl.esm.js +2 -2
  14. package/dist/react/use-intl.esm2.js +41 -17
  15. package/dist/react/use-intl.esm2.js.map +1 -1
  16. package/dist/react/use-intl.esm3.js +21 -20
  17. package/dist/react/use-intl.esm3.js.map +1 -1
  18. package/dist/react/use-intl.esm4.js +21 -4
  19. package/dist/react/use-intl.esm4.js.map +1 -1
  20. package/dist/react/use-intl.esm5.js +4 -46
  21. package/dist/react/use-intl.esm5.js.map +1 -1
  22. package/dist/react/use-intl.esm6.js +4 -4
  23. package/dist/react/use-intl.esm6.js.map +1 -1
  24. package/dist/react/use-intl.esm7.js +12 -3
  25. package/dist/react/use-intl.esm7.js.map +1 -1
  26. package/dist/react/use-intl.esm8.js +38 -9
  27. package/dist/react/use-intl.esm8.js.map +1 -1
  28. package/dist/react/use-intl.esm9.js +3 -41
  29. package/dist/react/use-intl.esm9.js.map +1 -1
  30. package/dist/src/core/AbstractIntlMessages.d.ts +9 -0
  31. package/dist/src/core/AbstractIntlMessages.js +2 -0
  32. package/dist/src/core/AbstractIntlMessages.js.map +1 -0
  33. package/dist/src/core/DateTimeFormatOptions.d.ts +72 -0
  34. package/dist/src/core/DateTimeFormatOptions.js +3 -0
  35. package/dist/src/core/DateTimeFormatOptions.js.map +1 -0
  36. package/dist/src/core/Formats.d.ts +7 -0
  37. package/dist/src/core/Formats.js +2 -0
  38. package/dist/src/core/Formats.js.map +1 -0
  39. package/dist/src/core/IntlConfiguration.d.ts +46 -0
  40. package/dist/src/core/IntlConfiguration.js +2 -0
  41. package/dist/src/core/IntlConfiguration.js.map +1 -0
  42. package/dist/src/core/IntlError.d.ts +13 -0
  43. package/dist/src/core/IntlError.js +23 -0
  44. package/dist/src/core/IntlError.js.map +1 -0
  45. package/dist/src/core/IntlMessages.d.ts +2 -0
  46. package/dist/src/core/IntlMessages.js +4 -0
  47. package/dist/src/core/IntlMessages.js.map +1 -0
  48. package/dist/src/core/NumberFormatOptions.d.ts +2 -0
  49. package/dist/src/core/NumberFormatOptions.js +2 -0
  50. package/dist/src/core/NumberFormatOptions.js.map +1 -0
  51. package/dist/src/core/TranslationValues.d.ts +5 -0
  52. package/dist/src/core/TranslationValues.js +2 -0
  53. package/dist/src/core/TranslationValues.js.map +1 -0
  54. package/dist/src/core/convertFormatsToIntlMessageFormat.d.ts +10 -0
  55. package/dist/src/core/convertFormatsToIntlMessageFormat.js +31 -0
  56. package/dist/src/core/convertFormatsToIntlMessageFormat.js.map +1 -0
  57. package/dist/src/core/createBaseTranslator.d.ts +26 -0
  58. package/dist/src/core/createBaseTranslator.js +181 -0
  59. package/dist/src/core/createBaseTranslator.js.map +1 -0
  60. package/dist/src/core/createIntl.d.ts +17 -0
  61. package/dist/src/core/createIntl.js +126 -0
  62. package/dist/src/core/createIntl.js.map +1 -0
  63. package/dist/src/core/createTranslator.d.ts +48 -0
  64. package/dist/src/core/createTranslator.js +24 -0
  65. package/dist/src/core/createTranslator.js.map +1 -0
  66. package/dist/src/core/createTranslatorImpl.d.ts +14 -0
  67. package/dist/src/core/createTranslatorImpl.js +43 -0
  68. package/dist/src/core/createTranslatorImpl.js.map +1 -0
  69. package/dist/src/core/defaults.d.ts +11 -0
  70. package/dist/src/core/defaults.js +11 -0
  71. package/dist/src/core/defaults.js.map +1 -0
  72. package/dist/src/core/index.d.ts +8 -0
  73. package/dist/src/core/index.js +4 -0
  74. package/dist/src/core/index.js.map +1 -0
  75. package/dist/src/core/resolveNamespace.d.ts +5 -0
  76. package/dist/src/core/resolveNamespace.js +10 -0
  77. package/dist/src/core/resolveNamespace.js.map +1 -0
  78. package/dist/src/core/utils/MessageKeys.d.ts +5 -0
  79. package/dist/src/core/utils/MessageKeys.js +2 -0
  80. package/dist/src/core/utils/MessageKeys.js.map +1 -0
  81. package/dist/src/core/utils/NamespaceKeys.d.ts +5 -0
  82. package/dist/src/core/utils/NamespaceKeys.js +2 -0
  83. package/dist/src/core/utils/NamespaceKeys.js.map +1 -0
  84. package/dist/src/core/utils/NestedKeyOf.d.ts +4 -0
  85. package/dist/src/core/utils/NestedKeyOf.js +2 -0
  86. package/dist/src/core/utils/NestedKeyOf.js.map +1 -0
  87. package/dist/src/core/utils/NestedValueOf.d.ts +2 -0
  88. package/dist/src/core/utils/NestedValueOf.js +2 -0
  89. package/dist/src/core/utils/NestedValueOf.js.map +1 -0
  90. package/dist/src/core/validateMessages.d.ts +3 -0
  91. package/dist/src/core/validateMessages.js +22 -0
  92. package/dist/src/core/validateMessages.js.map +1 -0
  93. package/dist/src/index.d.ts +2 -0
  94. package/dist/src/index.js +3 -0
  95. package/dist/src/index.js.map +1 -0
  96. package/dist/src/react/IntlContext.d.ts +21 -0
  97. package/dist/src/react/IntlContext.js +4 -0
  98. package/dist/src/react/IntlContext.js.map +1 -0
  99. package/dist/src/react/IntlProvider.d.ts +16 -0
  100. package/dist/src/react/IntlProvider.js +16 -0
  101. package/dist/src/react/IntlProvider.js.map +1 -0
  102. package/dist/src/react/index.d.ts +6 -0
  103. package/dist/src/react/index.js +7 -0
  104. package/dist/src/react/index.js.map +1 -0
  105. package/dist/src/react/useIntl.d.ts +5 -0
  106. package/dist/src/react/useIntl.js +14 -0
  107. package/dist/src/react/useIntl.js.map +1 -0
  108. package/dist/src/react/useIntlContext.d.ts +1 -0
  109. package/dist/src/react/useIntlContext.js +12 -0
  110. package/dist/src/react/useIntlContext.js.map +1 -0
  111. package/dist/src/react/useLocale.d.ts +1 -0
  112. package/dist/src/react/useLocale.js +5 -0
  113. package/dist/src/react/useLocale.js.map +1 -0
  114. package/dist/src/react/useNow.d.ts +23 -0
  115. package/dist/src/react/useNow.js +40 -0
  116. package/dist/src/react/useNow.js.map +1 -0
  117. package/dist/src/react/useTimeZone.d.ts +1 -0
  118. package/dist/src/react/useTimeZone.js +5 -0
  119. package/dist/src/react/useTimeZone.js.map +1 -0
  120. package/dist/src/react/useTranslations.d.ts +44 -0
  121. package/dist/src/react/useTranslations.js +21 -0
  122. package/dist/src/react/useTranslations.js.map +1 -0
  123. package/dist/src/react/useTranslationsImpl.d.ts +8 -0
  124. package/dist/src/react/useTranslationsImpl.js +35 -0
  125. package/dist/src/react/useTranslationsImpl.js.map +1 -0
  126. package/dist/use-intl.esm.js +7 -7
  127. package/package.json +7 -6
  128. package/LICENSE +0 -21
package/CHANGELOG.md ADDED
@@ -0,0 +1,471 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 2.9.2 (2022-12-08)
7
+
8
+ **Note:** Version bump only for package use-intl
9
+
10
+
11
+
12
+
13
+
14
+ ## 2.9.1 (2022-11-03)
15
+
16
+ **Note:** Version bump only for package use-intl
17
+
18
+
19
+
20
+
21
+
22
+ # 2.9.0 (2022-10-27)
23
+
24
+
25
+ ### Features
26
+
27
+ * Next.js 13 compatibility ([#140](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/140)) ([65326a0](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/65326a0b47980f260df466a283a6e7a0aa5e1cd0)), closes [#139](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/139)
28
+
29
+
30
+
31
+
32
+
33
+ # 2.8.0 (2022-10-18)
34
+
35
+
36
+ ### Features
37
+
38
+ * Provide `createTranslator` and `createIntl` by extracting a React-agnostic core library. Thanks to David Brands from Marvia for sponsoring the work on this feature, participating in discussion and providing feedback! ([#137](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/137)) ([91f7489](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/91f748972008b8587553b48aa36c95d7348b4b0c))
39
+
40
+
41
+
42
+
43
+
44
+ ## 2.7.6 (2022-09-22)
45
+
46
+ **Note:** Version bump only for package use-intl
47
+
48
+
49
+
50
+
51
+
52
+ ## 2.7.5 (2022-08-30)
53
+
54
+ **Note:** Version bump only for package use-intl
55
+
56
+
57
+
58
+
59
+
60
+ ## 2.7.4 (2022-05-30)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * Adapt TypeScript validation to work with messages files that only have a single top-level namespace ([#115](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/115)) ([cf0b83e](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/cf0b83e3a591cfe87e17537c3ca0c7000cc70b1e))
66
+
67
+
68
+
69
+
70
+
71
+ ## 2.7.3 (2022-05-20)
72
+
73
+
74
+ ### Bug Fixes
75
+
76
+ * Add back the ability to render the provider without messages ([#113](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/113)) ([8395822](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/8395822fa17cd0a04b88f8edce3b20e5e613fc78))
77
+
78
+
79
+
80
+
81
+
82
+ ## 2.7.2 (2022-05-10)
83
+
84
+
85
+ ### Bug Fixes
86
+
87
+ * Enable tree-shaking ([#108](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/108)) ([157b0e2](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/157b0e28376055e7e34e86007c51d008c8e214aa))
88
+
89
+
90
+
91
+
92
+
93
+ ## 2.7.1 (2022-04-28)
94
+
95
+
96
+ ### Bug Fixes
97
+
98
+ * Allow null message values ([#110](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/110)) ([14ae8ff](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/14ae8ffdf1b295873f14081e2c3709d0f9bd2b9e))
99
+
100
+
101
+
102
+
103
+
104
+ # 2.7.0 (2022-04-28)
105
+
106
+
107
+ ### Features
108
+
109
+ * Warn for invalid namespace keys ([#106](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/106)) ([e86ab28](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/e86ab28b9180b866ce1a0a9173355d4b686b7d07))
110
+
111
+
112
+
113
+
114
+
115
+ # 2.6.0 (2022-04-08)
116
+
117
+
118
+ ### Features
119
+
120
+ * Support React 18 ([#98](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/98)) ([38614eb](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/38614eb9c6d6fb96704424d7f3ff8a67a24b789e))
121
+
122
+
123
+
124
+
125
+
126
+ # 2.5.0 (2022-04-01)
127
+
128
+
129
+ ### Features
130
+
131
+ * Type safe messages ([#93](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/93)) ([13b49b1](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/13b49b138bc0ec3adbe661af6a70dfabfe7e86b0))
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ ## 2.4.1 (2022-03-24)
142
+
143
+
144
+ ### Bug Fixes
145
+
146
+ * Overwrite prerelease ([6caf5c4](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/6caf5c48a35179f802503bc6580469187765c837))
147
+
148
+
149
+
150
+
151
+
152
+ # [2.4.0](https://github.com/amannn/next-intl/tree/main/packages/use-intl/compare/v2.3.5...v2.4.0) (2022-02-08)
153
+
154
+
155
+ ### Features
156
+
157
+ * Default translation values ([#86](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/86)) ([0ed5e70](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/0ed5e70ffc57dcdb1b7b9270dbce9e8475b3f478))
158
+
159
+
160
+
161
+
162
+
163
+ ## 2.3.5 (2022-01-19)
164
+
165
+
166
+ ### Bug Fixes
167
+
168
+ * Support identical wrappers with identical text content in rich text ([#80](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/80)) ([b35bb9f](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/b35bb9ffc5fa56c6260b6b424be3cd875f199aef))
169
+
170
+
171
+
172
+
173
+
174
+ ## 2.3.4 (2022-01-04)
175
+
176
+
177
+ ### Bug Fixes
178
+
179
+ * Allow usage outside of Next.js (e.g. Jest and Storybook) ([#76](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/76)) ([7c6925b](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/7c6925b39338be95c1c940c67a1ae2f5e3f85cdd))
180
+
181
+
182
+
183
+
184
+
185
+ ## 2.3.3 (2021-12-23)
186
+
187
+ **Note:** Version bump only for package use-intl
188
+
189
+
190
+
191
+
192
+
193
+ ## 2.3.2 (2021-12-23)
194
+
195
+ **Note:** Version bump only for package use-intl
196
+
197
+
198
+
199
+
200
+
201
+ ## 2.3.1 (2021-12-23)
202
+
203
+ **Note:** Version bump only for package use-intl
204
+
205
+
206
+
207
+
208
+
209
+ # 2.3.0 (2021-11-24)
210
+
211
+
212
+ ### Features
213
+
214
+ * Add `useLocale` and `useTimeZone` ([#67](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/67)) ([7833f4a](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/7833f4adc1aadc937cbaa550a968ef6f7b4f5ee1))
215
+
216
+
217
+
218
+
219
+
220
+ ## 2.2.1 (2021-11-23)
221
+
222
+
223
+ ### Bug Fixes
224
+
225
+ * Clearer error message when no messages are provided ([#66](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/66)) ([742729a](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/742729aaddd63367efc2b79ef0cdf93545abdfb0))
226
+
227
+
228
+
229
+
230
+
231
+ # 2.2.0 (2021-11-02)
232
+
233
+
234
+ ### Features
235
+
236
+ * TypeScript improvements: Use enum type for `style` of `NumberFormatOptions`, only allow passing React children to messages rendered with `t.rich` and update `tslib` ([#63](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/63)) ([d73e935](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/d73e9358bf13c87c0a653bd9fbed35e41548ff1d))
237
+
238
+
239
+
240
+
241
+
242
+ ## 2.1.1 (2021-10-28)
243
+
244
+ **Note:** Version bump only for package use-intl
245
+
246
+
247
+
248
+
249
+
250
+ # 2.1.0 (2021-10-27)
251
+
252
+
253
+ ### Features
254
+
255
+ * Support Next.js 12 ([#61](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/61)) ([0391cc8](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/0391cc85d3401bca9df29080a569957f6be93c85))
256
+
257
+
258
+
259
+
260
+
261
+ ## 2.0.5 (2021-09-28)
262
+
263
+ **Note:** Version bump only for package use-intl
264
+
265
+
266
+
267
+
268
+
269
+ ## 2.0.4 (2021-09-28)
270
+
271
+ **Note:** Version bump only for package use-intl
272
+
273
+
274
+
275
+
276
+
277
+ ## 2.0.3 (2021-09-17)
278
+
279
+ **Note:** Version bump only for package use-intl
280
+
281
+
282
+
283
+
284
+
285
+ ## 2.0.2 (2021-09-17)
286
+
287
+
288
+ ### Bug Fixes
289
+
290
+ * Render correct messages when the namespace changes in `useTranslations` ([#58](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/58)) ([b8f7dab](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/b8f7dab0e3a213a91bdcd7929547cd01ba0b5f54))
291
+
292
+
293
+
294
+
295
+
296
+ ## 2.0.1 (2021-09-04)
297
+
298
+ **Note:** Version bump only for package use-intl
299
+
300
+
301
+
302
+
303
+
304
+ # 2.0.0 (2021-08-26)
305
+
306
+
307
+ * feat!: Use a separate API for rich text formatting to avoid type casting in TypeScript #54 ([4c13a64](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/4c13a644ce99992d9e57887afe35a09b8e3d6572)), closes [#54](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/54)
308
+
309
+
310
+ ### BREAKING CHANGES
311
+
312
+ * Instead of using the `t` function for formatting both regular messages and rich text, this function will only work for regular messages now. For rich text you can use `t.rich` instead now.
313
+
314
+
315
+
316
+
317
+
318
+ ## 1.5.1 (2021-08-13)
319
+
320
+
321
+ ### Bug Fixes
322
+
323
+ * Improve API for rendering raw messages and add docs ([#51](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/51)) ([19f4a7e](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/19f4a7e4e81e1cff78dc7e3f337dce69800be280))
324
+
325
+
326
+
327
+
328
+
329
+ # 1.5.0 (2021-08-10)
330
+
331
+
332
+ ### Features
333
+
334
+ * Add flag to return raw messages ([#48](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/48)) ([b34e19f](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/b34e19ff618308b7d0c01e7969975215d96ff608))
335
+
336
+
337
+
338
+
339
+
340
+ ## 1.4.7 (2021-08-02)
341
+
342
+
343
+ ### Bug Fixes
344
+
345
+ * Adjust default for `onError` of the provider to log errors correctly ([#46](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/46)) ([d0a1986](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/d0a1986905e30acac40630e9ea6d099caad617fb))
346
+
347
+
348
+
349
+
350
+
351
+ ## 1.4.6 (2021-08-02)
352
+
353
+
354
+ ### Bug Fixes
355
+
356
+ * Use `timeZone` in translation function from `useTranslations` ([#45](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/45)) ([ebf75f2](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/ebf75f2add0ddc46f89768e9481bb16c56f94720))
357
+
358
+
359
+
360
+
361
+
362
+ ## 1.4.5 (2021-07-26)
363
+
364
+ **Note:** Version bump only for package use-intl
365
+
366
+
367
+
368
+
369
+
370
+ ## 1.4.4 (2021-07-08)
371
+
372
+ **Note:** Version bump only for package use-intl
373
+
374
+
375
+
376
+
377
+
378
+ ## 1.4.3 (2021-07-08)
379
+
380
+ **Note:** Version bump only for package use-intl
381
+
382
+
383
+
384
+
385
+
386
+ ## [1.4.2](https://github.com/amannn/next-intl/tree/main/packages/use-intl/compare/v1.4.1...v1.4.2) (2021-06-16)
387
+
388
+
389
+ ### Bug Fixes
390
+
391
+ * Don't require `react-dom` as a peer dependency ([#39](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/39)) ([39edfcd](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/39edfcd9091e09570fc2152cda6a1e9ae5e7c210))
392
+
393
+
394
+
395
+
396
+
397
+ ## 1.3.11 (2021-05-07)
398
+
399
+ **Note:** Version bump only for package use-intl
400
+
401
+
402
+
403
+
404
+
405
+ ## 1.3.10 (2021-05-02)
406
+
407
+ **Note:** Version bump only for package use-intl
408
+
409
+
410
+
411
+
412
+
413
+ ## 1.3.9 (2021-05-02)
414
+
415
+ **Note:** Version bump only for package use-intl
416
+
417
+
418
+
419
+
420
+
421
+ ## 1.3.8 (2021-03-26)
422
+
423
+ **Note:** Version bump only for package use-intl
424
+
425
+
426
+
427
+
428
+
429
+ ## 1.3.7 (2021-02-12)
430
+
431
+ **Note:** Version bump only for package use-intl
432
+
433
+
434
+
435
+
436
+
437
+ ## 1.3.6 (2021-02-09)
438
+
439
+ **Note:** Version bump only for package use-intl
440
+
441
+
442
+
443
+
444
+
445
+ ## 1.3.5 (2021-02-09)
446
+
447
+ **Note:** Version bump only for package use-intl
448
+
449
+
450
+
451
+
452
+
453
+ ## 1.3.4 (2021-02-09)
454
+
455
+ **Note:** Version bump only for package use-intl
456
+
457
+
458
+
459
+
460
+
461
+ ## [1.3.3](https://github.com/amannn/next-intl/tree/main/packages/use-intl/compare/v1.3.2...v1.3.3) (2021-02-09)
462
+
463
+
464
+ ### Bug Fixes
465
+
466
+ * Update DateTimeFormatOptions ([#29](https://github.com/amannn/next-intl/tree/main/packages/use-intl/issues/29)) ([91a8f52](https://github.com/amannn/next-intl/tree/main/packages/use-intl/commit/91a8f5216a9ef2a0e76be6e3e8bd706f5c7496a3))
467
+
468
+
469
+ ## Previous releases
470
+
471
+ See [next-intl changelog](https://github.com/amannn/next-intl/blob/main/CHANGELOG.md).
@@ -1,42 +1,39 @@
1
- import { inheritsLoose as _inheritsLoose, wrapNativeSuper as _wrapNativeSuper } from '../_virtual/use-intl.esm.js';
2
-
3
- var IntlErrorCode;
4
-
5
- (function (IntlErrorCode) {
6
- IntlErrorCode["MISSING_MESSAGE"] = "MISSING_MESSAGE";
7
- IntlErrorCode["MISSING_FORMAT"] = "MISSING_FORMAT";
8
- IntlErrorCode["INSUFFICIENT_PATH"] = "INSUFFICIENT_PATH";
9
- IntlErrorCode["INVALID_MESSAGE"] = "INVALID_MESSAGE";
10
- IntlErrorCode["INVALID_KEY"] = "INVALID_KEY";
11
- IntlErrorCode["FORMATTING_ERROR"] = "FORMATTING_ERROR";
12
- })(IntlErrorCode || (IntlErrorCode = {}));
13
-
14
- var IntlError = /*#__PURE__*/function (_Error) {
15
- _inheritsLoose(IntlError, _Error);
16
-
17
- function IntlError(code, originalMessage) {
18
- var _this;
19
-
20
- var message = code;
21
-
22
- if (originalMessage) {
23
- message += ': ' + originalMessage;
24
- }
25
-
26
- _this = _Error.call(this, message) || this;
27
- _this.code = void 0;
28
- _this.originalMessage = void 0;
29
- _this.code = code;
30
-
31
- if (originalMessage) {
32
- _this.originalMessage = originalMessage;
33
- }
34
-
35
- return _this;
36
- }
37
-
38
- return IntlError;
39
- }( /*#__PURE__*/_wrapNativeSuper(Error));
40
-
41
- export { IntlErrorCode, IntlError as default };
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/use-intl.esm.js';
2
+ import createTranslatorImpl from './use-intl.esm5.js';
3
+ import { defaultOnError, defaultGetMessageFallback } from './use-intl.esm4.js';
4
+
5
+ var _excluded = ["onError", "getMessageFallback", "messages", "namespace"];
6
+ /**
7
+ * Translates messages from the given namespace by using the ICU syntax.
8
+ * See https://formatjs.io/docs/core-concepts/icu-syntax.
9
+ *
10
+ * If no namespace is provided, all available messages are returned.
11
+ * The namespace can also indicate nesting by using a dot
12
+ * (e.g. `namespace.Component`).
13
+ */
14
+
15
+ function createTranslator(_ref) {
16
+ var _ref$onError = _ref.onError,
17
+ onError = _ref$onError === void 0 ? defaultOnError : _ref$onError,
18
+ _ref$getMessageFallba = _ref.getMessageFallback,
19
+ getMessageFallback = _ref$getMessageFallba === void 0 ? defaultGetMessageFallback : _ref$getMessageFallba,
20
+ messages = _ref.messages,
21
+ namespace = _ref.namespace,
22
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
23
+
24
+ // We have to wrap the actual function so the type inference for the optional
25
+ // namespace works correctly. See https://stackoverflow.com/a/71529575/343045
26
+ // The prefix ("!") is arbitrary.
27
+ return createTranslatorImpl(_extends({}, rest, {
28
+ onError: onError,
29
+ getMessageFallback: getMessageFallback,
30
+ messages: {
31
+ '!': messages
32
+ },
33
+ // @ts-ignore
34
+ namespace: namespace ? "!." + namespace : '!'
35
+ }), '!');
36
+ }
37
+
38
+ export { createTranslator as default };
42
39
  //# sourceMappingURL=use-intl.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-intl.esm.js","sources":["../../src/core/IntlError.tsx"],"sourcesContent":["export enum IntlErrorCode {\n MISSING_MESSAGE = 'MISSING_MESSAGE',\n MISSING_FORMAT = 'MISSING_FORMAT',\n INSUFFICIENT_PATH = 'INSUFFICIENT_PATH',\n INVALID_MESSAGE = 'INVALID_MESSAGE',\n INVALID_KEY = 'INVALID_KEY',\n FORMATTING_ERROR = 'FORMATTING_ERROR'\n}\n\nexport default class IntlError extends Error {\n public readonly code: IntlErrorCode;\n public readonly originalMessage: string | undefined;\n\n constructor(code: IntlErrorCode, originalMessage?: string) {\n let message: string = code;\n if (originalMessage) {\n message += ': ' + originalMessage;\n }\n super(message);\n\n this.code = code;\n if (originalMessage) {\n this.originalMessage = originalMessage;\n }\n }\n}\n"],"names":["IntlErrorCode","IntlError","code","originalMessage","message","Error"],"mappings":";;IAAYA,cAAZ;;AAAA,CAAA,UAAYA,aAAZ,EAAyB;AACvBA,EAAAA,aAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA,CAAA;AACAA,EAAAA,aAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA,CAAA;AACAA,EAAAA,aAAA,CAAA,mBAAA,CAAA,GAAA,mBAAA,CAAA;AACAA,EAAAA,aAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA,CAAA;AACAA,EAAAA,aAAA,CAAA,aAAA,CAAA,GAAA,aAAA,CAAA;AACAA,EAAAA,aAAA,CAAA,kBAAA,CAAA,GAAA,kBAAA,CAAA;AACD,CAPD,EAAYA,aAAa,KAAbA,aAAa,GAOxB,EAPwB,CAAzB,CAAA,CAAA;;IASqBC;;;AAInB,EAAYC,SAAAA,SAAAA,CAAAA,IAAZ,EAAiCC,eAAjC,EAAyD;AAAA,IAAA,IAAA,KAAA,CAAA;;AACvD,IAAIC,IAAAA,OAAO,GAAWF,IAAtB,CAAA;;AACA,IAAA,IAAIC,eAAJ,EAAqB;AACnBC,MAAAA,OAAO,IAAI,IAAA,GAAOD,eAAlB,CAAA;AACD,KAAA;;AACD,IAAA,KAAA,GAAA,MAAA,CAAA,IAAA,CAAA,IAAA,EAAMC,OAAN,CAAA,IAAA,IAAA,CAAA;AALuD,IAAA,KAAA,CAHzCF,IAGyC,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,KAAA,CAFzCC,eAEyC,GAAA,KAAA,CAAA,CAAA;AAOvD,IAAKD,KAAAA,CAAAA,IAAL,GAAYA,IAAZ,CAAA;;AACA,IAAA,IAAIC,eAAJ,EAAqB;AACnB,MAAKA,KAAAA,CAAAA,eAAL,GAAuBA,eAAvB,CAAA;AACD,KAAA;;AAVsD,IAAA,OAAA,KAAA,CAAA;AAWxD,GAAA;;;iCAfoCE;;;;"}
1
+ {"version":3,"file":"use-intl.esm.js","sources":["../../src/core/createTranslator.tsx"],"sourcesContent":["import Formats from './Formats';\nimport IntlConfiguration from './IntlConfiguration';\nimport TranslationValues from './TranslationValues';\nimport createTranslatorImpl, {\n CoreRichTranslationValues\n} from './createTranslatorImpl';\nimport {defaultGetMessageFallback, defaultOnError} from './defaults';\nimport MessageKeys from './utils/MessageKeys';\nimport NamespaceKeys from './utils/NamespaceKeys';\nimport NestedKeyOf from './utils/NestedKeyOf';\nimport NestedValueOf from './utils/NestedValueOf';\n\n/**\n * Translates messages from the given namespace by using the ICU syntax.\n * See https://formatjs.io/docs/core-concepts/icu-syntax.\n *\n * If no namespace is provided, all available messages are returned.\n * The namespace can also indicate nesting by using a dot\n * (e.g. `namespace.Component`).\n */\nexport default function createTranslator<\n NestedKey extends NamespaceKeys<\n IntlMessages,\n NestedKeyOf<IntlMessages>\n > = never\n>({\n onError = defaultOnError,\n getMessageFallback = defaultGetMessageFallback,\n messages,\n namespace,\n ...rest\n}: IntlConfiguration & {\n messages: IntlMessages;\n namespace?: NestedKey;\n}): // Explicitly defining the return type is necessary as TypeScript would get it wrong\n{\n // Default invocation\n <\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey,\n values?: TranslationValues,\n formats?: Partial<Formats>\n ): string;\n\n // `rich`\n rich<\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey,\n values?: CoreRichTranslationValues,\n formats?: Partial<Formats>\n ): string;\n\n // `raw`\n raw<\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey\n ): any;\n} {\n // We have to wrap the actual function so the type inference for the optional\n // namespace works correctly. See https://stackoverflow.com/a/71529575/343045\n // The prefix (\"!\") is arbitrary.\n return createTranslatorImpl<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >(\n {\n ...rest,\n onError,\n getMessageFallback,\n messages: {'!': messages},\n // @ts-ignore\n namespace: namespace ? `!.${namespace}` : '!'\n },\n '!'\n );\n}\n"],"names":["createTranslator","onError","defaultOnError","getMessageFallback","defaultGetMessageFallback","messages","namespace","rest","createTranslatorImpl"],"mappings":";;;;;AAYA;;;;;;;AAOG;;AACqB,SAAAA,gBAAA,CAcvB,IAAA,EAAA;AAAA,EAAA,IAAA,YAAA,GAAA,IAAA,CARCC,OAQD;AAAA,MARCA,OAQD,6BARWC,cAQX,GAAA,YAAA;AAAA,MAAA,qBAAA,GAAA,IAAA,CAPCC,kBAOD;AAAA,MAPCA,kBAOD,sCAPsBC,yBAOtB,GAAA,qBAAA;AAAA,MANCC,QAMD,QANCA,QAMD;AAAA,MALCC,SAKD,QALCA,SAKD;AAAA,MAJIC,IAIJ,GAAA,6BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AA4DC;AACA;AACA;AACA,EAAOC,OAAAA,oBAAoB,cAKpBD,IALoB,EAAA;AAMvBN,IAAAA,OAAO,EAAPA,OANuB;AAOvBE,IAAAA,kBAAkB,EAAlBA,kBAPuB;AAQvBE,IAAAA,QAAQ,EAAE;AAAC,MAAKA,GAAAA,EAAAA,QAAAA;AAAN,KARa;AASvB;AACAC,IAAAA,SAAS,EAAEA,SAAS,GAAA,IAAA,GAAQA,SAAR,GAAsB,GAAA;AAVnB,GAAA,CAAA,EAYzB,GAZyB,CAA3B,CAAA;AAcD;;;;"}
@@ -1,39 +1,42 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/use-intl.esm.js';
2
- import createTranslatorImpl from './use-intl.esm4.js';
3
- import { defaultOnError, defaultGetMessageFallback } from './use-intl.esm5.js';
4
-
5
- var _excluded = ["onError", "getMessageFallback", "messages", "namespace"];
6
- /**
7
- * Translates messages from the given namespace by using the ICU syntax.
8
- * See https://formatjs.io/docs/core-concepts/icu-syntax.
9
- *
10
- * If no namespace is provided, all available messages are returned.
11
- * The namespace can also indicate nesting by using a dot
12
- * (e.g. `namespace.Component`).
13
- */
14
-
15
- function createTranslator(_ref) {
16
- var _ref$onError = _ref.onError,
17
- onError = _ref$onError === void 0 ? defaultOnError : _ref$onError,
18
- _ref$getMessageFallba = _ref.getMessageFallback,
19
- getMessageFallback = _ref$getMessageFallba === void 0 ? defaultGetMessageFallback : _ref$getMessageFallba,
20
- messages = _ref.messages,
21
- namespace = _ref.namespace,
22
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
23
-
24
- // We have to wrap the actual function so the type inference for the optional
25
- // namespace works correctly. See https://stackoverflow.com/a/71529575/343045
26
- // The prefix ("!") is arbitrary.
27
- return createTranslatorImpl(_extends({}, rest, {
28
- onError: onError,
29
- getMessageFallback: getMessageFallback,
30
- messages: {
31
- '!': messages
32
- },
33
- // @ts-ignore
34
- namespace: namespace ? "!." + namespace : '!'
35
- }), '!');
36
- }
37
-
38
- export { createTranslator as default };
1
+ import { inheritsLoose as _inheritsLoose, wrapNativeSuper as _wrapNativeSuper } from '../_virtual/use-intl.esm.js';
2
+
3
+ var IntlErrorCode;
4
+
5
+ (function (IntlErrorCode) {
6
+ IntlErrorCode["MISSING_MESSAGE"] = "MISSING_MESSAGE";
7
+ IntlErrorCode["MISSING_FORMAT"] = "MISSING_FORMAT";
8
+ IntlErrorCode["INSUFFICIENT_PATH"] = "INSUFFICIENT_PATH";
9
+ IntlErrorCode["INVALID_MESSAGE"] = "INVALID_MESSAGE";
10
+ IntlErrorCode["INVALID_KEY"] = "INVALID_KEY";
11
+ IntlErrorCode["FORMATTING_ERROR"] = "FORMATTING_ERROR";
12
+ })(IntlErrorCode || (IntlErrorCode = {}));
13
+
14
+ var IntlError = /*#__PURE__*/function (_Error) {
15
+ _inheritsLoose(IntlError, _Error);
16
+
17
+ function IntlError(code, originalMessage) {
18
+ var _this;
19
+
20
+ var message = code;
21
+
22
+ if (originalMessage) {
23
+ message += ': ' + originalMessage;
24
+ }
25
+
26
+ _this = _Error.call(this, message) || this;
27
+ _this.code = void 0;
28
+ _this.originalMessage = void 0;
29
+ _this.code = code;
30
+
31
+ if (originalMessage) {
32
+ _this.originalMessage = originalMessage;
33
+ }
34
+
35
+ return _this;
36
+ }
37
+
38
+ return IntlError;
39
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
40
+
41
+ export { IntlErrorCode, IntlError as default };
39
42
  //# sourceMappingURL=use-intl.esm2.js.map