I was only able to get it to work with uppercase “Locale” (thanks for the mention in this forum convo)
Added elements in Plasmic Studio for toggling/dynamically loading external integrated CMS locale content. Specially, I added (a) a menu button to toggle locale, and (b) a GraphQL variable in article content for locale:
However, to use those, I need to access locale from Plasmic Studio, and I couldn’t figure that out…
I believe the solution is something similar to setting up dark/light mode toggle mentioned here? However, my basic brain wasn’t able to successfully implement it
Yes, you can solve it in a similar fashion. As you already have the locale value provided by the router, you should be able to provide the “locale” value as data to Plasmic. This way, you can access this data directly into the studio. To be able to access this data, it’s recommended that you add it _app.
You can refer to this project from @alyssa_feolaGitHub that implemented the dark mode approach.
This way, when you open the data picker, this value will be available to be used in the expressions. You can also change the way that you implemented the switch.
I couldn’t get the lang variants in Plasmic Studio to connect with the Next Router locale being shown
It also seems like the <DataProvider> in her repo was calling upon a self defined ThemeProvider Plasmic component?
Does the /plasmic-host page of your project is handled by another application ? From what I can see of your code it looks good, do you mean that the locale is not visible in the data picker ?
When I set up with the same DataProvider structure as you, I was able to see it in the Studio.
Hi, can you share the repository? You can do it privately, as explained in Collaborating with Plasmic | Learn Plasmic. Using the code that we discussed, it should be possible to use the language value in the editor. So, it would be easier if we could talk with more context on what’s being done in the code currently.
Hi, I just saw that your project is not configured to use the expected host. If you follow the instructions here, Host Plasmic Studio in your app | Learn Plasmic, to set up your project to use your /plasmic-host page, the value will be available.