Skip to content

Commit d34c4a1

Browse files
committed
added string translation
1 parent 1714253 commit d34c4a1

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

components/search/bills/BillSearch.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTranslation } from "next-i18next"
12
import {
23
CurrentRefinements,
34
Hits,
@@ -106,6 +107,8 @@ const Layout: FC<
106107
const hierarchicalMenu = useBillHierarchicalMenu()
107108
const status = useSearchStatus()
108109

110+
const { t } = useTranslation("billSearch")
111+
109112
return (
110113
<SearchContainer>
111114
<Row>
@@ -132,9 +135,9 @@ const Layout: FC<
132135
/>
133136
{status === "empty" ? (
134137
<NoResults>
135-
Your search has yielded zero results!
138+
{t("zero_results")}
136139
<br />
137-
<b>Try another search term</b>
140+
<b>{t("another_term")}</b>
138141
</NoResults>
139142
) : (
140143
<Hits hitComponent={BillHit} />

components/search/bills/useBillRefinements.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import { RefinementListItem } from "instantsearch.js/es/connectors/refinement-li
33
import { useCallback } from "react"
44
import { useRefinements } from "../useRefinements"
55

6+
// for legacy code purposes, things like:
7+
//
8+
// `legislative session` and `session`
9+
//
10+
// are used by variables that are named things like:
11+
//
12+
// `general court` and `court`
13+
//
14+
// see example below:
15+
//
16+
// attribute: "court",
17+
// searchablePlaceholder: "Legislative Session",
18+
619
export const useBillRefinements = (list: Number) => {
720
const baseProps = { limit: 500, searchable: true }
821
const propsList1 = [

pages/bills/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTranslation } from "next-i18next"
12
import { Container } from "components/bootstrap"
23
import { createPage } from "components/page"
34
import { BillSearch } from "components/search"
@@ -6,9 +7,11 @@ import { createGetStaticTranslationProps } from "components/translations"
67
export default createPage({
78
title: "Browse Bills",
89
Page: () => {
10+
const { t } = useTranslation("billSearch")
11+
912
return (
1013
<Container fluid="md" className="mt-3">
11-
<h1>Browse Bills</h1>
14+
<h1>{t("browse_bills")}</h1>
1215
<BillSearch />
1316
</Container>
1417
)
@@ -17,6 +20,7 @@ export default createPage({
1720

1821
export const getStaticProps = createGetStaticTranslationProps([
1922
"auth",
23+
"billSearch",
2024
"common",
2125
"footer",
2226
"testimony"

public/locales/en/billSearch.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"another_term" : "Try another search term",
3+
"browse_bills" : "Browse Bills",
4+
"zero_results" : "Your search has yielded zero results!"
5+
}

0 commit comments

Comments
 (0)