Skip to content

Commit 21014bd

Browse files
committed
make all translation strings long-form
per feedback, this helps with static analysis. this scope included code not introduced in this PR
1 parent 1dccbd5 commit 21014bd

File tree

6 files changed

+48
-34
lines changed

6 files changed

+48
-34
lines changed

apps/site/components/Downloads/DownloadReleasesTable/DetailsButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ type DetailsButtonProps = {
1212
};
1313

1414
const DetailsButton: FC<DetailsButtonProps> = ({ data }) => {
15-
const t = useTranslations('components.downloadReleasesTable');
15+
const t = useTranslations();
1616

1717
const { openModal } = use(ModalContext);
1818

1919
return (
2020
<LinkWithArrow className="cursor-pointer" onClick={() => openModal(data)}>
21-
{t('details')}
21+
{t('components.downloadReleasesTable.details')}
2222
</LinkWithArrow>
2323
);
2424
};

apps/site/components/Downloads/MinorReleasesTable/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ type MinorReleasesTableProps = {
1818
export const MinorReleasesTable: FC<MinorReleasesTableProps> = ({
1919
releases,
2020
}) => {
21-
const t = useTranslations('components.minorReleasesTable');
21+
const t = useTranslations();
2222

2323
return (
2424
<table>
2525
<thead>
2626
<tr>
27-
<th>{t('version')}</th>
28-
<th>{t('links')}</th>
27+
<th>{t('components.minorReleasesTable.version')}</th>
28+
<th>{t('components.minorReleasesTable.links')}</th>
2929
</tr>
3030
</thead>
3131
<tbody>
@@ -38,21 +38,21 @@ export const MinorReleasesTable: FC<MinorReleasesTableProps> = ({
3838
kind="neutral"
3939
href={`https://nodejs.org/download/release/v${release.version}/`}
4040
>
41-
{t('actions.release')}
41+
{t('components.minorReleasesTable.actions.release')}
4242
</Link>
4343
<Separator orientation="vertical" />
4444
<Link
4545
kind="neutral"
4646
href={`${BASE_CHANGELOG_URL}${release.version}`}
4747
>
48-
{t('actions.changelog')}
48+
{t('components.minorReleasesTable.actions.changelog')}
4949
</Link>
5050
<Separator orientation="vertical" />
5151
<Link
5252
kind="neutral"
5353
href={getNodeApiUrl(`v${release.version}`)}
5454
>
55-
{t('actions.docs')}
55+
{t('components.minorReleasesTable.actions.docs')}
5656
</Link>
5757
</div>
5858
</td>

apps/site/components/EOL/Alert.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { useTranslations } from 'next-intl';
44
import Link from '#site/components/Link';
55

66
const EOLAlert = () => {
7-
const t = useTranslations('components.eolAlert');
7+
const t = useTranslations();
88
return (
99
<AlertBox level="warning">
10-
{t('intro')}{' '}
10+
{t('components.eolAlert.intro')}{' '}
1111
<Link href="/eol">
12-
OpenJS Ecosystem Sustainability Program {t('partner')} HeroDevs
12+
OpenJS Ecosystem Sustainability Program{' '}
13+
{t('components.eolAlert.partner')} HeroDevs
1314
</Link>
1415
</AlertBox>
1516
);

apps/site/components/EOL/Modal.tsx

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ const VulnerabilitiesTable: FC<{
2424
vulnerabilities: Array<Vulnerability>;
2525
maxWidth?: string;
2626
}> = ({ vulnerabilities, maxWidth = 'max-w-2xs' }) => {
27-
const t = useTranslations('components.eolModal');
27+
const t = useTranslations();
2828

2929
return (
3030
<table className="w-full">
3131
<thead>
3232
<tr>
33-
<th>{t('table.cves')}</th>
34-
<th>{t('table.severity')}</th>
35-
<th>{t('table.overview')}</th>
36-
<th>{t('table.details')}</th>
33+
<th>{t('components.eolModal.table.cves')}</th>
34+
<th>{t('components.eolModal.table.severity')}</th>
35+
<th>{t('components.eolModal.table.overview')}</th>
36+
<th>{t('components.eolModal.table.details')}</th>
3737
</tr>
3838
</thead>
3939
<tbody>
@@ -67,7 +67,7 @@ const VulnerabilitiesTable: FC<{
6767
target="_blank"
6868
rel="noopener noreferrer"
6969
>
70-
{t('blogLinkText')}
70+
{t('components.eolModal.blogLinkText')}
7171
</LinkWithArrow>
7272
) : (
7373
'—'
@@ -84,7 +84,7 @@ const UnknownSeveritySection: FC<{
8484
vulnerabilities: Array<Vulnerability>;
8585
hasKnownVulns: boolean;
8686
}> = ({ vulnerabilities, hasKnownVulns }) => {
87-
const t = useTranslations('components.eolModal');
87+
const t = useTranslations();
8888

8989
if (!vulnerabilities.length) {
9090
return null;
@@ -93,7 +93,8 @@ const UnknownSeveritySection: FC<{
9393
return (
9494
<details open={!hasKnownVulns}>
9595
<summary className="cursor-pointer font-semibold">
96-
{t('showUnknownSeverities')} ({vulnerabilities.length})
96+
{t('components.eolModal.showUnknownSeverities')} (
97+
{vulnerabilities.length})
9798
</summary>
9899
<div className="mt-4">
99100
<VulnerabilitiesTable
@@ -107,12 +108,17 @@ const UnknownSeveritySection: FC<{
107108

108109
const EOLModal: FC<ModalProps> = ({ open, closeModal, data }) => {
109110
const { release, vulnerabilities } = data as EOLModalData;
110-
const t = useTranslations('components.eolModal');
111-
112-
const modalHeading = t(release.codename ? 'title' : 'titleWithoutCodename', {
113-
version: release.major,
114-
codename: release.codename ?? '',
115-
});
111+
const t = useTranslations();
112+
113+
const modalHeading = t(
114+
release.codename
115+
? 'components.eolModal.title'
116+
: 'components.eolModal.titleWithoutCodename',
117+
{
118+
version: release.major,
119+
codename: release.codename ?? '',
120+
}
121+
);
116122

117123
const [knownVulns, unknownVulns] = vulnerabilities.reduce(
118124
(acc, vuln) => {
@@ -136,7 +142,9 @@ const EOLModal: FC<ModalProps> = ({ open, closeModal, data }) => {
136142
<Content>
137143
{vulnerabilities.length > 0 && (
138144
<p className="m-1">
139-
{t('vulnerabilitiesMessage', { count: vulnerabilities.length })}
145+
{t('components.eolModal.vulnerabilitiesMessage', {
146+
count: vulnerabilities.length,
147+
})}
140148
</p>
141149
)}
142150

@@ -147,7 +155,11 @@ const EOLModal: FC<ModalProps> = ({ open, closeModal, data }) => {
147155
hasKnownVulns={hasKnownVulns}
148156
/>
149157

150-
{!hasAnyVulns && <p className="m-1">{t('noVulnerabilitiesMessage')}</p>}
158+
{!hasAnyVulns && (
159+
<p className="m-1">
160+
{t('components.eolModal.noVulnerabilitiesMessage')}
161+
</p>
162+
)}
151163
</Content>
152164
</Modal>
153165
);

apps/site/components/EOL/Table.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ const EOLTable: FC = () => {
1515
release => release.status === 'End-of-life'
1616
);
1717

18-
const t = useTranslations('components.eolTable');
18+
const t = useTranslations();
1919

2020
return (
2121
<table id="tbVulnerabilities">
2222
<thead>
2323
<tr>
2424
<th>
25-
{t('version')} ({t('codename')})
25+
{t('components.eolTable.version')} (
26+
{t('components.eolTable.codename')})
2627
</th>
27-
<th>{t('lastUpdated')}</th>
28-
<th>{t('vulnerabilities')}</th>
29-
<th>{t('details')}</th>
28+
<th>{t('components.eolTable.lastUpdated')}</th>
29+
<th>{t('components.eolTable.vulnerabilities')}</th>
30+
<th>{t('components.eolTable.details')}</th>
3031
</tr>
3132
</thead>
3233
<tbody>

apps/site/components/EOL/VulnerabilityChips/Chip/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ const VulnerabilityChip: FC<VulnerabilityChipProps> = ({
2323
severity,
2424
count = 0,
2525
}) => {
26-
const t = useTranslations('components.eolChip');
26+
const t = useTranslations();
2727

2828
return (
2929
<Badge size="small" kind={SEVERITY_KIND_MAP[severity]} className="mr-1">
3030
{count > 0 ? <span className={styles.chipCount}>{count}</span> : null}
31-
{t(`severity.${severity}`)}
31+
{t(`components.eolChip.severity.${severity}`)}
3232
</Badge>
3333
);
3434
};

0 commit comments

Comments
 (0)