Languages Switch for Storybook

Open Beginner friendly
#365 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, storybook

Research direction

Start with .storybook/preview.ts and the existing theme toolbar setup, then find where the library initializes its i18n instance and lists available locales. Add a Storybook toolbar control for English and German that updates the locale and re-renders stories and docs pages. Done when switching languages immediately changes built-in component text across stories and docs.

Written by the indexing model from the issue text.

Description

enhancement

Is your feature request related to a problem? Please describe.
Storybook always renders components in the language picked by the library's i18n setup, which uses localStorage or the browser language. On a German browser, components with built-in text (e.g. RelativeTime, UserMenu, ExpiryBadge) show up in German, while the story text around them stays English. The only way to check another language right now is to set localStorage by hand or change the browser language in the devtools.

Describe the solution you'd like
A language switch in the Storybook toolbar, similar to the theme switch, listing all available locales (currently English and German). Changing it should update the locale of the library's i18n instance, so all stories and docs pages re-render in the selected language right away. This is also great for reviewing language related parts of our components.

Describe alternatives you've considered
Setting localStorage by hand in the devtools, which works but is awkward and easy to forget.

Additional context
This came up while building the RelativeTime component (#326). It could be built with a global type with toolbar config plus a small decorator in .storybook/preview.ts, no extra addon needed.

Dominant language
Vue
Stars
10
Forks
1
Avg merge
1d 7h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from thunderbird/services-ui

All issues in thunderbird/services-ui

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.