diff --git a/package.json b/package.json
index 8a8a1a5..2ee8a06 100644
--- a/package.json
+++ b/package.json
@@ -65,7 +65,9 @@
"favicons-webpack-plugin-cesco": "^0.0.6",
"feather-icons": "^4.5.0",
"html-webpack-plugin": "^2.30.1",
+ "i18next": "^10.3.0",
"jest": "^22.2.2",
+ "json-loader": "^0.5.7",
"npm-run-all": "^4.1.2",
"postcss-cssnext": "^3.1.0",
"postcss-loader": "^2.1.0",
@@ -73,12 +75,14 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-ga": "^2.4.1",
+ "react-i18next": "^7.3.6",
"style-loader": "^0.20.1",
"svg-react-loader": "^0.4.5",
"uglifyjs-webpack-plugin": "^1.1.8",
"webpack": "^3.10.0",
"webpack-merge": "^4.1.1",
- "workbox-webpack-plugin": "^2.1.2"
+ "workbox-webpack-plugin": "^2.1.2",
+ "yaml-loader": "^0.5.0"
},
"devDependencies": {
"http-server": "^0.11.1",
diff --git a/src/components/Footer.js b/src/components/Footer.js
index df542b9..9b91a29 100644
--- a/src/components/Footer.js
+++ b/src/components/Footer.js
@@ -1,20 +1,24 @@
import React from 'react';
+import { translate, Trans } from 'react-i18next';
const Footer = () => (
);
-export default Footer;
+export default translate()(Footer);
+export { Footer };
diff --git a/src/components/Footer.test.js b/src/components/Footer.test.js
index f7947b0..4478aaf 100644
--- a/src/components/Footer.test.js
+++ b/src/components/Footer.test.js
@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
-import Footer from './Footer';
+import { Footer } from './Footer';
test('Footer rendering', () => {
const component = shallow(
diff --git a/src/components/Header.js b/src/components/Header.js
index 0ca4ec4..98cf9c2 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -1,4 +1,5 @@
import React from 'react';
+import { translate, Trans } from 'react-i18next';
import GithubIcon from 'feather-icons/dist/icons/github.svg';
@@ -10,10 +11,11 @@ const Header = () => (
);
-export default Header;
+export default translate()(Header);
+export { Header };
diff --git a/src/components/Header.test.js b/src/components/Header.test.js
index fbf279e..726e74c 100644
--- a/src/components/Header.test.js
+++ b/src/components/Header.test.js
@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
-import Header from './Header';
+import { Header } from './Header';
const env = { ...process.env };
diff --git a/src/components/PageTemplate.js b/src/components/PageTemplate.js
index 0ab2763..0dea74c 100644
--- a/src/components/PageTemplate.js
+++ b/src/components/PageTemplate.js
@@ -4,9 +4,6 @@ import PropTypes from 'prop-types';
import pkg from '../../package.json';
-import Header from '../components/Header';
-import Footer from '../components/Footer';
-
const PageTemplate = ({ title, children }) => (
@@ -20,9 +17,7 @@ const PageTemplate = ({ title, children }) => (
-
{ children }
-
diff --git a/src/components/RavenBoundary.js b/src/components/RavenBoundary.js
index dc25ac4..b3c8a2b 100644
--- a/src/components/RavenBoundary.js
+++ b/src/components/RavenBoundary.js
@@ -21,7 +21,6 @@ class RavenBoundary extends React.Component {
if (error) {
const errorProps = {
- heading: 'An error has occurred.',
details: { extra: errorInfo },
error
};
diff --git a/src/components/RavenError.js b/src/components/RavenError.js
index 4b31605..d549540 100644
--- a/src/components/RavenError.js
+++ b/src/components/RavenError.js
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { translate, Trans } from 'react-i18next';
import { Raven } from '../sentry';
import Message from './Message';
@@ -20,10 +21,12 @@ class RavenError extends React.Component {
}
render() {
- const { heading } = this.props;
+ const { t } = this.props;
- return
- This error has been logged. You may also fill out a report.
+ return
+
+ This error has been logged. You may also fill out a report.
+
;
}
}
@@ -31,7 +34,8 @@ class RavenError extends React.Component {
RavenError.propTypes = {
error: PropTypes.object.isRequired,
details: PropTypes.object.isRequired,
- heading: PropTypes.string.isRequired
+ t: PropTypes.func
};
-export default RavenError;
+export default translate()(RavenError);
+export { RavenError };
diff --git a/src/components/RavenError.test.js b/src/components/RavenError.test.js
index 084bf25..4efa3f3 100644
--- a/src/components/RavenError.test.js
+++ b/src/components/RavenError.test.js
@@ -3,11 +3,12 @@ import { shallow } from 'enzyme';
jest.mock('../sentry');
-import RavenError from './RavenError';
+import { RavenError } from './RavenError';
import { Raven } from '../sentry';
const testError = { error: 'test error' };
const testDetails = { details: 'test details' };
+const translate = v => `translate(${ v })`;
describe('RavenError', () => {
test('rendering', () => {
@@ -15,7 +16,7 @@ describe('RavenError', () => {
+ t={ translate }/>
);
expect(component).toMatchSnapshot();
});
@@ -25,7 +26,7 @@ describe('RavenError', () => {
+ t={ translate }/>
);
expect(Raven.captureException).toHaveBeenCalledWith(testError, testDetails);
});
@@ -36,7 +37,7 @@ describe('RavenError', () => {
+ t={ translate }/>
);
const eventObj = { preventDefault: jest.fn() };
component.find('a').simulate('click', eventObj);
diff --git a/src/components/__snapshots__/Footer.test.js.snap b/src/components/__snapshots__/Footer.test.js.snap
index ca2b0b6..6d82bb1 100644
--- a/src/components/__snapshots__/Footer.test.js.snap
+++ b/src/components/__snapshots__/Footer.test.js.snap
@@ -6,24 +6,30 @@ exports[`Footer rendering 1`] = `
className="inline with-separator"
>
- Created by
-
- Jeff Avallone
-
+
+ Created by
+
+ Jeff Avallone
+
+
- Generated images licensed:
-
-
-
+ Generated images licensed:
+
+
+
+
diff --git a/src/components/__snapshots__/Header.test.js.snap b/src/components/__snapshots__/Header.test.js.snap
index b7f3c15..318d478 100644
--- a/src/components/__snapshots__/Header.test.js.snap
+++ b/src/components/__snapshots__/Header.test.js.snap
@@ -20,7 +20,9 @@ exports[`Header rendering 1`] = `
href="https://github.com/javallone/regexper-static"
>
- Source on GitHub
+
+ Source on GitHub
+
diff --git a/src/components/__snapshots__/PageTemplate.test.js.snap b/src/components/__snapshots__/PageTemplate.test.js.snap
index aa190c7..eff8e67 100644
--- a/src/components/__snapshots__/PageTemplate.test.js.snap
+++ b/src/components/__snapshots__/PageTemplate.test.js.snap
@@ -28,11 +28,9 @@ exports[`PageTemplate rendering 1`] = `