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 not available when template queries run on client #1983

Open
1 task done
MajesticPagan opened this issue Nov 11, 2024 · 1 comment
Open
1 task done

Locale not available when template queries run on client #1983

MajesticPagan opened this issue Nov 11, 2024 · 1 comment
Labels
needs: reproduction This issue needs to be reproduced independently

Comments

@MajesticPagan
Copy link

Description

I have a query on my wp-templates/page.tsx that is retrieving menuItems based on the current locale:

image

For the variable value for the query I pass the locale that the context object gives me:

image

This works fine when the page is initially rendered server-side but after a few moments, it switches back to the default language. From what I was able to dig up I think it's because of the client-side data fetching done on the WordPressTemplate component, it doesn't pass the locale property here. And since no value is passed, the client query is made without a language being defined, hence the language switch behavior.

Can't deduce if this is the intended behavior and my setup for multilingual is wrong or if Faust.js should be modified to pass the locale here.

My next-intl provider setup on _app.tsx:

image

Steps to reproduce

N/A

Additional context

No response

@faustwp/core Version

^3.1.0

@faustwp/cli Version

^3.1.0

FaustWP Plugin Version

1.4.1

WordPress Version

6.6.2

Additional environment details

Using next-intl v3.17.6 for front-end localization and WPML v4.6.13 and WPML GraphQL v1.1.1 in WordPress.

Please confirm that you have searched existing issues in the repo.

  • Yes
@josephfusco josephfusco added the needs: reproduction This issue needs to be reproduced independently label Nov 11, 2024
@theodesp
Copy link
Member

theodesp commented Dec 12, 2024

Hello @MajesticPagan . Thank you. Would you be able to submit a PR for this if you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: reproduction This issue needs to be reproduced independently
Projects
None yet
Development

No branches or pull requests

3 participants