Skip to content

Fix i18n for domain #759

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

Merged
merged 7 commits into from
Feb 28, 2025
Merged

Fix i18n for domain #759

merged 7 commits into from
Feb 28, 2025

Conversation

conico974
Copy link
Contributor

Should fix #758

It also handles locale redirect directly in the routing layer instead of letting next handle it.

Copy link

changeset-bot bot commented Feb 28, 2025

🦋 Changeset detected

Latest commit: 9d6392a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Feb 28, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/aws@759

commit: 9d6392a

@conico974
Copy link
Contributor Author

@nicholas-c Could you test with this patch pls ?

pnpm add https://pkg.pr.new/@opennextjs/aws@759

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few minor comments

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

(Thanks for adding tests for constructNextUrl)

Co-authored-by: Victor Berchet <victor@suumit.com>
@conico974 conico974 merged commit 34511ff into opennextjs:main Feb 28, 2025
3 checks passed
@github-actions github-actions bot mentioned this pull request Feb 28, 2025
@nicholas-c
Copy link

Thanks for the patch @conico974

Doesn't seem to be working still on the previews I put together on the issue I'm afraid 😰 I believe I've applied the patch properly, seems to be building with the new detectDomainLocales correctly.

https://next-15-en.nich-carter-qza3ng.gymshark-sandbox.tools/
https://next-15-es.nich-carter-qza3ng.gymshark-sandbox.tools/

image
image

I've enabled OPEN_NEXT_DEBUG so can provide some of those logs if needed;

My logs in the middleware still return this though;

{
  [Symbol(NextURLInternal)]: {
    url: URL {
      href: 'https://next-15-es.nich-carter-qza3ng.gymshark-sandbox.tools/',
      origin: 'https://next-15-es.nich-carter-qza3ng.gymshark-sandbox.tools',
      protocol: 'https:',
      username: '',
      password: '',
      host: 'next-15-es.nich-carter-qza3ng.gymshark-sandbox.tools',
      hostname: 'next-15-es.nich-carter-qza3ng.gymshark-sandbox.tools',
      port: '',
      pathname: '/',
      search: '',
      searchParams: URLSearchParams {},
      hash: ''
    },
    options: { headers: [Object], nextConfig: [Object] },
    basePath: '',
    domainLocale: {
      domain: 'next-15-es.nich-carter-qza3ng.gymshark-sandbox.tools',
      defaultLocale: 'es'
    },
    defaultLocale: 'es',
    buildId: undefined,
    locale: 'en',
    trailingSlash: true
  }
}

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.

Domain Locales incorrectly set on nextUrl object in middleware files
3 participants