Skip to content

Instantly share code, notes, and snippets.

@theodesp
Last active April 6, 2020 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theodesp/555bd51df4ce9df1838c5b34b9fa4e0a to your computer and use it in GitHub Desktop.
Save theodesp/555bd51df4ce9df1838c5b34b9fa4e0a to your computer and use it in GitHub Desktop.
import React from 'react';
import { graphql } from 'gatsby';
import { Translation } from 'react-i18next';
import { Link } from '@wapps/gatsby-plugin-i18next';
import { withI18next } from 'gatsby-plugin-i18next';
import Layout from '../components/layout';
const IndexPage = () => (
<Translation>
{t => (
<Layout>
<h1>{t('Hi people')}</h1>
<p>{t('Welcome to your new Gatsby site.')}</p>
<p>{t('Now go build something great.')}</p>
<Link to="/page-2/">{t('Go to page 2')}</Link>
</Layout>
)}
</Translation>
);
export default withI18next()(IndexPage);
export const query = graphql`
query($lng: String!) {
locales: allLocale(filter: { lng: { eq: $lng }, ns: { eq: "messages" } }) {
...LocaleFragment
}
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment