gatsby-theme-i18n
Version:
A Gatsby theme for providing internationalization support to your Gatsby site by taking in a configuration file and creating prefixed, enriched pages for each language.
12 lines (8 loc) • 345 B
JavaScript
import * as React from "react"
import { defaultLang } from "../utils/default-options"
const LocaleContext = React.createContext(defaultLang)
const LocaleProvider = ({
children,
pageContext: { locale = defaultLang },
}) => <LocaleContext.Provider value={locale}>{children}</LocaleContext.Provider>
export { LocaleContext, LocaleProvider }