Skip to content
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: Add localeCookie option for middleware #1414

Merged
merged 6 commits into from
Oct 10, 2024
Merged

Conversation

amannn
Copy link
Owner

@amannn amannn commented Oct 10, 2024

Users have in various issues expressed the interest for customization of the locale cookie that the middleware sets. This PR adds such a capability via a new localeCookie option that can be configured via defineRouting:

import {defineRouting} from 'next-intl/routing';

export const routing = defineRouting({
  // ...
  localeCookie: {
    // Expire in 5 hours
    maxAge: 60 * 60 * 5
  }
});

… or turn the cookie off entirely:

import {defineRouting} from 'next-intl/routing';

export const routing = defineRouting({
  // ...
  localeCookie: false
});

See also: Proposed docs


Fixes #454
Fixes #1268

Copy link

vercel bot commented Oct 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 3:28pm
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 3:28pm
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 3:28pm

# Conflicts:
#	examples/example-app-router-playground/tests/main.spec.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant