I’m utilizing the Storybook-i18n library for internationalization support within Storybook.
Upon changing the language, it also reflects in the URL, like so: locale:en
http://localhost:4400/?path=/story/foocomponent–primary&globals=locale:en
Now, I aim to integrate this functionality into the providers I’m passing to Angular Storybook:
const meta: Meta<FooComponent> = {
component: FooComponent,
title: 'FooComponent',
decorators: [
applicationConfig({
providers: [
provideI18N({
config: { availableLangs: ['en', 'fr'], defaultLang: 'en' }, //<-- defaultLang should be determined dynamically from the querystring locale: ??
}),
],
}),
],
};
export default meta;
I’ve explored the Storybook docs, but it doesn’t seem to align with my needs as it suggests using a render
function which I prefer not to introduce here.
Hence, I’m wondering if it’s feasible to access the globals using the import {}
statement or read them directly from the querystring.