plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
427 stars 575 forks source link

fix: pass down locale to IntlProvider #5976

Closed tomschall closed 1 week ago

tomschall commented 1 week ago

Add possibility to pass down locale, messages and defaultLocale properties inside the customStore object to IntlProvider. With this change we can control react-intl language provider from inside storybook and switch for example from english to german with storybook args.

netlify[bot] commented 1 week ago

Deploy Preview for plone-components canceled.

Name Link
Latest commit 45edd0faa65f8a04a56166c5475614dfa33729c5
Latest deploy log https://app.netlify.com/sites/plone-components/deploys/662a5ad244dbbc0008853e80
netlify[bot] commented 1 week ago

Deploy Preview for volto canceled.

Name Link
Latest commit 45edd0faa65f8a04a56166c5475614dfa33729c5
Latest deploy log https://app.netlify.com/sites/volto/deploys/662a5ad299000f0008ef07e8
tomschall commented 1 week ago

@tomschall I tried it out, and it breaks in the stories that do not have a customStore passed down, take a look at my suggestion, I think we have to look into the generated store instead. So it takes the defaults, and the incoming customStore, if any. I already tried it out and works as expected.

Thank you, i just missed to test it direct in Volto. What i am not so happy with is, that we call store.getState() 3 times in each Wrapper. I made another suggestion, that we use a const to fetch the state and then use that for the props.

sneridagh commented 1 week ago

Thanks @tomschall !!