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

Locale via plugin is incorrect - v9.1.2 regression #3330

Closed
harlan-zw opened this issue Jan 29, 2025 · 3 comments · Fixed by #3334
Closed

Locale via plugin is incorrect - v9.1.2 regression #3330

harlan-zw opened this issue Jan 29, 2025 · 3 comments · Fixed by #3334
Labels
❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf regression

Comments

@harlan-zw
Copy link

harlan-zw commented Jan 29, 2025

Environment

Reproduction

https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-tn4vweh6?file=nuxt.config.ts

Visit a locale prefix path such as /nl and you'll see it prints en when it should be nl.

Describe the bug

Previous to v9.1.2 we were able to get the locale for the route from a plugin. See https://github.com/harlan-zw/nuxt-site-config/blob/main/packages/module/src/runtime/app/plugins/i18n.server.ts

Additional context

This is breaking most of my modules :( If there's a workaround, I'm happy to implement that instead.

Logs

@zsavajji
Copy link

Yea I was about to open this issue too, locale is not correctly set on server, getting set to default locale and translations messages are not loaded.

Going back to 9.1.1 fixes this.

@BobbieGoede
Copy link
Collaborator

Sorry about this regression 😰 it's clearly a blind spot in our testing that we need to cover.

These last few updates include larger refactors which, among other things, split up the plugin into smaller plugins. The locale detection moved to https://github.com/nuxt-modules/i18n/blob/main/src/runtime/plugins/route-locale-detect.ts (i18n:plugin:route-locale-detect), unfortunately I don't have a simple workaround right now.

I'm a bit busy at my day job at the moment but I'll try and find some time to investigate and fix this regression 🙏

@BobbieGoede BobbieGoede added ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf regression and removed pending triage labels Jan 29, 2025
@MickL
Copy link
Contributor

MickL commented Jan 29, 2025

Thank you SO much for the quick fix! When I initially discovered the bug I was thinking this cant be true because nuxt i18n is already in v9 and nuxt-seo in v2. I am happy I made the reproduction and reported :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants