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

Option to change the language attribute #11706

Open
07Gond opened this issue Jul 28, 2020 · 4 comments
Open

Option to change the language attribute #11706

07Gond opened this issue Jul 28, 2020 · 4 comments

Comments

@07Gond
Copy link

07Gond commented Jul 28, 2020

Is your feature request related to a problem? Please describe.
I need to test some multilingual sites and always the site is rendered with <html lang="en">

Describe the solution you'd like
The storybook .ejs template should include a language variable instead of the harcoded option as is it right now.

Describe alternatives you've considered
Maybe create an addon and we can change the language in runtime but not all the features could respond to the runtime changes. I think is better change the storybook template in order to accept variables there in the lang attribute.

Are you able to assist bring the feature to reality?
Yes, I can make a try. But if anyone can help me, would be great 😄

Additional context
Could be very useful if then we can change the lang attribute in the preview panel and the server reloads the page.

@stale stale bot added the inactive label Aug 22, 2020
@stale stale bot closed this as completed Oct 4, 2020
@shilman shilman added PN labels Oct 4, 2020
@shilman shilman reopened this Oct 4, 2020
@stale stale bot removed the inactive label Oct 4, 2020
@storybookjs storybookjs deleted a comment from stale bot Oct 4, 2020
@storybookjs storybookjs deleted a comment from stale bot Oct 4, 2020
@billerr
Copy link

billerr commented Dec 13, 2020

I found a quick workaround until this is natively implemented. You can add the following script to your ./storybook/preview-head.html file and it works (tested on Chrome):
<script>document.documentElement.setAttribute('lang', 'el')</script>

@shilman
Copy link
Member

shilman commented Dec 14, 2020

@07Gond can we close this with the proposed workaround?

@drazik
Copy link

drazik commented Feb 5, 2021

This workaround works. This is nice, but I personally think that it would be better with a proper parameter to do this. What do you think about it?

I never contributed to storybook's code. Does anybody knows if it would be hard to implement it?

@rastersysteme
Copy link

To get a working hyphenation via CSS hyphens this would be nice to have. Maybe as an addendum to this article https://storybook.js.org/recipes/react-i18next so if we switch the locale we can switch the lang attribute as well.

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

5 participants