@ericcote/gatsby-theme-i18n-react-intl
v4.1.13
Published
A Gatsby theme for providing localization support via react-intl. This theme sets up react-intl's context provider so that you can access your translations on every page. Works best together with gatsby-theme-i18n.
Downloads
17
Maintainers
Readme
gatsby-theme-i18n-react-intl
A Gatsby theme for providing localization support via react-intl. This theme sets up react-intl's context provider so that you can access your translations on every page.
Installation
Note: This theme is designed to work as an add-on to gatsby-theme-i18n
and will not work without it! Please follow its setup instructions before starting with these here!
- Install the theme and its peerDependencies.
npm install @ericcote/gatsby-theme-i18n-react-intl react-intl
- Add the configuration to your
gatsby-config.js
file:
module.exports = {
plugins: [
{
resolve: `@ericcote/gatsby-theme-i18n-react-intl`,
options: {
defaultLocale: `./i18n/react-intl/en.json`,
},
},
],
}
Usage
Place your <locale>.json
files inside the directory you pointed to with defaultLocale
.
You can also see an official example to learn more.
Theme options
| Key | Default Value | Description |
| --------------- | ------------- | ------------------------------------------------------------------------------------- |
| defaultLocale
| none | The default locale. Place your other locale files as siblings into the same directory |