mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-19 13:11:40 -07:00
Integrate gatsby-plugin-intl for internationalization Replaces static text with `intl.formatMessage` call and Links with `gatsby-plugin-intl` equivalent Note: `npm install` now requires `--force` to install the latest `gatsby-plugin-intl` as it doesn't explicitly support gatsby3.0
This commit is contained in:
parent
5c3a3c022a
commit
a579cb13bf
10 changed files with 2475 additions and 1290 deletions
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Footer } from '@trussworks/react-uswds';
|
||||
import {Link} from 'gatsby';
|
||||
import {Link} from 'gatsby-plugin-intl';
|
||||
|
||||
const footerLinks = [
|
||||
<Link to="/">Home</Link>
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
import React from 'react';
|
||||
import { GovBanner, Header, Title, PrimaryNav } from '@trussworks/react-uswds';
|
||||
import { Link } from "gatsby";
|
||||
import { useIntl, Link } from "gatsby-plugin-intl"
|
||||
|
||||
const headerLinks = [
|
||||
<Link to="/">Home</Link>
|
||||
];
|
||||
|
||||
const J40Header = () => {
|
||||
const intl = useIntl()
|
||||
const title = intl.formatMessage({ id: "71L0pp", defaultMessage:"Justice40", description:"Title of the project" });
|
||||
return (
|
||||
<>
|
||||
<GovBanner />
|
||||
<Header>
|
||||
<Title>Justice 40</Title>
|
||||
<Title>
|
||||
{title}
|
||||
</Title>
|
||||
<PrimaryNav items={headerLinks}/>
|
||||
</Header>
|
||||
</>
|
||||
|
|
6
client/src/intl/en.json
Normal file
6
client/src/intl/en.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"71L0pp": {
|
||||
"defaultMessage": "Justice40",
|
||||
"description": "Title of the project"
|
||||
}
|
||||
}
|
3
client/src/intl/es.json
Normal file
3
client/src/intl/es.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"71L0pp": "Justicia40"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import * as React from "react"
|
||||
import { Link } from "gatsby"
|
||||
import * as React from "react";
|
||||
import { Link } from "gatsby-plugin-intl";
|
||||
|
||||
// styles
|
||||
const pageStyles = {
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
import * as React from "react"
|
||||
import Layout from '../components/layout';
|
||||
|
||||
// markup
|
||||
export default function IndexPage() {
|
||||
const IndexPage = () => {
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<title>Justice40</title>
|
||||
</Layout>
|
||||
<Layout>
|
||||
<main>
|
||||
<h2>Subheader</h2>
|
||||
</main>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default IndexPage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue