Skip to content

Commit

Permalink
#2: i18n support for project
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed Jun 2, 2019
1 parent 6602cae commit f256bac
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 53 deletions.
6 changes: 3 additions & 3 deletions gatsby-config.js
Expand Up @@ -2,10 +2,10 @@ module.exports = {
siteMetadata: {
title: 'www.marcnuri.com - Marc Nuri',
siteUrl: 'https://www.marcnuri.com',
description: 'Software developer',
description: 'I craft code',
social: {
twitter: '@MarcNuri',
},
twitter: '@MarcNuri'
}
},
plugins: [
'gatsby-plugin-react-helmet',
Expand Down
13 changes: 13 additions & 0 deletions gatsby-node.js
@@ -0,0 +1,13 @@
const locales = require('./src/i18n/locales');

exports.onCreatePage = async ({page, actions}) => {
const {createPage, deletePage} = actions;
deletePage(page);
Object.entries(locales).forEach(([key, locale]) => {
const path = locale.default ? page.path : `${locale.path}${page.path}`;
createPage({...page,
path,
context: {...page.context, locale: key}
});
});
};

0 comments on commit f256bac

Please sign in to comment.