File tree Expand file tree Collapse file tree 6 files changed +41
-8
lines changed Expand file tree Collapse file tree 6 files changed +41
-8
lines changed Original file line number Diff line number Diff line change
1
+ import { useTranslation } from "next-i18next"
1
2
import {
2
3
CurrentRefinements ,
3
4
Hits ,
@@ -105,6 +106,8 @@ const Layout: FC<
105
106
const hierarchicalMenu = useBillHierarchicalMenu ( )
106
107
const status = useSearchStatus ( )
107
108
109
+ const { t } = useTranslation ( "billSearch" )
110
+
108
111
return (
109
112
< SearchContainer >
110
113
< Row >
@@ -129,9 +132,9 @@ const Layout: FC<
129
132
/>
130
133
{ status === "empty" ? (
131
134
< NoResults >
132
- Your search has yielded zero results!
135
+ { t ( "zero_results" ) }
133
136
< br />
134
- < b > Try another search term </ b >
137
+ < b > { t ( "another_term" ) } </ b >
135
138
</ NoResults >
136
139
) : (
137
140
< Hits hitComponent = { BillHit } />
Original file line number Diff line number Diff line change @@ -3,6 +3,19 @@ import { RefinementListItem } from "instantsearch.js/es/connectors/refinement-li
3
3
import { useCallback } from "react"
4
4
import { useRefinements } from "../useRefinements"
5
5
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
+
6
19
export const useBillRefinements = ( ) => {
7
20
const baseProps = { limit : 500 , searchable : true }
8
21
const propsList = [
@@ -18,7 +31,7 @@ export const useBillRefinements = () => {
18
31
[ ]
19
32
) ,
20
33
attribute : "court" ,
21
- searchablePlaceholder : "General Court " ,
34
+ searchablePlaceholder : "Legislative Session " ,
22
35
...baseProps
23
36
} ,
24
37
{
Original file line number Diff line number Diff line change
1
+ import { useTranslation } from "next-i18next"
1
2
import { useInstantSearch } from "react-instantsearch"
2
3
import { faFilter } from "@fortawesome/free-solid-svg-icons"
3
4
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
@@ -42,13 +43,15 @@ export const useHierarchicalMenu = ({
42
43
)
43
44
const hasRefinements = useHasRefinements ( )
44
45
46
+ const { t } = useTranslation ( "billSearch" )
47
+
45
48
return {
46
49
options : inline ? (
47
50
< div > { hierarchicalMenu } </ div >
48
51
) : (
49
52
< Offcanvas show = { show } onHide = { handleClose } >
50
53
< Offcanvas . Header closeButton >
51
- < Offcanvas . Title > Filter </ Offcanvas . Title >
54
+ < Offcanvas . Title > { t ( "topics" ) } </ Offcanvas . Title >
52
55
</ Offcanvas . Header >
53
56
< Offcanvas . Body >
54
57
< SearchContainer > { hierarchicalMenu } </ SearchContainer >
@@ -62,7 +65,7 @@ export const useHierarchicalMenu = ({
62
65
onClick = { handleOpen }
63
66
className = { hasRefinements ? "ais-FilterButton-has-refinements" : "" }
64
67
>
65
- < FontAwesomeIcon icon = { faFilter } /> Filter
68
+ < FontAwesomeIcon icon = { faFilter } /> { t ( "topics" ) }
66
69
</ FilterButton >
67
70
)
68
71
}
Original file line number Diff line number Diff line change
1
+ import { useTranslation } from "next-i18next"
1
2
import { RefinementList , useInstantSearch } from "react-instantsearch"
2
3
import { faFilter } from "@fortawesome/free-solid-svg-icons"
3
4
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
@@ -39,13 +40,15 @@ export const useRefinements = ({
39
40
)
40
41
const hasRefinements = useHasRefinements ( )
41
42
43
+ const { t } = useTranslation ( "billSearch" )
44
+
42
45
return {
43
46
options : inline ? (
44
47
< div > { refinements } </ div >
45
48
) : (
46
49
< Offcanvas show = { show } onHide = { handleClose } >
47
50
< Offcanvas . Header closeButton >
48
- < Offcanvas . Title > Filter </ Offcanvas . Title >
51
+ < Offcanvas . Title > { t ( "filter" ) } </ Offcanvas . Title >
49
52
</ Offcanvas . Header >
50
53
< Offcanvas . Body >
51
54
< SearchContainer > { refinements } </ SearchContainer >
@@ -59,7 +62,7 @@ export const useRefinements = ({
59
62
onClick = { handleOpen }
60
63
className = { hasRefinements ? "ais-FilterButton-has-refinements" : "" }
61
64
>
62
- < FontAwesomeIcon icon = { faFilter } /> Filter
65
+ < FontAwesomeIcon icon = { faFilter } /> { t ( "filter" ) }
63
66
</ FilterButton >
64
67
)
65
68
}
Original file line number Diff line number Diff line change
1
+ import { useTranslation } from "next-i18next"
1
2
import { Container } from "components/bootstrap"
2
3
import { createPage } from "components/page"
3
4
import { BillSearch } from "components/search"
@@ -6,9 +7,11 @@ import { createGetStaticTranslationProps } from "components/translations"
6
7
export default createPage ( {
7
8
title : "Browse Bills" ,
8
9
Page : ( ) => {
10
+ const { t } = useTranslation ( "billSearch" )
11
+
9
12
return (
10
13
< Container fluid = "md" className = "mt-3" >
11
- < h1 > Browse Bills </ h1 >
14
+ < h1 > { t ( "browse_bills" ) } </ h1 >
12
15
< BillSearch />
13
16
</ Container >
14
17
)
@@ -17,6 +20,7 @@ export default createPage({
17
20
18
21
export const getStaticProps = createGetStaticTranslationProps ( [
19
22
"auth" ,
23
+ "billSearch" ,
20
24
"common" ,
21
25
"footer" ,
22
26
"testimony"
Original file line number Diff line number Diff line change
1
+ {
2
+ "another_term" : " Try another search term" ,
3
+ "browse_bills" : " Browse Bills" ,
4
+ "filter" : " Filter" ,
5
+ "topics" : " Topics" ,
6
+ "zero_results" : " Your search has yielded zero results!"
7
+ }
You can’t perform that action at this time.
0 commit comments