Gatsby plugin i18n

This plugin is meant to be used with netlify and its gatsby-plugin-netlify to correctly handle redirects server side. A less SEO friendly alternative would be to use this plugin alongside gatsby-plugin-meta-redirect or gatsby-plugin-client-side-redirect, they all exploit the gatsby’s createRedirect action.

Localised messages

  • Components specific string are prefixed by the component name in PascalCase, e.g. for component Header the string prefix is Header.
  • Pages and templates specific strings are prefixed by the page component name all lowercase minus the prefix Pages or Template, e.g. for page about the component would be PagesAbout and the string prefix is about., for the template blog-single the component would be TemplateBlogSingle and the string prefix is blogsingle
  • Generic strings not tight to any component or page in particular are prefxed with a . dot and begin lowercase, e.g. .globalMessage

Resources

Similar projects

There are many on npm.

Issues

Language based redirects

Those that use Language: locale in the createRedirect method, they seem to do not work at the moment, see this issue or this one for instance.

Trailing slashes

Netlify when loading a page directly or refreshing the browser when you are on a page without a trailing slash it will redirect to the same url with a trailing slash, this happens even with Pretty URLS setting disabled on Netlify panel. See this issue. Until this issue with netlify is not solved we set by default trailing slashed on all paths with the util normaliseUrlPath.

Custom slugs

TODO: