-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: next-intl@4
#1412
Draft
amannn
wants to merge
36
commits into
main
Choose a base branch
from
v4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
feat!: next-intl@4
#1412
+2,584
−6,144
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 47239f9.
…currently active pathname for localized pathnames
# Conflicts: # packages/next-intl/src/middleware/utils.test.tsx # packages/next-intl/src/shared/utils.test.tsx
…is rendered from a Server Component (#1191) This should ease the transition from Server to Client Components, as you don't have to manually pass this prop anymore. If you've previously passed this prop manually, you can remove this assignment now. If this is not desired (e.g. because you have a large `formats` object that you don't want to pass to the client side), you can manually opt-out via `formats={{}}` on `NextIntlClientProvider` in order to not provide any formats on the client side. **BREAKING CHANGE:** There's a very rare chance where this can break existing behavior. If you're rendering `NextIntlClientProvider` in a Server Component, you rely on static rendering, but you're not using `unstable_setRequestLocale` (i.e. you're using hooks like `useTranslations` exclusively in Client Components), this can opt your page into dynamic rendering. If this affects you, please provide the `formats` prop explicitly to `NextIntlClientProvider`.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
If you have nested providers, previously only the configuration of the innermost one would be applied. With this change, configuration is now passed from one provider to the next, while allowing to override individual props. **BREAKING CHANGE:** There's a very rare chance that this change affects your app, but in case you've previously relied on providers not inheriting from each other, you now have to reset props manually in case you want to retain the prev. behavior.
# Conflicts: # packages/next-intl/.size-limit.ts
…arams` when rendered on the client side (#1483) Bumps the Next.js peer dependency to 13.3.
…cessary and only disable cookie if `localeCookie: false` is set (#1487) **Changes** 1. The `maxAge` attribute of the locale cookie is decreased from 1 year to 5 hours in order to be GDPR-compliant. 2. The locale cookie is now only set when the user's language doesn't match a requested locale. E.g. a user with `accept-language: 'en'` will cause a cookie to be set when `/de` is requested to remember the preference for `de`. 3. `localeDetection: false` previously ambiguously also disabled the cookie from being set. This is no longer the case. For consistency, you can now use the explicit [`localeCookie: false`](https://next-intl-docs.vercel.app/docs/routing#locale-cookie) option instead. If you want to increase the cookie expiration, you can use the [`maxAge`](https://next-intl-docs.vercel.app/docs/routing#locale-cookie) attribute to do so: ```tsx import {defineRouting} from 'next-intl/routing'; export const routing = defineRouting({ // ... localeCookie: { // Expire in one year maxAge: 60 * 60 * 24 * 365 } }); ```
1 task
**Changes** - Revamps the API to augment types by getting rid of the global `IntlMessages` and `IntlFormats` in favor of a more general `AppConfig` that is scoped to `next-intl`. - Adds support for strictly-typing the locale across `useLocale` as well as the navigation APIs. - Adds `import {Locale} from 'next-intl';` as a convenience API to be reused wherever a `locale` is passed around. - Add `hasLocale(locales, candidate)` API for simplified checking of whether a locale is available with TypeScript. - Adds a new `import {Messages} from 'next-intl;` type that corresponds to the `Messages` you've provided in `AppConfig` (probably rarely needed). **Example:** ```tsx // global.d.ts import {routing} from '@/i18n/routing'; import {formats} from '@/i18n/request'; import en from './messages/en.json'; declare module 'next-intl' { interface AppConfig { Locale: (typeof routing.locales)[number]; Formats: typeof formats; Messages: typeof en; } } ``` **→ [Proposed docs](https://next-intl-docs-git-feat-augmented-config-next-intl.vercel.app/docs/workflows/typescript)** Fixes #1377
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After a year of feature development, this release mostly aims to clean up the API surface to ensure
next-intl
remains lean—there should be no surprises.Changes
formats
whenNextIntlClientProvider
is rendered from a Server Component #1191NextIntlClientProvider
instances are present #1413typescript
version to 5 for projects using TypeScript #1481locale
forNextIntlClientProvider
fromuseParams
when rendered on the client side #1483locale
to be returned fromgetRequestConfig
#1486localeCookie: false
is set #1487useMessages
&getMessages
#1489Locale
#1495TODO
setRequestLocale
#663 (comment)Related
Fixes #1153
Fixes #1452