Updates intl file with latest copy (#795)

* Extract 404 page copy to intl

* Move all copy to data copy folder and add tests

- Add test:intl-extraction script
- Fix certain defaultMessages not appearing
- update snapshot
This commit is contained in:
Vim 2021-10-14 13:49:16 -07:00 committed by GitHub
commit d1511287b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 199 additions and 140 deletions

View file

@ -1,11 +1,11 @@
import * as React from 'react';
import {defineMessages} from 'react-intl';
import {Link} from 'gatsby-plugin-intl';
import {useIntl} from 'gatsby-plugin-intl';
import {Grid} from '@trussworks/react-uswds';
import J40MainGridContainer from '../components/J40MainGridContainer';
import Layout from '../components/layout';
import * as PAGE_NOT_FOUND_COPY from '../data/copy/404';
const codeStyles = {
color: '#8A6534',
@ -22,62 +22,30 @@ interface I404PageProps {
// markup
const NotFoundPage =({location}: I404PageProps) => {
const intl = useIntl();
const messages = defineMessages({
pageNotFoundTitle: {
id: 'pageNotFound.title.text',
defaultMessage: 'Page not found',
description: 'page not found title text',
},
pageNotFoundHeading: {
id: 'pageNotFound.heading.text',
defaultMessage: 'Page not found',
description: 'page not found heading text',
},
pageNotFoundApology: {
id: 'pageNotFound.apology.text',
defaultMessage: 'Sorry',
description: 'page not found apology text',
},
pageNotFoundApologyDescription: {
id: 'pageNotFound.apology.description.text',
defaultMessage: 'we couldnt find what you were looking for.',
description: 'page not found apology description text',
},
pageNotFoundGuidance: {
id: 'pageNotFound.Guidance.text',
defaultMessage: 'Try creating a page in',
description: 'page not found guidance text',
},
pageNotFoundLinkToGoHome: {
id: 'pageNotFound.link.to.go.home.text',
defaultMessage: 'Go home',
description: 'page not found link to go home text',
},
});
return (
<Layout location={location} title={intl.formatMessage(messages.pageNotFoundTitle)}>
<Layout location={location} title={intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.TITLE)}>
<J40MainGridContainer>
<Grid row>
<h1>{intl.formatMessage(messages.pageNotFoundHeading)}</h1>
<h1>{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.HEADING)}</h1>
</Grid>
<Grid row>
<p>
{intl.formatMessage(messages.pageNotFoundApology)}
{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.APOLOGY)}
{' '}
<span role="img" aria-label="Pensive emoji">
😔
</span>{' '}
{intl.formatMessage(messages.pageNotFoundApologyDescription)}
{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.APOLOGY_INFO)}
</p>
</Grid>
<Grid row>
{process.env.NODE_ENV === 'development' ? (
<p>
{intl.formatMessage(messages.pageNotFoundGuidance)}
{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.GUIDANCE)}
<code style={codeStyles}>src/pages/</code>.
</p>
) : null}
@ -85,7 +53,7 @@ const NotFoundPage =({location}: I404PageProps) => {
<Grid>
<p>
<Link to="/">{intl.formatMessage(messages.pageNotFoundLinkToGoHome)}</Link>.
<Link to="/">{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.LINK_HOME)}</Link>.
</p>
</Grid>

View file

@ -316,7 +316,7 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
Draft communities list v0.1 (111MB)
</div>
<div>
The package includes draft v0.1 of the list of communities of focus (.csv and .xlsx) and information about how to use the list (.pdf).
The package includes draft v0.1 of the list of communities of focus (.csv and .xlsx) and information about how to use the list (.pdf).
<span>
Last updated: 10/01/21
</span>
@ -336,7 +336,6 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
alt="download icon for download package"
src="test-file-stub"
/>
</div>
<div>
Download package

View file

@ -1,5 +1,4 @@
import React from 'react';
import {Link} from 'gatsby-plugin-intl';
import {useIntl} from 'gatsby-plugin-intl';
import {Grid} from '@trussworks/react-uswds';
@ -33,14 +32,7 @@ const CEJSTPage = ({location}: IMapPageProps) => {
<Grid col={12} tablet={{col: 6}}>
<section>
<p>
Zoom into the map to see communities of focus that can help Federal agencies
identify disadvantaged communities and to provide socioeconomic,
environmental, and climate information and data. Learn more about the methodology
and datasets that were used to determine these communities of focus on the
{` `}
<Link to={'/methodology'}>Data & methodology</Link>
{` `}
page.
{EXPLORE_COPY.PAGE_DESCRIPTION}
</p>
</section>
</Grid>