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

@ -244,6 +244,7 @@
"description": "Download the draft list of communities of focus and datasets used."
},
"download.draft.ptag.2": {
"defaultMessage": "ZIP file will contain one .xlsx, one .csv, and one .pdf ({downloadFileSize}).",
"description": "Download the draft list of communities of focus and datasets used."
},
"downloadPacket.button.text": {
@ -251,18 +252,25 @@
"description": "download packet button text"
},
"downloadPacket.header.text": {
"defaultMessage": "Draft communities list v{versionNumber} ({downloadFileSize})",
"description": "download packet header text"
},
"downloadPacket.info.last.updated": {
"defaultMessage": "Last updated: {downloadLastUpdated}",
"description": "download packet info last updated"
},
"downloadPacket.info.text": {
"defaultMessage": "The package includes draft v{versionNumber} of the list of communities of focus (.csv and .xlsx) and information about how to use the list (.pdf).",
"description": "download packet info text"
},
"exploreTool.heading.text": {
"defaultMessage": "Explore the tool",
"description": "explore the tool heading text"
},
"exploreTool.page.description": {
"defaultMessage": "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 {methodologyLink} page.",
"description": "page description"
},
"exploreTool.title.text": {
"defaultMessage": "Explore the tool",
"description": "explore the tool title text"
@ -283,6 +291,10 @@
"defaultMessage": "Footer navigation",
"description": "aria-label text for whole footer"
},
"footer.contactheader": {
"defaultMessage": "Contact",
"description": "Footer column header"
},
"footer.findcontactlink": {
"defaultMessage": "Find a contact at USA.gov",
"description": "Footer find contact link text"
@ -343,6 +355,10 @@
"defaultMessage": "How to get started",
"description": "sub heading of page"
},
"index.heading.about.us": {
"defaultMessage": "About us",
"description": "main heading for about page"
},
"index.heading.justice40": {
"defaultMessage": "The Justice40 Initiative",
"description": "heading for about justice 40"

View file

@ -0,0 +1,29 @@
const enJson = require('./en.json');
const assert = require('assert');
// This file will allow us to test the en.json file and see if any entries are missing a default message.
// 1. Run intl:extract by npm run intl:extract
// 2. Navigate to client folder and in the command line
// 3. npm run test:intl-extraction
// 4. If there is no errors, then everything looks good!
// 5. If there are errors, set debug to true and re-run.
// Todo: Have this run anytime any copy changes occur
const debug = false;
if (debug) console.log('Total number of entries in en.json file: ', Object.entries(enJson).length);
let defaultCount = 0;
const noDefault = [];
Object.entries(enJson).forEach((msg) => msg[1].defaultMessage ? defaultCount++ : noDefault.push(msg[0]));
if (debug) console.log('Total number of defaultMessages in en.json file: ', defaultCount);
noDefault.forEach((msg) => console.log('Entries missing defaultMessage: ', msg));
let description = 0;
Object.entries(enJson).forEach((msg) => msg[1].description ? description++ : null);
if (debug) console.log('Total number of descriptions in en.json file: ', description);
// Assertions will fire on errors:
assert(Object.entries(enJson).length === defaultCount);
assert(Object.entries(enJson).length === description);