Skip to content

Commit

Permalink
build just the base locales for now
Browse files Browse the repository at this point in the history
  • Loading branch information
pettinarip committed Jun 29, 2023
1 parent 270f59e commit 59acf61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
3 changes: 1 addition & 2 deletions .storybook/i18next.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import i18n, { Resource } from "i18next"
import { initReactI18next } from "gatsby-plugin-react-i18next"
import { supportedLanguages } from "../src/utils/languages"

export const baseLocales = {
en: { title: "English", left: "En" },
Expand All @@ -11,7 +10,7 @@ export const baseLocales = {

// Only i18n files named in this array are being exposed to Storybook. Add filenames as necessary.
const ns = ["common", "page-about", "page-upgrades", "page-developers-index"]
const supportedLngs = [...Object.keys(baseLocales), ...supportedLanguages]
const supportedLngs = Object.keys(baseLocales)

/**
* Taking the ns array and combining all the ids
Expand Down
22 changes: 1 addition & 21 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { action } from "@storybook/addon-actions"
import i18n, { baseLocales } from "./i18next"
import theme from "../src/@chakra-ui/gatsby-plugin/theme"

import { supportedLanguages, languageMetadata } from "../src/utils/languages"
import { capitalize } from "lodash"

const chakraBreakpointArray = Object.entries(theme.breakpoints)

// Gatsby's Link overrides:
Expand All @@ -28,27 +25,10 @@ window.___navigate = (pathname) => {
action("NavigateTo:")(pathname)
}

const locales = supportedLanguages.reduce(
(acc, curr) => {
if (Object.keys(baseLocales).includes(curr)) return acc

const currLangMeta = languageMetadata[curr]

return {
...acc,
[curr]: {
title: currLangMeta.localName,
left: capitalize(currLangMeta.hrefLang),
},
}
},
{ ...baseLocales }
)

const preview: Preview = {
globals: {
locale: "en",
locales,
locales: baseLocales,
},
parameters: {
i18n,
Expand Down

0 comments on commit 59acf61

Please sign in to comment.