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

Warnings in console after ignore route in-component #710

Closed
Jassmin586 opened this issue May 15, 2020 · 13 comments
Closed

Warnings in console after ignore route in-component #710

Jassmin586 opened this issue May 15, 2020 · 13 comments

Comments

@Jassmin586
Copy link

My app have got two languages (en and ar). To set only one language in specific page I used 'in-component' option:

nuxtI18n: {
    locales: ['en']
},

After that I have a page with only en language, that's great but also a lot of warnings in console like

image

How properly can I set one language for page without warnings?

@rchl
Copy link
Collaborator

rchl commented May 15, 2020

This is probably triggered because you have language selector somewhere on the page that calls localePath or switchLocale with those other locales.

You'd need to show the code that triggers those warnings, then I might be able to advise more.

@Jassmin586
Copy link
Author

I commented all localePath and switchLocale in project and still the same.

Simple reproduce:
https://codesandbox.io/s/710-nuxt-i18n-vqgsx?file=/pages/about.vue

Turn to Console and click 'About' link on homepage.

image

@rchl
Copy link
Collaborator

rchl commented May 15, 2020

Could be also coming from seo functionality if you have that enabled.
But I will look into it later (can't right now).

@rchl
Copy link
Collaborator

rchl commented May 21, 2020

Yes, those are triggered from seo functionality (seo: true).
I'll check later if I can do something about it.

For the record: the issue is due to disabling some locales per-route. In that case we don't keep track of which page has which locales disabled and so we assume that all locales are available.

@matsrietdijk
Copy link

@rchl this warning it triggered even more when seo: true, thats true. But the real issue is loadAndSetLocale which doesn't consider either filtering locale on the component as @Jassmin586 did above or the possiblilty of setting nuxtI18n: false on the component.

So even when disabling seo all together this warning will still be thrown on initial load and any time you programatically switch the locale with $i18n.setLocale(..) on a page configured like this.

@ozgurdemir
Copy link

Any updates on this? I'm running into the same issue. Probably related to this but I'd also like to remove the language switcher on pages which don't have that language enabled. It seems i18n does not have any variable stating which languages are actually available for the actual page.

@Menark
Copy link

Menark commented Jul 1, 2020

The same issue.

@quangnhattran
Copy link

Looking for clear solution on this matter. I am getting similar warnings

@stale
Copy link

stale bot commented Sep 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@HADB
Copy link

HADB commented Oct 29, 2021

Any updates?

1 similar comment
@gouz7514
Copy link

Any updates?

@pinecone-squirrel
Copy link

The problem remains unresolved

@BobbieGoede BobbieGoede added the v7 label Apr 5, 2024
@BobbieGoede
Copy link
Collaborator

Closing this as v7 is not being actively worked on (critical hotfixes only), if this still applies to v8 and later please open a new issue!

@BobbieGoede BobbieGoede closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants