Skip to content

Commit 4cbe155

Browse files
authored
fix miscellaneous translations + build warnings (#1934)
* misc translations intermediary commit * silence react-hooks/exhaustive-deps warnings * silence build warnings * format files * fix testimony counts translation string * debug policy page translation * Add key to policy tabs * fix i18n key bug in PolicyPage values section * simplify translation approach for ArchiveTestimonyConfirmation * refactor translation keys in QuickInfo component for consistency and clarity * add errorLabel translation to testimony.json and update usage in PublishTestimony component * add character count translation to reportModal in testimony.json and update usage in ReportModal component * update error handling in PublishTestimony component to use errorMessage translation key * update publish button text to use new translation key for conditional rendering * remove unnecessary whitespace in CopyButton label in SelectRecipients component * fix publish button translation string * fix edit limit notice
1 parent 3c933eb commit 4cbe155

35 files changed

+298
-167
lines changed

components/HearingsScheduled/HearingsScheduled.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Container, Carousel, Spinner } from "react-bootstrap"
33
import styled from "styled-components"
44
import { Col, Row } from "../bootstrap"
55
import { useCalendarEvents } from "./calendarEvents"
6-
import { useTranslation } from "react-i18next"
6+
import { useTranslation } from "next-i18next"
77

88
export type EventData = {
99
index: number

components/Legislative/Legislative.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Container } from "react-bootstrap"
22
import { TestimonyCardList } from "components/LearnTestimonyComponents/TestimonyCardComponents"
3-
import { useTranslation } from "react-i18next"
3+
import { useTranslation } from "next-i18next"
44

55
const LegislativeContent = [
66
{

components/Policies/PolicyPage.tsx

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,42 @@
11
import { PolicyContent } from "./PolicyContent"
22
import { Button, Stack, Container, Image, Row, Col } from "react-bootstrap"
3-
import { ButtonHTMLAttributes, useEffect, useState } from "react"
43
import style from "./PolicyPage.module.css"
54
import Router from "next/router"
65
import classNames from "classnames"
6+
import { useTranslation } from "next-i18next"
77

8-
const policies = ["copyright", "privacy-policy", "code-of-conduct"] as const
8+
const policies = ["privacy-policy", "copyright", "code-of-conduct"] as const
99
export type Policy = (typeof policies)[number]
1010

1111
export default function PolicyPage({
1212
policy = "privacy-policy"
1313
}: {
1414
policy?: Policy
1515
}) {
16-
const handleOnClick = (p: Policy) => {
17-
Router.push(`/policies/${p}`)
18-
}
19-
16+
const { t } = useTranslation("policies")
2017
return (
2118
<Container fluid className={style.policyContent}>
22-
<h1>Policies</h1>
19+
<h1>{t("title")}</h1>
2320
<Stack direction="horizontal">
24-
<Button
25-
className={`${
26-
style[policy === "privacy-policy" ? "currentTab" : "tab"]
27-
}`}
28-
id="privacy-policy"
29-
onClick={e => handleOnClick("privacy-policy")}
30-
>
31-
Privacy <br /> Policy
32-
</Button>
33-
<Button
34-
className={`${style[policy === "copyright" ? "currentTab" : "tab"]}`}
35-
id="copyright"
36-
onClick={e => handleOnClick("copyright")}
37-
>
38-
Terms of Service <br />
39-
</Button>
40-
41-
<Button
42-
className={`${
43-
style[policy === "code-of-conduct" ? "currentTab" : "tab"]
44-
}`}
45-
id="code-of-conduct"
46-
onClick={e => handleOnClick("code-of-conduct")}
47-
>
48-
Code of <br /> Conduct
49-
</Button>
21+
{policies.map(p => (
22+
<Button
23+
className={`${style[policy === p ? "currentTab" : "tab"]}`}
24+
id={p}
25+
key={p}
26+
onClick={() => Router.push(`/policies/${p}`)}
27+
>
28+
{t(`tabs.${p}`)}
29+
</Button>
30+
))}
5031
</Stack>
5132

5233
<PolicyContent policy={policy} />
5334

5435
<div className={style.sharedValues}>
55-
<p className={style.subHeading}>Our Shared Values</p>
36+
<p className={style.subHeading}>{t("values.heading")}</p>
5637
<hr className={style.bottomBorder}></hr>
57-
<p className={style.text1}>
58-
How we interact with each other determines what we can accomplish
59-
</p>
60-
<p className={style.text2}>On this website, we ask you to act with:</p>
38+
<p className={style.text1}>{t("values.description1")}</p>
39+
<p className={style.text2}>{t("values.description2")}</p>
6140
</div>
6241

6342
<Container fluid>
@@ -71,19 +50,19 @@ export default function PolicyPage({
7150
>
7251
<Col xs={12} className={style.blueBox}>
7352
<Image src="/handShake.jpg" alt="" className={style.symbol}></Image>
74-
<p className={style.values}>Humility</p>
53+
<p className={style.values}>{t("values.humility")}</p>
7554
</Col>
7655
<Col xs={12} className={style.blueBox}>
7756
<Image
7857
src="/compassion.png"
7958
alt=""
8059
className={style.symbol}
8160
></Image>
82-
<p className={style.values}>Compassion</p>
61+
<p className={style.values}>{t("values.compassion")}</p>
8362
</Col>
8463
<Col xs={12} className={style.blueBox}>
8564
<Image src="/lightBulb.png" alt="" className={style.symbol}></Image>
86-
<p className={style.values}>Curiosity</p>
65+
<p className={style.values}>{t("values.curiosity")}</p>
8766
</Col>
8867
</Row>
8968
</Container>

components/PriorityBillsCard/PriorityBillsCard.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,3 @@ const Position = (stance: string) => {
8282
</div>
8383
)
8484
}
85-
86-
const EditBtnStyle = styled.p`
87-
color: #8999d6;
88-
`

components/TestimonyCard/ReportModal.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ export function ReportModal({
9595
/>
9696
</FloatingLabel>
9797
<div className="text-muted">
98-
{additionalInformation.length}/{ADDITIONAL_INFO_MAX_LENGTH_CHARS}{" "}
99-
characters
98+
{t("character_count", {
99+
count: additionalInformation.length,
100+
limit: ADDITIONAL_INFO_MAX_LENGTH_CHARS
101+
})}
100102
</div>
101103
</Modal.Body>
102104
<Modal.Footer>

components/bill/Status.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Button, Modal } from "../bootstrap"
55
import { StyledBillTitle, StyledModalTitle } from "./HistoryModal"
66
import { HistoryTable } from "./HistoryTable"
77
import { BillProps } from "./types"
8+
import { useTranslation } from "next-i18next"
89

910
const StyledButton = styled(Button)`
1011
border-radius: 3rem 0 0 3rem;
@@ -17,6 +18,7 @@ const StyledButton = styled(Button)`
1718
export const CourtContext = createContext(1)
1819

1920
export const Status = ({ bill }: BillProps) => {
21+
const { t } = useTranslation("common")
2022
const [showBillHistory, setShowBillHistory] = useState(false)
2123

2224
const handleShowBillHistory = () => setShowBillHistory(true)
@@ -36,7 +38,7 @@ export const Status = ({ bill }: BillProps) => {
3638
</StyledButton>
3739
<Modal show={showBillHistory} onHide={handleCloseBillHistory} size="lg">
3840
<Modal.Header closeButton onClick={handleCloseBillHistory}>
39-
<StyledModalTitle>Status & History</StyledModalTitle>
41+
<StyledModalTitle>{t("bill.status_and_history")}</StyledModalTitle>
4042
</Modal.Header>
4143
<StyledBillTitle>
4244
{bill.id + " - " + bill.content.Title}

components/bill/TestimonyCounts.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ export const TestimonyCounts = ({
6363

6464
return (
6565
<Stack className={`align-self-center mx-auto`}>
66-
<CountTotal className={`ms-2`}>{total} Total Testimonies</CountTotal>
66+
<CountTotal className={`ms-2`}>
67+
{t("counts.total", { count: total })}
68+
</CountTotal>
6769
<CountDirection className={`me-1 ms-4 my-1`}>
6870
<Col className={`px-2`}>
6971
<CountCategory>{t("counts.endorsements.title")}</CountCategory>

components/buttons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export const CopyButton = ({
310310
tooltipDurationMs?: number
311311
format?: string
312312
}) => {
313+
const { t } = useTranslation("common")
313314
const [show, setShow] = useState(false)
314315
const target = useRef(null)
315316
const closeTimeout = useRef<any>()
@@ -334,7 +335,7 @@ export const CopyButton = ({
334335
</Button>
335336
</CopyToClipboard>
336337
<Overlay target={target} show={show} placement="top">
337-
{props => <Tooltip {...props}>Copied to Clipboard!</Tooltip>}
338+
{props => <Tooltip {...props}>{t("copiedToClipboard")}</Tooltip>}
338339
</Overlay>
339340
</>
340341
)

components/dashboard/ResourcesCard.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ export function ResourcesCard({}: Props) {
99
<Container>
1010
<Wrapper>
1111
<LanguagesContainer>
12-
<span>Languages</span>
12+
<span>{t("languages")}</span>
1313

1414
<Languages>
15-
<span>Spanish </span> | <span> English</span>
15+
<span>{t("spanish")} </span> | <span> {t("english")}</span>
1616
</Languages>
1717
</LanguagesContainer>
1818

1919
<PrivacyContainer>
2020
<span>
21-
<Links href="#">Privacy Policy</Links>
21+
<Links href="#">{t("privacyPolicy")}</Links>
2222
</span>
2323
<span>
24-
<Links href="#">Terms and Conditions </Links>
24+
<Links href="#">{t("termsAndConditions")} </Links>
2525
</span>
2626
</PrivacyContainer>
2727
<SocialContainer>

components/db/testimony/useEditTestimony.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ function useSaveDraft(
263263
})
264264
}
265265
},
266-
[billId, dispatch, draftLoading, draftRef, uid, court]
266+
[billId, dispatch, draftLoading, draftRef, uid, court, draft, publication]
267267
),
268268
{ onError: error => dispatch({ type: "error", error }) }
269269
)

0 commit comments

Comments
 (0)