gaambo / gatsby-plugin-i18n-extension

Extension for gatsby-plugin-i18n with ContextProvider, page wrapper und utils for menus - also for creating pages in $name.$lang.js format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gatsby-plugin-i18n-extend

An Extension for gatsby-plugin-i18n with the following additional features:

  • ContextProvider component
  • Page wrapper which inserts all intl props
  • Util for generating a language switcher
  • Creates multilingual pages from page components in $name.$lang.js format (eg: index.js + index.en.js, page-2.js page-2.en.js) - the langkey is taken from the filename and it inserts all intl props correctly

Installation & Configuration

Install via npm like any other gatsby plugin and configure in gatsby-config.js:

{
  resolve: `gatsby-plugin-i18n`,
  options: {
    langKeyDefault: config.defaultLanguage,
    useLangKeyLayout: false
  }
},
{
  resolve: `gatsby-plugin-i18n-extension`,
  options: {
    path: `${__dirname}/src/data/language/`,
    langKeyDefault: config.defaultLanguage,
    languages: config.languages
  }
},

Requirements

This is an extension to the awesome work of gatsby-plugin-i18n. It uses the ptz-i18n package of the same guys. Some features are inspired by gatsby-plugin-intl but I had some problems with the process/structure of this plugin.

About

Extension for gatsby-plugin-i18n with ContextProvider, page wrapper und utils for menus - also for creating pages in $name.$lang.js format

License:MIT License


Languages

Language:JavaScript 100.0%