From 618b21bb937ad37ed75dae55d943b873516998c9 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 6 Jan 2019 13:03:07 -0500 Subject: [PATCH] Implementing translations --- .../Footer/__snapshots__/test.js.snap | 419 +++++---- src/components/Footer/index.js | 16 +- src/components/Footer/test.js | 3 +- .../Header/__snapshots__/test.js.snap | 224 ++++- src/components/Header/index.js | 10 +- .../SentryError/__snapshots__/test.js.snap | 170 ++-- src/components/SentryError/index.js | 20 +- src/components/SentryError/test.js | 9 +- src/locales/en-AC.yaml | 43 + src/locales/en.yaml | 43 + src/pages/404.js | 16 +- src/pages/404.test.js | 5 +- src/pages/__snapshots__/404.test.js.snap | 68 +- src/pages/__snapshots__/index.test.js.snap | 42 +- src/pages/__snapshots__/privacy.test.js.snap | 808 ++++++++++-------- src/pages/index.js | 7 +- src/pages/index.test.js | 4 +- src/pages/privacy.js | 89 +- src/pages/privacy.test.js | 5 +- 19 files changed, 1296 insertions(+), 705 deletions(-) diff --git a/src/components/Footer/__snapshots__/test.js.snap b/src/components/Footer/__snapshots__/test.js.snap index e2567a4..29293d3 100644 --- a/src/components/Footer/__snapshots__/test.js.snap +++ b/src/components/Footer/__snapshots__/test.js.snap @@ -11,6 +11,7 @@ ShallowWrapper { }, } } + t={[Function]} />, Symbol(enzyme.__renderer__): Object { "batchedUpdates": [Function], @@ -30,25 +31,29 @@ ShallowWrapper { className="list" >
  • - Created by - - Jeff Avallone - + + Created by + + Jeff Avallone + +
  • - Generated images licensed: - - Creative Commons CC-BY-3.0 License - + + Generated images licensed: + + TRANSLATE(Creative Commons CC-BY-3.0 License) + +
  • ,
    - Created by - - Jeff Avallone - + + Created by + + Jeff Avallone + + ,
  • - Generated images licensed: - - Creative Commons CC-BY-3.0 License - + + Generated images licensed: + + TRANSLATE(Creative Commons CC-BY-3.0 License) + +
  • , ], "className": "list", @@ -98,31 +107,48 @@ ShallowWrapper { "key": undefined, "nodeType": "host", "props": Object { - "children": Array [ - "Created by ", + "children": + Created by Jeff Avallone - , - ], + + , }, "ref": null, - "rendered": Array [ - "Created by ", - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": "Jeff Avallone", - "href": "mailto:jeff.avallone@gmail.com", - }, - "ref": null, - "rendered": "Jeff Avallone", - "type": "a", + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "class", + "props": Object { + "children": Array [ + "Created by ", + + Jeff Avallone + , + ], }, - ], + "ref": null, + "rendered": Array [ + "Created by ", + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": "Jeff Avallone", + "href": "mailto:jeff.avallone@gmail.com", + }, + "ref": null, + "rendered": "Jeff Avallone", + "type": "a", + }, + ], + "type": [Function], + }, "type": "li", }, Object { @@ -130,52 +156,74 @@ ShallowWrapper { "key": undefined, "nodeType": "host", "props": Object { - "children": Array [ - "Generated images licensed: ", + "children": + Generated images licensed: Creative Commons CC-BY-3.0 License - , - ], + + , }, "ref": null, - "rendered": Array [ - "Generated images licensed: ", - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": Creative Commons CC-BY-3.0 License, - "href": "http://creativecommons.org/licenses/by/3.0/", - "rel": "license external noopener noreferrer", - "target": "_blank", - }, - "ref": null, - "rendered": Object { + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "class", + "props": Object { + "children": Array [ + "Generated images licensed: ", + + TRANSLATE(Creative Commons CC-BY-3.0 License) + , + ], + }, + "ref": null, + "rendered": Array [ + "Generated images licensed: ", + Object { "instance": null, "key": undefined, "nodeType": "host", "props": Object { - "alt": "Creative Commons CC-BY-3.0 License", - "src": "https://licensebuttons.net/l/by/3.0/80x15.png", + "children": TRANSLATE(Creative Commons CC-BY-3.0 License), + "href": "http://creativecommons.org/licenses/by/3.0/", + "rel": "license external noopener noreferrer", + "target": "_blank", }, "ref": null, - "rendered": null, - "type": "img", + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "alt": "TRANSLATE(Creative Commons CC-BY-3.0 License)", + "src": "https://licensebuttons.net/l/by/3.0/80x15.png", + }, + "ref": null, + "rendered": null, + "type": "img", + }, + "type": "a", }, - "type": "a", - }, - ], + ], + "type": [Function], + }, "type": "li", }, ], @@ -207,25 +255,29 @@ ShallowWrapper { className="list" >
  • - Created by - - Jeff Avallone - + + Created by + + Jeff Avallone + +
  • - Generated images licensed: - - Creative Commons CC-BY-3.0 License - + + Generated images licensed: + + TRANSLATE(Creative Commons CC-BY-3.0 License) + +
  • ,
    - Created by - - Jeff Avallone - + + Created by + + Jeff Avallone + + ,
  • - Generated images licensed: - - Creative Commons CC-BY-3.0 License - + + Generated images licensed: + + TRANSLATE(Creative Commons CC-BY-3.0 License) + +
  • , ], "className": "list", @@ -275,31 +331,48 @@ ShallowWrapper { "key": undefined, "nodeType": "host", "props": Object { - "children": Array [ - "Created by ", + "children": + Created by Jeff Avallone - , - ], + + , }, "ref": null, - "rendered": Array [ - "Created by ", - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": "Jeff Avallone", - "href": "mailto:jeff.avallone@gmail.com", - }, - "ref": null, - "rendered": "Jeff Avallone", - "type": "a", + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "class", + "props": Object { + "children": Array [ + "Created by ", + + Jeff Avallone + , + ], }, - ], + "ref": null, + "rendered": Array [ + "Created by ", + Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "children": "Jeff Avallone", + "href": "mailto:jeff.avallone@gmail.com", + }, + "ref": null, + "rendered": "Jeff Avallone", + "type": "a", + }, + ], + "type": [Function], + }, "type": "li", }, Object { @@ -307,52 +380,74 @@ ShallowWrapper { "key": undefined, "nodeType": "host", "props": Object { - "children": Array [ - "Generated images licensed: ", + "children": + Generated images licensed: Creative Commons CC-BY-3.0 License - , - ], + + , }, "ref": null, - "rendered": Array [ - "Generated images licensed: ", - Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": Creative Commons CC-BY-3.0 License, - "href": "http://creativecommons.org/licenses/by/3.0/", - "rel": "license external noopener noreferrer", - "target": "_blank", - }, - "ref": null, - "rendered": Object { + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "class", + "props": Object { + "children": Array [ + "Generated images licensed: ", + + TRANSLATE(Creative Commons CC-BY-3.0 License) + , + ], + }, + "ref": null, + "rendered": Array [ + "Generated images licensed: ", + Object { "instance": null, "key": undefined, "nodeType": "host", "props": Object { - "alt": "Creative Commons CC-BY-3.0 License", - "src": "https://licensebuttons.net/l/by/3.0/80x15.png", + "children": TRANSLATE(Creative Commons CC-BY-3.0 License), + "href": "http://creativecommons.org/licenses/by/3.0/", + "rel": "license external noopener noreferrer", + "target": "_blank", }, "ref": null, - "rendered": null, - "type": "img", + "rendered": Object { + "instance": null, + "key": undefined, + "nodeType": "host", + "props": Object { + "alt": "TRANSLATE(Creative Commons CC-BY-3.0 License)", + "src": "https://licensebuttons.net/l/by/3.0/80x15.png", + }, + "ref": null, + "rendered": null, + "type": "img", + }, + "type": "a", }, - "type": "a", - }, - ], + ], + "type": [Function], + }, "type": "li", }, ], diff --git a/src/components/Footer/index.js b/src/components/Footer/index.js index a0ef4c1..d64abb9 100644 --- a/src/components/Footer/index.js +++ b/src/components/Footer/index.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { StaticQuery, graphql } from 'gatsby'; +import { withNamespaces, Trans } from 'react-i18next'; import style from './style.module.css'; @@ -14,20 +15,21 @@ const query = graphql` } `; -export const FooterImpl = ({ site: { siteMetadata } }) => ( +export const FooterImpl = ({ t, site: { siteMetadata } }) => (