next-intl 2.13.0 → 2.14.0-beta.1

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 (199) hide show
  1. package/CHANGELOG.md +562 -0
  2. package/config.js +3 -0
  3. package/dist/client/getCookieLocale.d.ts +1 -0
  4. package/dist/client/hasPathnamePrefixed.d.ts +1 -0
  5. package/dist/client/index.d.ts +14 -1
  6. package/dist/client/localizeHref.d.ts +4 -0
  7. package/dist/client/next-intl.esm.js +37 -0
  8. package/dist/client/next-intl.esm.js.map +1 -0
  9. package/dist/client/next-intl.esm2.js +24 -0
  10. package/dist/client/next-intl.esm2.js.map +1 -0
  11. package/dist/client/next-intl.esm3.js +23 -0
  12. package/dist/client/next-intl.esm3.js.map +1 -0
  13. package/dist/client/next-intl.esm4.js +7 -0
  14. package/dist/client/next-intl.esm4.js.map +1 -0
  15. package/dist/client/usePathname.d.ts +11 -0
  16. package/dist/client/useRouter.d.ts +8 -0
  17. package/dist/index.d.ts +42 -0
  18. package/dist/middleware/NextIntlMiddlewareConfig.d.ts +18 -0
  19. package/dist/next-intl.cjs.development.js +174 -1
  20. package/dist/next-intl.cjs.development.js.map +1 -1
  21. package/dist/next-intl.cjs.production.min.js +1 -1
  22. package/dist/next-intl.cjs.production.min.js.map +1 -1
  23. package/dist/next-intl.esm.js +14 -1
  24. package/dist/next-intl.esm.js.map +1 -1
  25. package/dist/react-client/next-intl.esm.js +16 -0
  26. package/dist/react-client/next-intl.esm.js.map +1 -0
  27. package/dist/react-client/useLocalizedRouter.d.ts +8 -0
  28. package/dist/react-server/index.d.ts +46 -8
  29. package/dist/react-server/useFormatter.d.ts +2 -0
  30. package/dist/react-server/useHook.d.ts +1 -0
  31. package/dist/react-server/useIntl.d.ts +5 -0
  32. package/dist/react-server/useLocale.d.ts +2 -0
  33. package/dist/react-server/useNow.d.ts +2 -0
  34. package/dist/react-server/useTimeZone.d.ts +2 -0
  35. package/dist/react-server/useTranslations.d.ts +2 -0
  36. package/dist/server/createRequestConfig.d.ts +4 -0
  37. package/dist/server/getConfig.d.ts +23 -0
  38. package/dist/server/getFormatter.d.ts +6 -0
  39. package/dist/server/getIntl.d.ts +7 -0
  40. package/dist/server/getLocale.d.ts +2 -0
  41. package/dist/server/getNow.d.ts +2 -0
  42. package/dist/server/getRequestConfig.d.ts +10 -0
  43. package/dist/server/getTimeZone.d.ts +2 -0
  44. package/dist/server/getTranslations.d.ts +38 -0
  45. package/dist/server/index.d.ts +13 -3
  46. package/dist/server/redirect.d.ts +1 -0
  47. package/dist/shared/Link.d.ts +7 -0
  48. package/dist/shared/LocalizedLink.d.ts +7 -0
  49. package/dist/shared/constants.d.ts +1 -0
  50. package/dist/shared/localizePathname.d.ts +1 -0
  51. package/dist/shared/next-intl.esm.js +55 -31
  52. package/dist/shared/next-intl.esm.js.map +1 -1
  53. package/dist/shared/next-intl.esm2.js +46 -0
  54. package/dist/shared/next-intl.esm2.js.map +1 -0
  55. package/dist/shared/next-intl.esm3.js +12 -0
  56. package/dist/shared/next-intl.esm3.js.map +1 -0
  57. package/dist/shared/next-intl.esm4.js +6 -0
  58. package/dist/shared/next-intl.esm4.js.map +1 -0
  59. package/dist/src/client/getCookieLocale.d.ts +1 -0
  60. package/dist/src/client/getCookieLocale.js +17 -0
  61. package/dist/src/client/getCookieLocale.js.map +1 -0
  62. package/dist/src/client/hasPathnamePrefixed.d.ts +1 -0
  63. package/dist/src/client/hasPathnamePrefixed.js +6 -0
  64. package/dist/src/client/hasPathnamePrefixed.js.map +1 -0
  65. package/dist/src/client/index.d.ts +14 -1
  66. package/dist/src/client/index.js +14 -1
  67. package/dist/src/client/index.js.map +1 -1
  68. package/dist/src/client/localizeHref.d.ts +4 -0
  69. package/dist/src/client/localizeHref.js +30 -0
  70. package/dist/src/client/localizeHref.js.map +1 -0
  71. package/dist/src/client/usePathname.d.ts +11 -0
  72. package/dist/src/client/usePathname.js +40 -0
  73. package/dist/src/client/usePathname.js.map +1 -0
  74. package/dist/src/client/useRouter.d.ts +8 -0
  75. package/dist/src/client/useRouter.js +19 -0
  76. package/dist/src/client/useRouter.js.map +1 -0
  77. package/dist/src/index.d.ts +42 -0
  78. package/dist/src/index.js +9 -0
  79. package/dist/src/index.js.map +1 -1
  80. package/dist/src/middleware/NextIntlMiddlewareConfig.d.ts +18 -0
  81. package/dist/src/middleware/middleware.js +50 -3
  82. package/dist/src/middleware/middleware.js.map +1 -1
  83. package/dist/src/react-client/useLocalizedRouter.d.ts +8 -0
  84. package/dist/src/react-client/useLocalizedRouter.js +12 -0
  85. package/dist/src/react-client/useLocalizedRouter.js.map +1 -0
  86. package/dist/src/react-server/index.d.ts +46 -8
  87. package/dist/src/react-server/index.js +18 -13
  88. package/dist/src/react-server/index.js.map +1 -1
  89. package/dist/src/react-server/useFormatter.d.ts +2 -0
  90. package/dist/src/react-server/useFormatter.js +8 -0
  91. package/dist/src/react-server/useFormatter.js.map +1 -0
  92. package/dist/src/react-server/useHook.d.ts +1 -0
  93. package/dist/src/react-server/useHook.js +24 -0
  94. package/dist/src/react-server/useHook.js.map +1 -0
  95. package/dist/src/react-server/useIntl.d.ts +5 -0
  96. package/dist/src/react-server/useIntl.js +11 -0
  97. package/dist/src/react-server/useIntl.js.map +1 -0
  98. package/dist/src/react-server/useLocale.d.ts +2 -0
  99. package/dist/src/react-server/useLocale.js +7 -0
  100. package/dist/src/react-server/useLocale.js.map +1 -0
  101. package/dist/src/react-server/useNow.d.ts +2 -0
  102. package/dist/src/react-server/useNow.js +9 -0
  103. package/dist/src/react-server/useNow.js.map +1 -0
  104. package/dist/src/react-server/useTimeZone.d.ts +2 -0
  105. package/dist/src/react-server/useTimeZone.js +8 -0
  106. package/dist/src/react-server/useTimeZone.js.map +1 -0
  107. package/dist/src/react-server/useTranslations.d.ts +2 -0
  108. package/dist/src/react-server/useTranslations.js +9 -0
  109. package/dist/src/react-server/useTranslations.js.map +1 -0
  110. package/dist/src/server/createRequestConfig.d.ts +4 -0
  111. package/dist/src/server/createRequestConfig.js +5 -0
  112. package/dist/src/server/createRequestConfig.js.map +1 -0
  113. package/dist/src/server/getConfig.d.ts +23 -0
  114. package/dist/src/server/getConfig.js +23 -0
  115. package/dist/src/server/getConfig.js.map +1 -0
  116. package/dist/src/server/getFormatter.d.ts +6 -0
  117. package/dist/src/server/getFormatter.js +9 -0
  118. package/dist/src/server/getFormatter.js.map +1 -0
  119. package/dist/src/server/getIntl.d.ts +7 -0
  120. package/dist/src/server/getIntl.js +15 -0
  121. package/dist/src/server/getIntl.js.map +1 -0
  122. package/dist/src/server/getLocale.d.ts +2 -0
  123. package/dist/src/server/getLocale.js +33 -0
  124. package/dist/src/server/getLocale.js.map +1 -0
  125. package/dist/src/server/getNow.d.ts +2 -0
  126. package/dist/src/server/getNow.js +8 -0
  127. package/dist/src/server/getNow.js.map +1 -0
  128. package/dist/src/server/getRequestConfig.d.ts +10 -0
  129. package/dist/src/server/getRequestConfig.js +7 -0
  130. package/dist/src/server/getRequestConfig.js.map +1 -0
  131. package/dist/src/server/getTimeZone.d.ts +2 -0
  132. package/dist/src/server/getTimeZone.js +8 -0
  133. package/dist/src/server/getTimeZone.js.map +1 -0
  134. package/dist/src/server/getTranslations.d.ts +38 -0
  135. package/dist/src/server/getTranslations.js +23 -0
  136. package/dist/src/server/getTranslations.js.map +1 -0
  137. package/dist/src/server/index.d.ts +13 -3
  138. package/dist/src/server/index.js +16 -15
  139. package/dist/src/server/index.js.map +1 -1
  140. package/dist/src/server/redirect.d.ts +1 -0
  141. package/dist/src/server/redirect.js +9 -0
  142. package/dist/src/server/redirect.js.map +1 -0
  143. package/dist/src/shared/Link.d.ts +7 -0
  144. package/dist/src/shared/Link.js +45 -0
  145. package/dist/src/shared/Link.js.map +1 -0
  146. package/dist/src/shared/LocalizedLink.d.ts +7 -0
  147. package/dist/src/shared/LocalizedLink.js +18 -0
  148. package/dist/src/shared/LocalizedLink.js.map +1 -0
  149. package/dist/src/shared/constants.d.ts +1 -0
  150. package/dist/src/shared/constants.js +2 -0
  151. package/dist/src/shared/constants.js.map +1 -1
  152. package/dist/src/shared/localizePathname.d.ts +1 -0
  153. package/dist/src/shared/localizePathname.js +8 -0
  154. package/dist/src/shared/localizePathname.js.map +1 -0
  155. package/package.json +13 -5
  156. package/plugin.d.ts +3 -0
  157. package/plugin.js +65 -0
  158. package/src/.DS_Store +0 -0
  159. package/src/client/getCookieLocale.tsx +19 -0
  160. package/src/client/hasPathnamePrefixed.tsx +7 -0
  161. package/src/client/index.tsx +19 -1
  162. package/src/client/localizeHref.tsx +46 -0
  163. package/src/client/usePathname.tsx +48 -0
  164. package/src/client/useRouter.tsx +23 -0
  165. package/src/index.tsx +13 -0
  166. package/src/middleware/NextIntlMiddlewareConfig.tsx +21 -0
  167. package/src/middleware/middleware.tsx +61 -3
  168. package/src/react-client/useLocalizedRouter.tsx +17 -0
  169. package/src/react-server/index.tsx +22 -15
  170. package/src/react-server/useFormatter.tsx +10 -0
  171. package/src/react-server/useHook.tsx +30 -0
  172. package/src/react-server/useIntl.tsx +15 -0
  173. package/src/react-server/useLocale.tsx +9 -0
  174. package/src/react-server/useNow.tsx +15 -0
  175. package/src/react-server/useTimeZone.tsx +10 -0
  176. package/src/react-server/useTranslations.tsx +13 -0
  177. package/src/server/createRequestConfig.tsx +9 -0
  178. package/src/server/getConfig.tsx +27 -0
  179. package/src/server/getFormatter.tsx +10 -0
  180. package/src/server/getIntl.tsx +20 -0
  181. package/src/server/getLocale.tsx +40 -0
  182. package/src/server/getNow.tsx +9 -0
  183. package/src/server/getRequestConfig.tsx +18 -0
  184. package/src/server/getTimeZone.tsx +9 -0
  185. package/src/server/getTranslations.tsx +102 -0
  186. package/src/server/index.tsx +20 -18
  187. package/src/server/redirect.tsx +10 -0
  188. package/src/shared/Link.tsx +61 -0
  189. package/src/shared/LocalizedLink.tsx +26 -0
  190. package/src/shared/constants.tsx +3 -0
  191. package/src/shared/localizePathname.tsx +9 -0
  192. package/withNextIntl.d.ts +5 -0
  193. package/withNextIntl.js +13 -0
  194. package/LICENSE +0 -21
  195. package/dist/client/NextIntlClientProvider.d.ts +0 -4
  196. package/dist/src/client/NextIntlClientProvider.d.ts +0 -4
  197. package/dist/src/client/NextIntlClientProvider.js +0 -16
  198. package/dist/src/client/NextIntlClientProvider.js.map +0 -1
  199. package/src/client/NextIntlClientProvider.tsx +0 -18
