vuestorefront / vue-storefront

Alokai is a Frontend as a Service solution that simplifies composable commerce. It connects all the technologies needed to build and deploy fast & scalable ecommerce frontends. It guides merchants to deliver exceptional customer experiences quickly and easily.
https://www.alokai.com
MIT License
10.63k stars 2.08k forks source link

[Bug]: Default locale does not work #6910

Open samberrry opened 1 year ago

samberrry commented 1 year ago

Describe the Bug

Hi everybody, When I set the defaultLocale in nuxt.config.js, it seems that it does not work, the result is always EN lang on the first request.

I'm using the latest version of vsf-core, nuxt packages, may be an issue within vsf-nuxt npm package. v2.7.5

Screen Shot 2023-04-26 at 4 27 00 AM

Current behavior

No response

Expected behavior

I must load website based on the defaultLocale config.

Steps to reproduce

No response

What version of Vue Storefront are you using?

any

What version of Node.js are you using?

any

What browser (and version) are you using?

any

What operating system (and version) are you using?

any

Relevant log output

No response

Able to fix / change the documentation?

Code of Conduct

skirianov commented 1 year ago

Hey @samberrry 👋

I think I found the issue, but I need @WojtekTheWebDev help over here.

https://github.com/vuestorefront/vue-storefront/blob/dc4572d4f2b679bbd701c9e2fbc5053eecc9e1b5/packages/core/src/utils/i18n-redirects/index.ts#L24

Looking at this code we are setting locales in order of priority and I think that defaultLocale has to be the top priority, since this is what user sets themselves.

@WojtekTheWebDev can you take a look at this issue, most probably I'm missing out something

samberrry commented 10 months ago

hey @skirianov @WojtekTheWebDev , we still have this problem, is there any fix for it? i would be very thankful if you help us. thanks