You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/src/pages/blog/next-intl-4-0.mdx
+17-14
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Here's what's new in `next-intl@4.0`:
22
22
7.[**Stricter config for `domains`**](#domains-config)
23
23
8.[**Preparation for upcoming Next.js features**](#nextjs-future)
24
24
25
-
Please also have a look at the [other breaking changes](#other-breaking-changes) listed below before you upgrade.
25
+
Please also have a look at the [other changes](#other-changes) listed below before you upgrade.
26
26
27
27
## Revamped augmented types
28
28
@@ -119,7 +119,7 @@ t('message', {});
119
119
t('message', {});
120
120
// ^? {page: number, total: number}
121
121
122
-
// "You have {count, plural, =0 {no followers yet} =1 {one follower} other {# followers}}."
122
+
// "You have {count, plural, =0 {no followers yet} one {one follower} other {# followers}}."
123
123
t('message', {});
124
124
// ^? {count: number}
125
125
@@ -128,8 +128,8 @@ t('message', {});
128
128
// ^? {country: 'US' | 'CA' | (string & {})}
129
129
130
130
// "Please refer to the <link>guidelines</link>."
131
-
t('message', {});
132
-
// ^? {link: (chunks: ReactNode) => ReactNode}
131
+
t.rich('message', {});
132
+
//^? {link: (chunks: ReactNode) => ReactNode}
133
133
```
134
134
135
135
With this type inference in place, you can now use autocompletion in your IDE to get suggestions for the available arguments of a given ICU message and catch potential errors early.
@@ -154,7 +154,7 @@ Due to a current limitation in TypeScript, this feature is opt-in for now. Pleas
154
154
155
155
In order to comply with the current GDPR regulations, the following changes have been made and are relevant to you if you're using the `next-intl` middleware for i18n routing:
156
156
157
-
1. The locale cookie has been changed to a session cookie that expires when a browser is closed.
157
+
1. The locale cookie now defaults to a session cookie that expires when a browser is closed.
158
158
2. The locale cookie is now only set when a user switches to a locale that doesn't match the `accept-language` header.
159
159
160
160
If you want to increase the cookie expiration, e.g. because you're informing users about the usage of cookies or if GDPR doesn't apply to your app, you can use the `maxAge` attribute to do so:
@@ -188,13 +188,13 @@ The build output of `next-intl` has been modernized and now leverages the follow
188
188
2.**Modern JSX transform:** The peer dependency for React has been bumped to v17 in order to use the more efficient, modern JSX transform.
189
189
3.**Modern syntax:** Syntax is now compiled down to the Browserslist `defaults` query, which is a shortcut for ">0.5%, last 2 versions, Firefox ESR, not dead"—a baseline that is considered a reasonable target for modern apps.
190
190
191
-
With these changes, the bundle size of `next-intl` has been reduced by ~7% ([all details](https://github.com/amannn/next-intl/pull/1470)).
191
+
With these changes, the bundle size of `next-intl` has been reduced by ~7% ([PR #1470](https://github.com/amannn/next-intl/pull/1470)).
192
192
193
193
## Improved inheritance of `NextIntlClientProvider`[#nextintlclientprovider-inheritance]
194
194
195
195
Previously, [`NextIntlClientProvider`](/docs/usage/configuration#nextintlclientprovider) would conservatively inherit only a subset from `i18n/request.ts`.
196
196
197
-
To improve the getting started experience, the provider now also inherits:
197
+
To improve the getting started experience, the provider by default now also inherits:
@@ -210,6 +210,8 @@ Due to this, you can now remove these props from `NextIntlClientProvider` if you
210
210
</NextIntlClientProvider>
211
211
```
212
212
213
+
If you don't want to inherit these props, you can either opt-out via `messages={null}` and `formats={null}`, or by passing a specific value for these props.
214
+
213
215
With this, `NextIntlClientProvider` now inherits all of your configuration, with the minor exception of [error handling functions](/docs/usage/configuration#error-handling). Since functions are not serializable, they cannot be passed across the server/client boundary. However, [an alternative](https://github.com/amannn/next-intl/issues/1285) for this is also on the horizon.
214
216
215
217
To make it easier to work with error handling functions on the client side, `NextIntlClientProvider` can now also be used in a nested fashion and will inherit the configuration from a parent provider ([PR #1413](https://github.com/amannn/next-intl/pull/1413)).
@@ -280,15 +282,16 @@ While the mentioned Next.js features are still under development and may change,
280
282
281
283
I'm particularly excited about the announcement of `rootParams`, as it seems like this will finally fill in the [missing piece](https://github.com/vercel/next.js/discussions/58862) that enables apps with i18n routing to support static rendering without workarounds like `setRequestLocale`. I hope to have more to share on this soon!
282
284
283
-
## Other breaking changes
285
+
## Other changes
284
286
285
287
1. Return type-safe messages from `useMessages` and `getMessages` (see [PR #1489](https://github.com/amannn/next-intl/pull/1489))
286
288
2. Require locale to be returned from `getRequestConfig` (see [PR #1486](https://github.com/amannn/next-intl/pull/1486))
287
-
3. Disallow passing `null`, `undefined` or `boolean` as an ICU argument (see [PR #1561](https://github.com/amannn/next-intl/pull/1561))
288
-
4. Bump minimum required TypeScript version to 5 for projects using TypeScript (see [PR #1481](https://github.com/amannn/next-intl/pull/1481))
289
-
5. Return `x-default` alternate link also for sub pages when using `localePrefix: 'always'` and update middleware matcher suggestion in docs (see [PR #1720](https://github.com/amannn/next-intl/pull/1720))
290
-
6. Remove deprecated APIs (see [PR #1479](https://github.com/amannn/next-intl/pull/1479))
291
-
7. Remove deprecated APIs pt. 2 (see [PR #1482](https://github.com/amannn/next-intl/pull/1482))
289
+
3. Allow to declare `pathnames` partially for convenience (see [PR #1743](https://github.com/amannn/next-intl/pull/1743))
290
+
4. Disallow passing `null`, `undefined` or `boolean` as an ICU argument (see [PR #1561](https://github.com/amannn/next-intl/pull/1561))
291
+
5. Bump minimum required TypeScript version to 5 for projects using TypeScript (see [PR #1481](https://github.com/amannn/next-intl/pull/1481))
292
+
6. Return `x-default` alternate link also for sub pages when using `localePrefix: 'always'` and update middleware matcher suggestion to `/((?!api|_next|_vercel|.*\\..*).*)` (see [PR #1720](https://github.com/amannn/next-intl/pull/1720))
293
+
7. Remove deprecated APIs (see [PR #1479](https://github.com/amannn/next-intl/pull/1479))
294
+
8. Remove deprecated APIs pt. 2 (see [PR #1482](https://github.com/amannn/next-intl/pull/1482))
292
295
293
296
## Upgrade now
294
297
@@ -308,7 +311,7 @@ I'd love to hear about your experiences with `next-intl@4.0`! Join the conversat
308
311
309
312
I want to sincerely thank everyone who has helped to make `next-intl` what it is today.
310
313
311
-
A special thank you goes to <PartnerContentLinkhref="https://crowdin.com/">Crowdin</PartnerContentLink>, the primary sponsor of `next-intl`, enabling me to regularly work on this project and provide it as a free and open-source library for everyone.
314
+
A special thank you goes to <PartnerContentLinkhref="https://crowdin.com/">Crowdin</PartnerContentLink>, the sponsor partner of `next-intl`, enabling me to regularly work on this project and provide it as a free and open-source library for everyone.
0 commit comments