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

Possible regression with custom domains and localized paths #3058

Closed
darioielardi opened this issue Aug 13, 2024 · 1 comment · Fixed by #3061
Closed

Possible regression with custom domains and localized paths #3058

darioielardi opened this issue Aug 13, 2024 · 1 comment · Fixed by #3061
Assignees
Labels
domain ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf v8 v9

Comments

@darioielardi
Copy link

darioielardi commented Aug 13, 2024

Environment

  • Operating System: Darwin
  • Node Version: v20.15.0
  • Nuxt Version: 3.12.4
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.7
  • Package Manager: bun@1.1.22
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, i18n
  • Runtime Modules: @nuxtjs/i18n@8.3.3
  • Build Modules: -

Reproduction

https://github.com/darioielardi/nuxt-i18n-play

On main you'll find @nuxtjs/i18n@^8.3.3 installed.
To test with @nuxtjs/i18n@8.2.0 switch to the nuxt-i18n-v8.2 branch.

To test different domains you need to add this to your hosts file:

0.0.0.0 nuxt-i18n-play.en
0.0.0.0 nuxt-i18n-play.it
0.0.0.0 nuxt-i18n-play.fr

Describe the bug

My use case is an application with a different domain for each locale, and localized paths. For example:

  • my-website.com/travels
  • my-website.it/viaggi
  • my-website.fr/voyages

Until v8.2.0, I would set differentDomains: true, set up the locales with relative domains, add localized paths with customRoutes: 'config' + pages config, and it worked perfectly.

From this PR (as someone noted in the comment) that doesn't work anymore, as it will add a locale prefix to every path, which is of course redundant and undesired in my case.

Adding strategy: 'no_prefix' doesn't work with custom paths (as it's stated in the docs), but in the case of different domains I think it's reasonable to expect that the prefix is omitted anyway (as it was in v8.2.0), or at least to have some way to configure that.

Is the new behavior unexpected (and therefore a bug) or I'm missing something?
Let me know if you need any more context, and thanks for your great work!

Additional context

Related issue: #2729

Logs

No response

@BobbieGoede
Copy link
Collaborator

Thank you for reporting and providing a good/complete description with reproduction! 🙏

Is the new behavior unexpected (and therefore a bug) or I'm missing something?

It seems like we didn't have tests for the previous behavior and the functionality got broken since it depended on the exclusion of strategy: 'no_prefix' which is a bit confusing (I wasn't aware of this detail).

I'll see if I can figure out a fix soon, hopefully this week.

@BobbieGoede BobbieGoede self-assigned this Aug 13, 2024
@BobbieGoede BobbieGoede added v8 ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf domain v9 and removed pending triage labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf v8 v9
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants