Skip to content

Commit 20468f5

Browse files
committed
debug testimonyHit translations
1 parent fe31e25 commit 20468f5

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

components/search/testimony/TestimonyHit.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Hit } from "instantsearch.js"
22
import Link from "next/link"
3-
import { useTranslation } from "next-i18next"
3+
import { Trans, useTranslation } from "next-i18next"
44
import { Image } from "react-bootstrap"
55
import { useMediaQuery } from "usehooks-ts"
66

@@ -25,8 +25,6 @@ export const TestimonyHit = ({ hit }: { hit: Hit<Testimony> }) => {
2525
}
2626

2727
const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
28-
const { t } = useTranslation(["auth", "testimony"])
29-
3028
const date = new Date(
3129
parseInt(hit.publishedAt.toString())
3230
).toLocaleDateString("en-US", {
@@ -37,12 +35,6 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
3735
const { loading, error, result: bill } = useBill(hit.court, hit.billId)
3836
const committee = bill?.currentCommittee
3937
const isOrg = hit.authorRole === "organization"
40-
const author =
41-
isOrg || hit.public ? (
42-
<Link href={`/profile?id=${hit.authorUid}`}>{hit.fullName}</Link>
43-
) : (
44-
hit.fullName
45-
)
4638
const { user } = useAuth()
4739
const { followOrg } = useFlags()
4840
const isCurrentUser = user?.uid === hit.authorUid
@@ -67,12 +59,25 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
6759
>
6860
<Image
6961
src={isOrg ? "/profile-org-icon.svg" : "/profile-individual-icon.svg"}
70-
alt={t("profileIcon")}
62+
alt={useTranslation("auth").t("profileIcon")}
7163
height="30px"
7264
width="30px"
7365
/>
7466
<span style={{ flexGrow: 1 }}>
75-
<b>{t("testimonyHit.writtenBy", { author })}</b>
67+
<b>
68+
<Trans
69+
ns="testimony"
70+
i18nKey="testimonyHit.writtenBy"
71+
values={{ author: hit.fullName }}
72+
components={[
73+
isOrg || hit.public ? (
74+
<Link href={`/profile?id=${hit.authorUid}`} />
75+
) : (
76+
<></>
77+
)
78+
]}
79+
/>
80+
</b>
7681
</span>
7782
{hit.public && !isCurrentUser && followOrg && user && (
7883
<FollowUserButton profileId={hit.authorUid} />
@@ -96,7 +101,7 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
96101
{/* <Link href={maple.bill({ court: hit.court, id: hit.billId })}> */}
97102
{/* <a> */}
98103
<h2>
99-
{t("testimonyHit.bill", {
104+
{useTranslation("testimony").t("testimonyHit.bill", {
100105
billId: formatBillId(hit.billId)
101106
})}
102107
</h2>

public/locales/en/testimony.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"counts": {
33
"endorsements": "The total number of testimonies that endorse the bill.",
4-
"neutral":"The total number of testimonies that are neutral towards the bill.",
5-
"oppose":"The total number of testimonies that oppose the bill."
6-
},
4+
"neutral": "The total number of testimonies that are neutral towards the bill.",
5+
"oppose": "The total number of testimonies that oppose the bill."
6+
},
77
"link": {
88
"tweetContent": "I provided testimony on Bill {{billNumber}}. See {{link}} for details.",
99
"twitter": "Tweet Your Published Testimony"
@@ -30,7 +30,7 @@
3030
}
3131
},
3232
"testimonyHit": {
33-
"writtenBy": "Written by {{author}}",
33+
"writtenBy": "Written by <0>{{author}}</0>",
3434
"bill": "Bill #{{billId}}"
3535
},
3636
"testimonyDetail": {
@@ -65,7 +65,7 @@
6565
"reporting": "Reporting",
6666
"report": "Report",
6767
"rescind": "You may request that your testimony be deleted by completing this form. Since MAPLE is an archive, deletion requests will only be granted if the testimony was submitted on the wrong bill, if it contained sensitive personal information, or if the user is below 18 years old.",
68-
"personalInformation": "Personal Information",
68+
"personalInformation": "Personal Information",
6969
"wrongBill": "Submitted to wrong bill",
7070
"offensive": "Offensive",
7171
"violent": "Violent",

0 commit comments

Comments
 (0)