[Question] A way to initialize svelte-i18n for Storybook
See original GitHub issueHello, thank you for making this awesome library! I just have a question related to the usage of this library with Storybook.
I am using svelte with storybook, and it turns out that I need to properly initialize svelte-i18n somehow by using something like addDecorator
in Storybook, but I just don’t know how. I’ve already struggled a lot with this, but I haven’t found a workaround for this.
Both Storybook for Svelte and svelte-i18n are at their early stages, so I could not really find much information on the web. So I would be really glad if anybody would knows about this issue could help.
Thank you very much in advance!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
Top Results From Across the Web
A Step-by-Step Guide to Svelte Localization | Phrase
Still quite new but powerful, the Svelte framework has found a solid niche for itself. Here's how to implement Svelte localization!
Read more >I18n with Storybook - JS.ORG
1. Expose i18next to Storybook ... To make your translations available in your stories, you'll first need to expose your i18next instance to ......
Read more >Svelte-i18n with Snowpack shows blank page without errors
This way you don't have to wait for the dictionaries to load in order to retrieve messages. // index.js import { register, init, ......
Read more >Announcing SvelteKit 1.0
How do I prepare my application for deployment? An application framework is designed to answer these questions. SvelteKit does so with a design ......
Read more >Calling i18n.js file on app's entry-point | svelte-i18n : r/sveltejs
If you're using Sapper, remember to also call init() on your server-side code (server.js)." I don't know how to do it? Can anyone...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Anyone here have a working repo for this combination.
@9oelM you’re right, using
addDecorator
is the correct way. I suggest to use it globally in order to initializesvelte-i18n
for all stories.Creation of global decorators can be done in
.storybook/preview.js
. The tricky part here is that you need to create a wrapper component which will initializei18n
for your story component.Create your wrapper component for example in
.storybook/Wrapper.svelte
Next step it’s telling to Storybook to use the global decorator.