package/CHANGELOG.md ADDED
@@ -0,0 +1,562 @@
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.13.0 (2023-04-12)
7
+
8
+
9
+ ### Features
10
+
11
+ * Sync improvements from RSC branch to main ([#238](https://github.com/amannn/next-intl/issues/238)) ([1d12ba2](https://github.com/amannn/next-intl/commit/1d12ba219afdbca77663c9d20f18db746de033fd)), closes [#149](https://github.com/amannn/next-intl/issues/149) [#237](https://github.com/amannn/next-intl/issues/237)
12
+
13
+
14
+
15
+
16
+
17
+ # 2.12.0 (2023-03-25)
18
+
19
+
20
+ ### Features
21
+
22
+ * Add `BigInt` support for `useFormatter.format()` by [@tacomanator](https://github.com/tacomanator) ([#222](https://github.com/amannn/next-intl/issues/222)) ([a5ded6c](https://github.com/amannn/next-intl/commit/a5ded6c4cd706d5361556865050c5948a4d78887))
23
+
24
+
25
+
26
+
27
+
28
+ # 2.11.0 (2023-03-06)
29
+
30
+
31
+ ### Features
32
+
33
+ * Add `useFormatter` (replaces `useIntl`) ([#209](https://github.com/amannn/next-intl/issues/209)) ([021b682](https://github.com/amannn/next-intl/commit/021b682aa00063b040ccf1c927111780c1f0a710))
34
+
35
+
36
+
37
+
38
+
39
+ ## 2.10.4 (2023-02-20)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * Return up-to-date translations when messages change ([#199](https://github.com/amannn/next-intl/issues/199)) ([78f39b4](https://github.com/amannn/next-intl/commit/78f39b408933d6fcbb38d085704bfbe14065dc0a))
45
+
46
+
47
+
48
+
49
+
50
+ ## 2.10.3 (2023-02-19)
51
+
52
+ **Note:** Version bump only for package next-intl
53
+
54
+
55
+
56
+
57
+
58
+ ## 2.10.2 (2022-12-09)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * Remove magic `__DEV__` global ([#151](https://github.com/amannn/next-intl/issues/151)) ([7d5aa6a](https://github.com/amannn/next-intl/commit/7d5aa6a8fda0189adc6440214270e07a5593d98f))
64
+
65
+
66
+
67
+
68
+
69
+ ## 2.10.1 (2022-12-09)
70
+
71
+ **Note:** Version bump only for package next-intl
72
+
73
+
74
+
75
+
76
+
77
+ # 2.10.0 (2022-12-09)
78
+
79
+
80
+ ### Features
81
+
82
+ * Add support for using `next-intl` in the `app` folder with Next.js 13 (see https://next-intl-docs.vercel.app/docs/next-13, [#144](https://github.com/amannn/next-intl/issues/144)) ([18c94d6](https://github.com/amannn/next-intl/commit/18c94d623a05afa7710fea83360f12f9811fb38d))
83
+
84
+
85
+
86
+
87
+
88
+ ## 2.9.2 (2022-12-08)
89
+
90
+ **Note:** Version bump only for package next-intl
91
+
92
+
93
+
94
+
95
+
96
+ ## 2.9.1 (2022-11-03)
97
+
98
+ **Note:** Version bump only for package next-intl
99
+
100
+
101
+
102
+
103
+
104
+ # 2.9.0 (2022-10-27)
105
+
106
+
107
+ ### Features
108
+
109
+ * Next.js 13 compatibility ([#140](https://github.com/amannn/next-intl/issues/140)) ([65326a0](https://github.com/amannn/next-intl/commit/65326a0b47980f260df466a283a6e7a0aa5e1cd0)), closes [#139](https://github.com/amannn/next-intl/issues/139)
110
+
111
+
112
+
113
+
114
+
115
+ # 2.8.0 (2022-10-18)
116
+
117
+
118
+ ### Features
119
+
120
+ * 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/issues/137)) ([91f7489](https://github.com/amannn/next-intl/commit/91f748972008b8587553b48aa36c95d7348b4b0c))
121
+
122
+
123
+
124
+
125
+
126
+ ## 2.7.6 (2022-09-22)
127
+
128
+ **Note:** Version bump only for package next-intl
129
+
130
+
131
+
132
+
133
+
134
+ ## 2.7.5 (2022-08-30)
135
+
136
+ **Note:** Version bump only for package next-intl
137
+
138
+
139
+
140
+
141
+
142
+ ## 2.7.4 (2022-05-30)
143
+
144
+
145
+ ### Bug Fixes
146
+
147
+ * Adapt TypeScript validation to work with messages files that only have a single top-level namespace ([#115](https://github.com/amannn/next-intl/issues/115)) ([cf0b83e](https://github.com/amannn/next-intl/commit/cf0b83e3a591cfe87e17537c3ca0c7000cc70b1e))
148
+
149
+
150
+
151
+
152
+
153
+ ## 2.7.3 (2022-05-20)
154
+
155
+
156
+ ### Bug Fixes
157
+
158
+ * Add back the ability to render the provider without messages ([#113](https://github.com/amannn/next-intl/issues/113)) ([8395822](https://github.com/amannn/next-intl/commit/8395822fa17cd0a04b88f8edce3b20e5e613fc78))
159
+
160
+
161
+
162
+
163
+
164
+ ## 2.7.2 (2022-05-10)
165
+
166
+
167
+ ### Bug Fixes
168
+
169
+ * Enable tree-shaking ([#108](https://github.com/amannn/next-intl/issues/108)) ([157b0e2](https://github.com/amannn/next-intl/commit/157b0e28376055e7e34e86007c51d008c8e214aa))
170
+
171
+
172
+
173
+
174
+
175
+ ## 2.7.1 (2022-04-28)
176
+
177
+
178
+ ### Bug Fixes
179
+
180
+ * Allow null message values ([#110](https://github.com/amannn/next-intl/issues/110)) ([14ae8ff](https://github.com/amannn/next-intl/commit/14ae8ffdf1b295873f14081e2c3709d0f9bd2b9e))
181
+
182
+
183
+
184
+
185
+
186
+ # 2.7.0 (2022-04-28)
187
+
188
+
189
+ ### Features
190
+
191
+ * Warn for invalid namespace keys ([#106](https://github.com/amannn/next-intl/issues/106)) ([e86ab28](https://github.com/amannn/next-intl/commit/e86ab28b9180b866ce1a0a9173355d4b686b7d07))
192
+
193
+
194
+
195
+
196
+
197
+ # 2.6.0 (2022-04-08)
198
+
199
+
200
+ ### Features
201
+
202
+ * Support React 18 ([#98](https://github.com/amannn/next-intl/issues/98)) ([38614eb](https://github.com/amannn/next-intl/commit/38614eb9c6d6fb96704424d7f3ff8a67a24b789e))
203
+
204
+
205
+
206
+
207
+
208
+ # 2.5.0 (2022-04-01)
209
+
210
+
211
+ ### Features
212
+
213
+ * Type safe messages ([#93](https://github.com/amannn/next-intl/issues/93)) ([13b49b1](https://github.com/amannn/next-intl/commit/13b49b138bc0ec3adbe661af6a70dfabfe7e86b0))
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+ ## 2.4.1 (2022-03-24)
222
+
223
+
224
+ ### Bug Fixes
225
+
226
+ * Overwrite prerelease ([6caf5c4](https://github.com/amannn/next-intl/commit/6caf5c48a35179f802503bc6580469187765c837))
227
+
228
+
229
+
230
+
231
+
232
+ # [2.4.0](https://github.com/amannn/next-intl/compare/v2.3.5...v2.4.0) (2022-02-08)
233
+
234
+ **Note:** Version bump only for package next-intl
235
+
236
+
237
+
238
+
239
+
240
+ ## 2.3.5 (2022-01-19)
241
+
242
+
243
+ ### Bug Fixes
244
+
245
+ * Support identical wrappers with identical text content in rich text ([#80](https://github.com/amannn/next-intl/issues/80)) ([b35bb9f](https://github.com/amannn/next-intl/commit/b35bb9ffc5fa56c6260b6b424be3cd875f199aef))
246
+
247
+
248
+
249
+
250
+
251
+ ## 2.3.4 (2022-01-04)
252
+
253
+
254
+ ### Bug Fixes
255
+
256
+ * Allow usage outside of Next.js (e.g. Jest and Storybook) ([#76](https://github.com/amannn/next-intl/issues/76)) ([7c6925b](https://github.com/amannn/next-intl/commit/7c6925b39338be95c1c940c67a1ae2f5e3f85cdd))
257
+
258
+
259
+
260
+
261
+
262
+ ## 2.3.3 (2021-12-23)
263
+
264
+ **Note:** Version bump only for package next-intl
265
+
266
+
267
+
268
+
269
+
270
+ ## 2.3.2 (2021-12-23)
271
+
272
+ **Note:** Version bump only for package next-intl
273
+
274
+
275
+
276
+
277
+
278
+ ## 2.3.1 (2021-12-23)
279
+
280
+ **Note:** Version bump only for package next-intl
281
+
282
+
283
+
284
+
285
+
286
+ # 2.3.0 (2021-11-24)
287
+
288
+
289
+ ### Features
290
+
291
+ * Add `useLocale` and `useTimeZone` ([#67](https://github.com/amannn/next-intl/issues/67)) ([7833f4a](https://github.com/amannn/next-intl/commit/7833f4adc1aadc937cbaa550a968ef6f7b4f5ee1))
292
+
293
+
294
+
295
+
296
+
297
+ ## 2.2.1 (2021-11-23)
298
+
299
+
300
+ ### Bug Fixes
301
+
302
+ * Clearer error message when no messages are provided ([#66](https://github.com/amannn/next-intl/issues/66)) ([742729a](https://github.com/amannn/next-intl/commit/742729aaddd63367efc2b79ef0cdf93545abdfb0))
303
+
304
+
305
+
306
+
307
+
308
+ # 2.2.0 (2021-11-02)
309
+
310
+
311
+ ### Features
312
+
313
+ * 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/issues/63)) ([d73e935](https://github.com/amannn/next-intl/commit/d73e9358bf13c87c0a653bd9fbed35e41548ff1d))
314
+
315
+
316
+
317
+
318
+
319
+ ## 2.1.1 (2021-10-28)
320
+
321
+ **Note:** Version bump only for package next-intl
322
+
323
+
324
+
325
+
326
+
327
+ # 2.1.0 (2021-10-27)
328
+
329
+
330
+ ### Features
331
+
332
+ * Support Next.js 12 ([#61](https://github.com/amannn/next-intl/issues/61)) ([0391cc8](https://github.com/amannn/next-intl/commit/0391cc85d3401bca9df29080a569957f6be93c85))
333
+
334
+
335
+
336
+
337
+
338
+ ## 2.0.5 (2021-09-28)
339
+
340
+ **Note:** Version bump only for package next-intl
341
+
342
+
343
+
344
+
345
+
346
+ ## 2.0.4 (2021-09-28)
347
+
348
+ **Note:** Version bump only for package next-intl
349
+
350
+
351
+
352
+
353
+
354
+ ## 2.0.3 (2021-09-17)
355
+
356
+ **Note:** Version bump only for package next-intl
357
+
358
+
359
+
360
+
361
+
362
+ ## 2.0.2 (2021-09-17)
363
+
364
+
365
+ ### Bug Fixes
366
+
367
+ * Render correct messages when the namespace changes in `useTranslations` ([#58](https://github.com/amannn/next-intl/issues/58)) ([b8f7dab](https://github.com/amannn/next-intl/commit/b8f7dab0e3a213a91bdcd7929547cd01ba0b5f54))
368
+
369
+
370
+
371
+
372
+
373
+ ## 2.0.1 (2021-09-04)
374
+
375
+ **Note:** Version bump only for package next-intl
376
+
377
+
378
+
379
+
380
+
381
+ # 2.0.0 (2021-08-26)
382
+
383
+
384
+ * feat!: Use a separate API for rich text formatting to avoid type casting in TypeScript #54 ([4c13a64](https://github.com/amannn/next-intl/commit/4c13a644ce99992d9e57887afe35a09b8e3d6572)), closes [#54](https://github.com/amannn/next-intl/issues/54)
385
+
386
+
387
+ ### BREAKING CHANGES
388
+
389
+ * 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.
390
+
391
+
392
+
393
+
394
+
395
+ ## 1.5.1 (2021-08-13)
396
+
397
+
398
+ ### Bug Fixes
399
+
400
+ * Improve API for rendering raw messages and add docs ([#51](https://github.com/amannn/next-intl/issues/51)) ([19f4a7e](https://github.com/amannn/next-intl/commit/19f4a7e4e81e1cff78dc7e3f337dce69800be280))
401
+
402
+
403
+
404
+
405
+
406
+ # 1.5.0 (2021-08-10)
407
+
408
+
409
+ ### Features
410
+
411
+ * Add flag to return raw messages ([#48](https://github.com/amannn/next-intl/issues/48)) ([b34e19f](https://github.com/amannn/next-intl/commit/b34e19ff618308b7d0c01e7969975215d96ff608))
412
+
413
+
414
+
415
+
416
+
417
+ ## 1.4.7 (2021-08-02)
418
+
419
+
420
+ ### Bug Fixes
421
+
422
+ * Adjust default for `onError` of the provider to log errors correctly ([#46](https://github.com/amannn/next-intl/issues/46)) ([d0a1986](https://github.com/amannn/next-intl/commit/d0a1986905e30acac40630e9ea6d099caad617fb))
423
+
424
+
425
+
426
+
427
+
428
+ ## 1.4.6 (2021-08-02)
429
+
430
+
431
+ ### Bug Fixes
432
+
433
+ * Use `timeZone` in translation function from `useTranslations` ([#45](https://github.com/amannn/next-intl/issues/45)) ([ebf75f2](https://github.com/amannn/next-intl/commit/ebf75f2add0ddc46f89768e9481bb16c56f94720))
434
+
435
+
436
+
437
+
438
+
439
+ ## 1.4.5 (2021-07-26)
440
+
441
+ **Note:** Version bump only for package next-intl
442
+
443
+
444
+
445
+
446
+
447
+ ## 1.4.4 (2021-07-08)
448
+
449
+ **Note:** Version bump only for package next-intl
450
+
451
+
452
+
453
+
454
+
455
+ ## 1.4.3 (2021-07-08)
456
+
457
+ **Note:** Version bump only for package next-intl
458
+
459
+
460
+
461
+
462
+
463
+ ## [1.4.2](https://github.com/amannn/next-intl/compare/v1.4.1...v1.4.2) (2021-06-16)
464
+
465
+
466
+ ### Bug Fixes
467
+
468
+ * Don't require `react-dom` as a peer dependency ([#39](https://github.com/amannn/next-intl/issues/39)) ([39edfcd](https://github.com/amannn/next-intl/commit/39edfcd9091e09570fc2152cda6a1e9ae5e7c210))
469
+
470
+
471
+
472
+
473
+
474
+ ## [1.4.1](https://github.com/amannn/next-intl/compare/v1.4.0...v1.4.1) (2021-06-16)
475
+
476
+
477
+ ### Bug Fixes
478
+
479
+ * Use correct version range for use-intl ([02c33d3](https://github.com/amannn/next-intl/commit/02c33d341794bdcf6ba30ca8325a6a843a684635))
480
+
481
+
482
+
483
+
484
+
485
+ # [1.4.0](https://github.com/amannn/next-intl/compare/v1.3.11...v1.4.0) (2021-06-16)
486
+
487
+
488
+ ### Features
489
+
490
+ * Support Next.js 11 ([#36](https://github.com/amannn/next-intl/issues/36)) ([fc59871](https://github.com/amannn/next-intl/commit/fc5987156c2a74a9703e39f2b7ee19b84165fd77))
491
+
492
+
493
+
494
+
495
+
496
+ ## 1.3.11 (2021-05-07)
497
+
498
+ **Note:** Version bump only for package next-intl
499
+
500
+
501
+
502
+
503
+
504
+ ## 1.3.10 (2021-05-02)
505
+
506
+ **Note:** Version bump only for package next-intl
507
+
508
+
509
+
510
+
511
+
512
+ ## 1.3.9 (2021-05-02)
513
+
514
+ **Note:** Version bump only for package next-intl
515
+
516
+
517
+
518
+
519
+
520
+ ## 1.3.8 (2021-03-26)
521
+
522
+ **Note:** Version bump only for package next-intl
523
+
524
+
525
+
526
+
527
+
528
+ ## 1.3.7 (2021-02-12)
529
+
530
+ **Note:** Version bump only for package next-intl
531
+
532
+
533
+
534
+
535
+
536
+ ## 1.3.6 (2021-02-09)
537
+
538
+ **Note:** Version bump only for package next-intl
539
+
540
+
541
+
542
+
543
+
544
+ ## 1.3.5 (2021-02-09)
545
+
546
+ **Note:** Version bump only for package next-intl
547
+
548
+
549
+
550
+
551
+
552
+ ## 1.3.4 (2021-02-09)
553
+
554
+ **Note:** Version bump only for package next-intl
555
+
556
+
557
+
558
+
559
+
560
+ ## [1.3.3](https://github.com/amannn/next-intl/compare/v1.3.2...v1.3.3) (2021-02-09)
561
+
562
+ **Note:** Version bump only for package next-intl
package/config.js ADDED
@@ -0,0 +1,3 @@
1
+ throw new Error(
2
+ "Couldn't find next-intl config file. Please follow the instructions at https://next-intl-docs.vercel.app/docs/next-13/server-components"
3
+ );
@@ -0,0 +1 @@
1
+ export default function getCookieLocale(): string;
@@ -0,0 +1 @@
1
+ export default function hasPathnamePrefixed(locale: string, pathname: string): boolean;
@@ -1 +1,14 @@
1
- export { default as NextIntlClientProvider } from './NextIntlClientProvider';
1
+ /**
2
+ * Client-only APIs.
3
+ */
4
+ import NextIntlClientProvider_ from '../shared/NextIntlClientProvider';
5
+ import usePathname from './usePathname';
6
+ import useRouter from './useRouter';
7
+ export { default as useRouter } from './useRouter';
8
+ export { default as usePathname } from './usePathname';
9
+ /** @deprecated Is called `usePathname` now. */
10
+ export declare const useUnlocalizedPathname: typeof usePathname;
11
+ /** @deprecated Is called `useRouter` now. */
12
+ export declare const useLocalizedRouter: typeof useRouter;
13
+ /** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */
14
+ export declare const NextIntlClientProvider: typeof NextIntlClientProvider_;
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ import { UrlObject } from 'url';
3
+ export default function localizeHref(href: string, locale?: string, pathname?: string): string;
4
+ export default function localizeHref(href: UrlObject | string, locale?: string, pathname?: string): UrlObject | string;
@@ -0,0 +1,37 @@
1
+ import { extends as _extends } from '../_virtual/next-intl.esm.js';
2
+ import localizePathname from '../shared/next-intl.esm3.js';
3
+ import getCookieLocale from './next-intl.esm3.js';
4
+ import hasPathnamePrefixed from './next-intl.esm4.js';
5
+
6
+ function localizeHref(href, locale, pathname) {
7
+ var cookieLocale = getCookieLocale();
8
+ if (!locale) locale = cookieLocale;
9
+
10
+ if (!pathname) {
11
+ pathname = window.location.pathname;
12
+ }
13
+
14
+ var isSwitchingLocale = locale !== cookieLocale;
15
+ var isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);
16
+
17
+ if (isPathnamePrefixed || isSwitchingLocale) {
18
+ var prefixedHref;
19
+
20
+ if (typeof href === 'string') {
21
+ prefixedHref = localizePathname(locale, href);
22
+ } else {
23
+ prefixedHref = _extends({}, href);
24
+
25
+ if (href.pathname) {
26
+ prefixedHref.pathname = localizePathname(locale, href.pathname);
27
+ }
28
+ }
29
+
30
+ return prefixedHref;
31
+ } else {
32
+ return href;
33
+ }
34
+ }
35
+
36
+ export { localizeHref as default };
37
+ //# sourceMappingURL=next-intl.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-intl.esm.js","sources":["../../src/client/localizeHref.tsx"],"sourcesContent":["import {UrlObject} from 'url';\nimport localizePathname from '../shared/localizePathname';\nimport getCookieLocale from './getCookieLocale';\nimport hasPathnamePrefixed from './hasPathnamePrefixed';\n\nexport default function localizeHref(\n href: string,\n locale?: string,\n pathname?: string\n): string;\nexport default function localizeHref(\n href: UrlObject | string,\n locale?: string,\n pathname?: string\n): UrlObject | string;\nexport default function localizeHref(\n href: UrlObject | string,\n locale?: string,\n pathname?: string\n) {\n const cookieLocale = getCookieLocale();\n if (!locale) locale = cookieLocale;\n\n if (!pathname) {\n pathname = window.location.pathname;\n }\n\n const isSwitchingLocale = locale !== cookieLocale;\n const isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);\n\n if (isPathnamePrefixed || isSwitchingLocale) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n } else {\n return href;\n }\n}\n"],"names":["localizeHref","href","locale","pathname","cookieLocale","getCookieLocale","window","location","isSwitchingLocale","isPathnamePrefixed","hasPathnamePrefixed","prefixedHref","localizePathname"],"mappings":";;;;;AAewB,SAAAA,YAAA,CACtBC,IADsB,EAEtBC,MAFsB,EAGtBC,QAHsB,EAGL;AAEjB,EAAMC,IAAAA,YAAY,GAAGC,eAAe,EAApC,CAAA;AACA,EAAA,IAAI,CAACH,MAAL,EAAaA,MAAM,GAAGE,YAAT,CAAA;;AAEb,EAAI,IAAA,CAACD,QAAL,EAAe;AACbA,IAAAA,QAAQ,GAAGG,MAAM,CAACC,QAAP,CAAgBJ,QAA3B,CAAA;AACD,GAAA;;AAED,EAAA,IAAMK,iBAAiB,GAAGN,MAAM,KAAKE,YAArC,CAAA;AACA,EAAA,IAAMK,kBAAkB,GAAGC,mBAAmB,CAACR,MAAD,EAASC,QAAT,CAA9C,CAAA;;AAEA,EAAIM,IAAAA,kBAAkB,IAAID,iBAA1B,EAA6C;AAC3C,IAAA,IAAIG,YAAJ,CAAA;;AACA,IAAA,IAAI,OAAOV,IAAP,KAAgB,QAApB,EAA8B;AAC5BU,MAAAA,YAAY,GAAGC,gBAAgB,CAACV,MAAD,EAASD,IAAT,CAA/B,CAAA;AACD,KAFD,MAEO;AACLU,MAAAA,YAAY,GAAOV,QAAAA,CAAAA,EAAAA,EAAAA,IAAP,CAAZ,CAAA;;AACA,MAAIA,IAAAA,IAAI,CAACE,QAAT,EAAmB;AACjBQ,QAAAA,YAAY,CAACR,QAAb,GAAwBS,gBAAgB,CAACV,MAAD,EAASD,IAAI,CAACE,QAAd,CAAxC,CAAA;AACD,OAAA;AACF,KAAA;;AAED,IAAA,OAAOQ,YAAP,CAAA;AACD,GAZD,MAYO;AACL,IAAA,OAAOV,IAAP,CAAA;AACD,GAAA;AACF;;;;"}
@@ -0,0 +1,24 @@
1
+ import { extends as _extends } from '../_virtual/next-intl.esm.js';
2
+ import { useRouter as useRouter$1 } from 'next/navigation';
3
+ import { useMemo } from 'react';
4
+ import localizeHref from './next-intl.esm.js';
5
+
6
+ function useRouter() {
7
+ var router = useRouter$1();
8
+ return useMemo(function () {
9
+ return _extends({}, router, {
10
+ push: function push(href) {
11
+ return router.push(localizeHref(href));
12
+ },
13
+ replace: function replace(href) {
14
+ return router.replace(localizeHref(href));
15
+ },
16
+ prefetch: function prefetch(href) {
17
+ return router.prefetch(localizeHref(href));
18
+ }
19
+ });
20
+ }, [router]);
21
+ }
22
+
23
+ export { useRouter as default };
24
+ //# sourceMappingURL=next-intl.esm2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-intl.esm2.js","sources":["../../src/client/useRouter.tsx"],"sourcesContent":["import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport localizeHref from './localizeHref';\n\nexport default function useRouter() {\n const router = useNextRouter();\n\n return useMemo(\n () => ({\n ...router,\n push(href: string) {\n return router.push(localizeHref(href));\n },\n replace(href: string) {\n return router.replace(localizeHref(href));\n },\n prefetch(href: string) {\n return router.prefetch(localizeHref(href));\n }\n }),\n [router]\n );\n}\n"],"names":["useRouter","router","useNextRouter","useMemo","push","href","localizeHref","replace","prefetch"],"mappings":";;;;;AAIc,SAAUA,SAAV,GAAmB;AAC/B,EAAMC,IAAAA,MAAM,GAAGC,WAAa,EAA5B,CAAA;AAEA,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OAAA,QAAA,CAAA,EAAA,EACKF,MADL,EAAA;AAEEG,MAAAA,IAFF,EAEOC,SAAAA,IAAAA,CAAAA,IAFP,EAEmB;AACf,QAAOJ,OAAAA,MAAM,CAACG,IAAP,CAAYE,YAAY,CAACD,IAAD,CAAxB,CAAP,CAAA;AACD,OAJH;AAKEE,MAAAA,OALF,EAKUF,SAAAA,OAAAA,CAAAA,IALV,EAKsB;AAClB,QAAOJ,OAAAA,MAAM,CAACM,OAAP,CAAeD,YAAY,CAACD,IAAD,CAA3B,CAAP,CAAA;AACD,OAPH;AAQEG,MAAAA,QARF,EAQWH,SAAAA,QAAAA,CAAAA,IARX,EAQuB;AACnB,QAAOJ,OAAAA,MAAM,CAACO,QAAP,CAAgBF,YAAY,CAACD,IAAD,CAA5B,CAAP,CAAA;AACD,OAAA;AAVH,KAAA,CAAA,CAAA;AAAA,GADY,EAaZ,CAACJ,MAAD,CAbY,CAAd,CAAA;AAeD;;;;"}
@@ -0,0 +1,23 @@
1
+ import { COOKIE_LOCALE_NAME } from '../shared/next-intl.esm4.js';
2
+
3
+ function getCookieValueByName(name) {
4
+ // https://stackoverflow.com/a/15724300/343045
5
+ var value = "; " + document.cookie;
6
+ var parts = value.split("; " + name + "=");
7
+
8
+ if (parts.length === 2) {
9
+ var _parts$pop;
10
+
11
+ var part = (_parts$pop = parts.pop()) == null ? void 0 : _parts$pop.split(';').shift();
12
+ if (part) return part;
13
+ }
14
+
15
+ throw new Error("Unable to find next-intl cookie, have you configured the middleware?");
16
+ }
17
+
18
+ function getCookieLocale() {
19
+ return getCookieValueByName(COOKIE_LOCALE_NAME);
20
+ }
21
+
22
+ export { getCookieLocale as default };
23
+ //# sourceMappingURL=next-intl.esm3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-intl.esm3.js","sources":["../../src/client/getCookieLocale.tsx"],"sourcesContent":["import {COOKIE_LOCALE_NAME} from '../shared/constants';\n\nfunction getCookieValueByName(name: string) {\n // https://stackoverflow.com/a/15724300/343045\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n const part = parts.pop()?.split(';').shift();\n if (part) return part;\n }\n\n throw new Error(\n `Unable to find next-intl cookie, have you configured the middleware?`\n );\n}\n\nexport default function getCookieLocale() {\n return getCookieValueByName(COOKIE_LOCALE_NAME);\n}\n"],"names":["getCookieValueByName","name","value","document","cookie","parts","split","length","part","pop","shift","Error","getCookieLocale","COOKIE_LOCALE_NAME"],"mappings":";;AAEA,SAASA,oBAAT,CAA8BC,IAA9B,EAA0C;AACxC;AACA,EAAA,IAAMC,KAAK,GAAA,IAAA,GAAQC,QAAQ,CAACC,MAA5B,CAAA;AACA,EAAA,IAAMC,KAAK,GAAGH,KAAK,CAACI,KAAN,CAAA,IAAA,GAAiBL,IAAjB,GAAd,GAAA,CAAA,CAAA;;AACA,EAAA,IAAII,KAAK,CAACE,MAAN,KAAiB,CAArB,EAAwB;AAAA,IAAA,IAAA,UAAA,CAAA;;AACtB,IAAA,IAAMC,IAAI,GAAA,CAAA,UAAA,GAAGH,KAAK,CAACI,GAAN,EAAH,KAAG,IAAA,GAAA,KAAA,CAAA,GAAA,UAAA,CAAaH,KAAb,CAAmB,GAAnB,CAAA,CAAwBI,KAAxB,EAAb,CAAA;AACA,IAAIF,IAAAA,IAAJ,EAAU,OAAOA,IAAP,CAAA;AACX,GAAA;;AAED,EAAM,MAAA,IAAIG,KAAJ,CAAN,sEAAA,CAAA,CAAA;AAGD,CAAA;;AAEa,SAAUC,eAAV,GAAyB;AACrC,EAAOZ,OAAAA,oBAAoB,CAACa,kBAAD,CAA3B,CAAA;AACD;;;;"}