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
Add Storybook template for i18n #4764
Conversation
@Tobbe You can probably be interesting at this one |
packages/cli/src/commands/setup/i18n/tasks/configure-storybook.js
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/setup/i18n/templates/storybook.preview.js.template
Show resolved
Hide resolved
packages/cli/src/commands/setup/i18n/templates/storybook.preview.js.template
Show resolved
Hide resolved
packages/cli/src/commands/setup/i18n/templates/storybook.preview.js.template
Show resolved
Hide resolved
How can we make this compatible with also adding Chakra support? Support for merging SB configs instead of overwriting. |
Thanks for moving this forward @simoncrypta and @Tobbe 🚀 @virtuoushub and @shilman Could I get your high-level review about this PR as well as #3515 Recently, Yann gave Pete and I some guidance that we should move away from currenlty having a StorybookProvider decorator and instead looking into loaders. I'm not sure if that direction has any overlap with how Simon is approaching i18n support here. So just making sure to close any potential communication gaps most of all! |
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
✅ Deploy Preview for redwoodjs-docs canceled.
|
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
@Tobbe I will look a way to not overwrite if the file is already create ! |
I duplicate the configure-storybook file of Chakra to make it work with i18n, but I will prefer to have only one. Since we need to merge SB config with whatever that come first, using the same configure-storybook script make sense, but where did I put this file ? If it at |
I don't know. I think you just have to try it and see what happens :) |
Let's Go ! |
Nice work, everyone! I really want to make sure @virtuoushub reviews and approves the Storybook config additions here. Looping him in. |
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
|
||
const insideNewStorybookConfigWithoutReactAndDecoration = | ||
newStorybookPreview | ||
.replace(/import *. as React from 'react'/, '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.replace(/import *. as React from 'react'/, '') | |
.replace(/import *. as React from 'react'/, '') |
Sorry I didn't see this earlier. Did you mean to make that .*
(instead of *.
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I test the regex, I think is right, but I will double-check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it matches "space" zero or more times, then "any character", then "space", etc. So it works. I just wasn't sure if that's what you were going for :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want /import \* as React from 'react'/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! yeah right, I had tried this and didn't work, but I'm not the best at regex, so I will test again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tobbe, I wonder if this new lib overlaps on the rewrite of configureStorybook ? |
packages/cli/src/commands/setup/ui/templates/storybook.preview.js.template
Outdated
Show resolved
Hide resolved
@simoncrypta I agree, it's nicely done. But I still think, if you just address my last couple of comments we can get this one in first, and then he can handle the merge conflicts and overwrite your changes with what he's got going on there. |
packages/cli/src/commands/setup/i18n/templates/storybook.preview.js.template
Show resolved
Hide resolved
packages/cli/src/commands/setup/i18n/templates/storybook.preview.js.template
Outdated
Show resolved
Hide resolved
Co-authored-by: Peter Colapietro <petercolapietro+github@gmail.com>
…nto fix/subdirectory-routing * 'fix/subdirectory-routing' of github.com:dac09/redwood: Clarify the cell aliasing section of tutorial (redwoodjs#4964) s/posts/articles (redwoodjs#4971) fix(deps): update dependency cross-undici-fetch to v0.1.28 (redwoodjs#4966) Add Storybook template for i18n (redwoodjs#4764) Add @storybook/addon-essentials by default (redwoodjs#4765)
This will add the possibility to read the translation string and also change the language in Storybook !
Need
@storybook/addon-essentials
which I think should be included by default in RedwoodJS. I will open another PR to discussthis really soon#4765.I copy the task
configure-storybook
fromui
folder toi18n
, I don't know if we should make this a lib accessible for all setup.