docs(ui): use storybook-i18n addon for locale switching#2125
docs(ui): use storybook-i18n addon for locale switching#2125ghostdevv merged 3 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
556fd5c to
542b245
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughAppended Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.storybook/preview.ts (1)
22-26: Avoidanyfor the i18n instance and narrow before callingsetLocale.Line 22 and Lines 92-96 currently bypass type checks; a narrow interface here keeps the locale bridge safe and explicit.
💡 Suggested refactor
-let currentI18nInstance: any = null +type StorybookI18nInstance = { + setLocale: (locale: string) => void | Promise<void> +} +let currentI18nInstance: StorybookI18nInstance | null = null @@ - currentI18nInstance = this.$i18n + currentI18nInstance = + this.$i18n && typeof this.$i18n.setLocale === 'function' + ? (this.$i18n as StorybookI18nInstance) + : null @@ - if (locale && this.$i18n) { - this.$i18n.setLocale(locale) + if (locale && currentI18nInstance) { + void currentI18nInstance.setLocale(locale) }As per coding guidelines, "Ensure you write strictly type-safe code, for example by ensuring you always check when accessing an array value by index".
Also applies to: 91-96
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a584aa74-dd82-4f31-b2eb-5c2635be10b0
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
.storybook/main.ts.storybook/preview.tsapp/components/Link/Link.stories.tspackage.jsonpnpm-workspace.yaml
542b245 to
c1f5529
Compare
Co-authored-by: Willow (GHOST) <ghostdevbusiness@gmail.com>
🔗 Linked issue
Related: #1964
🧭 Context
This adds the storybook-i18n for locale switching in the npmx storybook.
📚 Description
This allows stories that have been configured with a translation to be viewed with different translations.