designsystemet icon indicating copy to clipboard operation
designsystemet copied to clipboard

Support for multiple languages on designsystemet.no

Open mrosvik opened this issue 9 months ago • 2 comments

We’d like to explore what it would take to support multiple languages on https://www.designsystemet.no/, starting with English.

This issue is meant as a discussion starter and a place to gather thoughts around: What would it take to get a full English version of the site?

Initial thoughts:

  • The actual implementation of language handling isn’t terribly complex.
  • Technically, Storybook should support multiple languages, although we haven’t tried it yet.
  • The main effort will be duplicating all content — every MDX page would need both a Norwegian and English version.
  • Setting up for translation is probably easier to do early rather than later.

Dependencies / should be done first:

  • #2625 - Should we replace our Next.js for Storefront?
  • #1704 - Storefront: Investigate Sanity CMS

mrosvik avatar Mar 26 '25 09:03 mrosvik

Need(?) to solve:

  • how to make sure both whole webpages and parts of pages are being marked with its content language
  • how to handle storage for the users language preference (should it be remembered across multiple sessions? is it stored as a functional cookie or in other ways?)
  • how should not-translated content be presented (at BR we have a information banner that tells the user that the content is not translated, and that we serve the bokmål version as a fallback.
  • how to store translated content (frases and full pages, parts of a page, documentation, how to handle code examples?)
  • how to make it as easy as possible to translate content.

Camulos avatar Mar 26 '25 10:03 Camulos

Since the implementation has now been done, I'll answer @Camulos with the decisions we have:

how to make sure both whole webpages and parts of pages are being marked with its content language

The whole page is translated, so we only need one lang attribute

how to handle storage for the users language preference (should it be remembered across multiple sessions? is it stored as a functional cookie or in other ways?)

We don't story anything. The URL is different for both languages, with english slugs. For example: /no/fundamentals /en/fundamentals

how should not-translated content be presented (at BR we have a information banner that tells the user that the content is not translated, and that we serve the bokmål version as a fallback.

We don't need any fallbacks, since all content will be in both languages

how to store translated content (frases and full pages, parts of a page, documentation, how to handle code examples?)

Both languages have individual locale files (parts of the page, for example the header) and mdx files. This way we can translate everything separatley.

how to make it as easy as possible to translate content.

MDX files and locale files makes this pretty easy, and everything is on github

Barsnes avatar May 09 '25 10:05 Barsnes