diff --git a/app/I18nTesting.js b/app/I18nTesting.js
new file mode 100644
index 0000000..43dbcc2
--- /dev/null
+++ b/app/I18nTesting.js
@@ -0,0 +1,31 @@
+import i18n from 'i18next'
+import { initReactI18next } from 'react-i18next'
+import fs from 'fs/promises'
+
+async function getRes() {
+ const data = await fs.readFile('./app/i18n/locales/en/translation.json')
+ return JSON.parse(data)
+}
+
+const res = await getRes()
+console.log(res)
+
+await i18n
+ .use(initReactI18next)
+ .init({
+ lng: 'en',
+ fallbackLng: 'en',
+ debug: true,
+ interpolation: {
+ escapeValue: false,
+ },
+ react: {
+ useSuspense: false,
+ wait: true
+ },
+ ns: ['translationsNS'],
+ defaultNS: 'translationsNS',
+ resources: { en: { translationsNS: res }}
+ });
+
+export default i18n
\ No newline at end of file
diff --git a/app/TestWrapper.tsx b/app/TestWrapper.tsx
new file mode 100644
index 0000000..e73fe32
--- /dev/null
+++ b/app/TestWrapper.tsx
@@ -0,0 +1,21 @@
+import { I18nextProvider } from "react-i18next";
+import { Provider } from "react-redux";
+import i18nTesting from '@/app/I18nTesting'
+import { EnhancedStore } from '@reduxjs/toolkit'
+import { makeStore } from "@/lib/store";
+
+interface Props {
+ store?: EnhancedStore
+ children: React.ReactNode
+}
+
+export default function TestWrapper({ children, store }: Props) {
+ store = store || makeStore()
+ return (
+
+
+ {children}
+
+
+ )
+}
\ No newline at end of file
diff --git a/app/benefits/page.tsx b/app/benefits/page.tsx
index fbb2c6e..5611b99 100644
--- a/app/benefits/page.tsx
+++ b/app/benefits/page.tsx
@@ -2,7 +2,7 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, Form, FormGroup, Grid, GridContainer, Checkbox, Alert } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
+import { useTranslation } from 'react-i18next'
import { useAppDispatch, useAppSelector } from "@/lib/hooks"
import { useRouter } from "next/navigation"
import { SubmitHandler, useForm, Controller } from "react-hook-form"
@@ -10,7 +10,7 @@ import { selectBenefits, setBenefits } from "@/lib/features/benefits/benefitsSli
import { useState } from "react"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
const benefits = useAppSelector(state => selectBenefits(state))
diff --git a/app/components/ExpenseList.tsx b/app/components/ExpenseList.tsx
index 9839a77..33f76b2 100644
--- a/app/components/ExpenseList.tsx
+++ b/app/components/ExpenseList.tsx
@@ -1,5 +1,5 @@
import { Card, CardBody, CardGroup, CardHeader, GridContainer } from "@trussworks/react-uswds";
-import { useTranslation } from "@/app/i18n/client";
+import { useTranslation } from "react-i18next";
import { useAppSelector } from "@/lib/hooks";
import { ExpenseItem, selectExpenseItems, selectExpenseTotal } from "@/lib/features/ledger/expenses/expensesSlice";
import ExpenseListItem from "./ExpenseListItem";
@@ -9,7 +9,7 @@ interface ExpenseListProps {
}
export default function ExpenseList({header}: ExpenseListProps) {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const items = useAppSelector(state => selectExpenseItems(state))
const expenseTotal = useAppSelector(state => selectExpenseTotal(state))
diff --git a/app/components/ExpenseListItem.tsx b/app/components/ExpenseListItem.tsx
index 3568489..12e6cd7 100644
--- a/app/components/ExpenseListItem.tsx
+++ b/app/components/ExpenseListItem.tsx
@@ -1,4 +1,4 @@
-import { useTranslation } from "@/app/i18n/client"
+import { useTranslation } from "react-i18next"
import { ExpenseItem, removeExpense } from "@/lib/features/ledger/expenses/expensesSlice"
import { useAppDispatch } from "@/lib/hooks"
import { Grid, ModalToggleButton, Modal, ModalHeading, ModalFooter, ButtonGroup } from "@trussworks/react-uswds"
@@ -11,7 +11,7 @@ interface ItemProps {
}
export default function ExpenseListItem({ item, index }: ItemProps) {
const ref = useRef(null)
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
function onDeleteClicked() {
diff --git a/app/components/I18nComponent.tsx b/app/components/I18nComponent.tsx
new file mode 100644
index 0000000..2fcd8eb
--- /dev/null
+++ b/app/components/I18nComponent.tsx
@@ -0,0 +1,6 @@
+'use client'
+import '@/app/i18n'
+
+export default function I18nComponent() {
+ return (<>>)
+}
\ No newline at end of file
diff --git a/app/components/IncomeList.tsx b/app/components/IncomeList.tsx
index 3d6fc3a..b5de3be 100644
--- a/app/components/IncomeList.tsx
+++ b/app/components/IncomeList.tsx
@@ -4,7 +4,7 @@ import { IncomeItem, selectIncomeItems, selectIncomeTotal } from "@/lib/features
import { useAppSelector } from "@/lib/hooks"
import IncomeListItem from "./IncomeListItem"
import { Card, CardBody, CardGroup, CardHeader, GridContainer } from "@trussworks/react-uswds"
-import { useTranslation } from "@/app/i18n/client"
+import { useTranslation } from "react-i18next"
interface Props {
dayCount: number
@@ -12,7 +12,7 @@ interface Props {
}
export default function IncomeList({dayCount, header}: Props) {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const items = useAppSelector(state => selectIncomeItems(state))
const incomeTotal = useAppSelector(state => selectIncomeTotal(state))
const incomeItemElements = items.map((item: IncomeItem, idx: number) => {
diff --git a/app/components/IncomeListItem.tsx b/app/components/IncomeListItem.tsx
index 385e256..35ad8f6 100644
--- a/app/components/IncomeListItem.tsx
+++ b/app/components/IncomeListItem.tsx
@@ -1,4 +1,4 @@
-import { useTranslation } from "@/app/i18n/client"
+import { useTranslation } from "react-i18next"
import { IncomeItem, removeIncome } from "@/lib/features/ledger/income/incomeSlice"
import { useAppDispatch } from "@/lib/hooks"
import { Grid, ModalToggleButton, Modal, ModalHeading, ModalFooter, ButtonGroup } from "@trussworks/react-uswds"
@@ -9,7 +9,7 @@ interface ItemProps {
}
export default function IncomeListItem({ item, index }: ItemProps) {
const ref = useRef(null)
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
function onDeleteClicked() {
diff --git a/app/components/RequiredFieldDescription.tsx b/app/components/RequiredFieldDescription.tsx
index 1d32799..c995830 100644
--- a/app/components/RequiredFieldDescription.tsx
+++ b/app/components/RequiredFieldDescription.tsx
@@ -1,9 +1,9 @@
-import { useTranslation } from '@/app/i18n/client'
+import { useTranslation } from 'react-i18next'
import { RequiredMarker } from "@trussworks/react-uswds"
import { Trans } from 'react-i18next'
export default function RequiredFieldDescription() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
return (
]} />
diff --git a/app/i18n.js b/app/i18n.js
new file mode 100644
index 0000000..ac110cd
--- /dev/null
+++ b/app/i18n.js
@@ -0,0 +1,15 @@
+import i18n from 'i18next';
+import { initReactI18next } from 'react-i18next';
+import LanguageDetector from 'i18next-browser-languagedetector';
+import resourcesToBackend from 'i18next-resources-to-backend'
+
+i18n
+ .use(LanguageDetector)
+ .use(initReactI18next)
+ .use(resourcesToBackend((language, namespace) => import(`./i18n/locales/${language}/${namespace}.json`)))
+ .init({
+ debug: process.env.NODE_ENV !== "production" ,
+ fallbackLng: 'en'
+ });
+
+export default i18n;
diff --git a/app/i18n/client.js b/app/i18n/client.js
deleted file mode 100644
index e5c6468..0000000
--- a/app/i18n/client.js
+++ /dev/null
@@ -1,53 +0,0 @@
-'use client'
-// From: https://locize.com/blog/next-app-dir-i18n/
-import { useEffect, useState } from 'react'
-import i18next from 'i18next'
-import { initReactI18next, useTranslation as useTranslationOrg } from 'react-i18next'
-import { useCookies } from 'react-cookie'
-import resourcesToBackend from 'i18next-resources-to-backend'
-import LanguageDetector from 'i18next-browser-languagedetector'
-import { getOptions, languages, cookieName } from './settings'
-
-const runsOnServerSide = typeof window === 'undefined'
-
-//
-i18next
- .use(initReactI18next)
- .use(LanguageDetector)
- .use(resourcesToBackend((language, namespace) => import(`./locales/${language}/${namespace}.json`)))
- .init({
- ...getOptions(),
- lng: undefined, // let detect the language on client side
- detection: {
- order: ['path', 'htmlTag', 'cookie', 'navigator'],
- },
- preload: runsOnServerSide ? languages : []
- })
-
-export function useTranslation(lng, ns, options) {
- const [cookies, setCookie] = useCookies([cookieName])
- const ret = useTranslationOrg(ns, options)
- const { i18n } = ret
- if (runsOnServerSide && lng && i18n.resolvedLanguage !== lng) {
- i18n.changeLanguage(lng)
- } else {
- // eslint-disable-next-line react-hooks/rules-of-hooks
- const [activeLng, setActiveLng] = useState(i18n.resolvedLanguage)
- // eslint-disable-next-line react-hooks/rules-of-hooks
- useEffect(() => {
- if (activeLng === i18n.resolvedLanguage) return
- setActiveLng(i18n.resolvedLanguage)
- }, [activeLng, i18n.resolvedLanguage])
- // eslint-disable-next-line react-hooks/rules-of-hooks
- useEffect(() => {
- if (!lng || i18n.resolvedLanguage === lng) return
- i18n.changeLanguage(lng)
- }, [lng, i18n])
- // eslint-disable-next-line react-hooks/rules-of-hooks
- useEffect(() => {
- if (cookies.i18next === lng) return
- setCookie(cookieName, lng, { path: '/' })
- }, [lng, cookies.i18next])
- }
- return ret
-}
\ No newline at end of file
diff --git a/app/i18n/index.js b/app/i18n/index.js
deleted file mode 100644
index 1946853..0000000
--- a/app/i18n/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import { createInstance } from 'i18next'
-import resourcesToBackend from 'i18next-resources-to-backend'
-import { initReactI18next } from 'react-i18next/initReactI18next'
-import { getOptions } from './settings'
-
-const initI18next = async (lng, ns) => {
- const i18nInstance = createInstance()
- await i18nInstance
- .use(initReactI18next)
- .use(resourcesToBackend((language, namespace) => import(`./locales/${language}/${namespace}.json`)))
- .init(getOptions(lng, ns))
- return i18nInstance
-}
-
-export async function useTranslation(lng, ns, options = {}) {
- const i18nextInstance = await initI18next(lng, ns)
- return {
- t: i18nextInstance.getFixedT(lng, Array.isArray(ns) ? ns[0] : ns, options.keyPrefix),
- i18n: i18nextInstance
- }
-}
\ No newline at end of file
diff --git a/app/i18n/settings.js b/app/i18n/settings.js
deleted file mode 100644
index e84d17a..0000000
--- a/app/i18n/settings.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export const fallbackLng = 'en'
-export const languages = [fallbackLng, 'de']
-export const defaultNS = 'translation'
-export const cookieName = 'i18next'
-
-export function getOptions (lng = fallbackLng, ns = defaultNS) {
- return {
- // debug: true,
- supportedLngs: languages,
- fallbackLng,
- lng,
- fallbackNS: defaultNS,
- defaultNS,
- ns
- }
-}
\ No newline at end of file
diff --git a/app/layout.tsx b/app/layout.tsx
index f4fdf5b..b4c087b 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -3,6 +3,7 @@ import { Inter } from "next/font/google";
import StoreProvider from './StoreProvider'
import "./globals.css";
import GovernmentBanner from "./components/GovernmentBanner";
+import I18nComponent from "./components/I18nComponent";
import InitialStateLoader from "./InitialStateLoader";
const inter = Inter({ subsets: ["latin"] });
@@ -17,7 +18,7 @@ function RootLayout({
}>) {
return (
-
{children}
+
{children}
);
}
diff --git a/app/ledger/expense/add/page.tsx b/app/ledger/expense/add/page.tsx
index b5dcc91..9f8fd06 100644
--- a/app/ledger/expense/add/page.tsx
+++ b/app/ledger/expense/add/page.tsx
@@ -1,8 +1,8 @@
'use client'
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
+import { useTranslation } from 'react-i18next'
import { Header, Title, Button, Form, FormGroup, Grid, GridContainer, Alert, Checkbox, DatePicker, ErrorMessage, ComboBox, Label, ValidationChecklist, ValidationItem, RequiredMarker } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
import { useAppDispatch } from "@/lib/hooks"
import { ExpenseItem, addExpense, selectExpenseItems } from "@/lib/features/ledger/expenses/expensesSlice"
import { useRouter } from "next/navigation"
@@ -13,7 +13,7 @@ import exp from "constants"
import RequiredFieldDescription from "@/app/components/RequiredFieldDescription"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
diff --git a/app/ledger/expense/list/page.tsx b/app/ledger/expense/list/page.tsx
index 7a8ff55..3de7583 100644
--- a/app/ledger/expense/list/page.tsx
+++ b/app/ledger/expense/list/page.tsx
@@ -3,14 +3,14 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, ButtonGroup, CardGroup, ModalToggleButton, Modal, ModalHeading, ModalFooter, Card, CardBody, CardHeader, Grid, GridContainer, Label, TextInput, ModalRef } from '@trussworks/react-uswds'
-import { useTranslation } from '../../../i18n/client'
+import { useTranslation } from 'react-i18next'
import { useRouter } from "next/navigation"
import ExpenseList from "@/app/components/ExpenseList"
import { useAppSelector } from "@/lib/hooks"
import { selectRecommendStandardDeduction } from "@/lib/store"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const router = useRouter()
const reccommendStandardDeduction = useAppSelector(state => selectRecommendStandardDeduction(state))
diff --git a/app/ledger/expense/page.tsx b/app/ledger/expense/page.tsx
index 2dd627e..9eb3ce8 100644
--- a/app/ledger/expense/page.tsx
+++ b/app/ledger/expense/page.tsx
@@ -3,12 +3,12 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, HeadingLevel, Grid, GridContainer, Accordion } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
+import { useTranslation } from 'react-i18next'
import { useRouter } from "next/navigation"
import Link from 'next/link'
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const router = useRouter()
const testItems = [
diff --git a/app/ledger/expense/snap/page.tsx b/app/ledger/expense/snap/page.tsx
index cf19887..7d83f59 100644
--- a/app/ledger/expense/snap/page.tsx
+++ b/app/ledger/expense/snap/page.tsx
@@ -5,11 +5,11 @@ import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, HeadingLevel, Grid, GridContainer, Accordion, Radio, Form } from '@trussworks/react-uswds'
import { useRouter } from "next/navigation"
import Link from 'next/link'
-import { useTranslation } from "@/app/i18n/client"
+import { useTranslation } from "react-i18next"
import { Controller, SubmitHandler, useForm } from "react-hook-form"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const router = useRouter()
const MONTHLY_AMOUNT = "XXX.XX"
diff --git a/app/ledger/expense/snap/recommend/page.test.tsx b/app/ledger/expense/snap/recommend/page.test.tsx
index 0252277..8b241d9 100644
--- a/app/ledger/expense/snap/recommend/page.test.tsx
+++ b/app/ledger/expense/snap/recommend/page.test.tsx
@@ -8,6 +8,7 @@ import { EnhancedStore } from '@reduxjs/toolkit'
import mockRouter from 'next-router-mock'
import { BenefitsState, selectBenefits, setBenefits } from '@/lib/features/benefits/benefitsSlice'
import { IncomeItem, addIncome } from '@/lib/features/ledger/income/incomeSlice'
+import TestWrapper from '@/app/TestWrapper'
describe('SNAP Recommend Deduction Screen', async () => {
let store: EnhancedStore
@@ -22,13 +23,14 @@ describe('SNAP Recommend Deduction Screen', async () => {
medicaid: true,
}
store.dispatch(setBenefits(benefits))
+
const incomeItem: IncomeItem = {
amount: 100,
name: "Suzy",
description: "Yardwork",
}
store.dispatch(addIncome(incomeItem))
- render (
)
+ render(
)
})
afterEach(cleanup)
diff --git a/app/ledger/expense/snap/recommend/page.tsx b/app/ledger/expense/snap/recommend/page.tsx
index 1abf6f8..d0598b6 100644
--- a/app/ledger/expense/snap/recommend/page.tsx
+++ b/app/ledger/expense/snap/recommend/page.tsx
@@ -4,7 +4,7 @@ import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, Grid, GridContainer, Radio, Form } from '@trussworks/react-uswds'
import { useRouter } from "next/navigation"
-import { useTranslation } from "@/app/i18n/client"
+import { useTranslation } from "react-i18next"
import { Controller, SubmitHandler, useForm } from "react-hook-form"
import { useAppDispatch, useAppSelector } from "@/lib/hooks"
import { BenefitsState, selectBenefits, setBenefits } from "@/lib/features/benefits/benefitsSlice"
@@ -13,7 +13,7 @@ import { useEffect } from "react"
import { selectRecommendStandardDeduction } from "@/lib/store"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const router = useRouter()
const dispatch = useAppDispatch()
const benefits = useAppSelector(state => selectBenefits(state))
diff --git a/app/ledger/income/add/page.test.tsx b/app/ledger/income/add/page.test.tsx
index fa8095a..9c6a93a 100644
--- a/app/ledger/income/add/page.test.tsx
+++ b/app/ledger/income/add/page.test.tsx
@@ -1,19 +1,18 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
-import { Provider } from 'react-redux'
import Page from './page'
import { makeStore } from '@/lib/store'
import { vi } from 'vitest'
import { EnhancedStore } from '@reduxjs/toolkit'
import mockRouter from 'next-router-mock'
+import TestWrapper from '@/app/TestWrapper'
describe('Add Income To Ledger Page', async () => {
let store: EnhancedStore
beforeEach(() => {
vi.mock('next/navigation', () => require('next-router-mock'))
mockRouter.push('/ledger/income/add')
- store = makeStore()
- render (
)
+ render (
)
})
afterEach(cleanup)
diff --git a/app/ledger/income/add/page.tsx b/app/ledger/income/add/page.tsx
index f5137eb..9e47663 100644
--- a/app/ledger/income/add/page.tsx
+++ b/app/ledger/income/add/page.tsx
@@ -2,7 +2,7 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, Form, FormGroup, Grid, GridContainer, Alert } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
+import { useTranslation } from 'react-i18next'
import { useAppDispatch } from "@/lib/hooks"
import { addIncome, IncomeItem } from "@/lib/features/ledger/income/incomeSlice"
import { useRouter } from "next/navigation"
@@ -12,7 +12,7 @@ import TextAreaWithValidation from "@/app/components/TextAreaWithValidation"
import RequiredFieldDescription from "@/app/components/RequiredFieldDescription"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
diff --git a/app/ledger/income/list/page.tsx b/app/ledger/income/list/page.tsx
index e737cab..b52d61e 100644
--- a/app/ledger/income/list/page.tsx
+++ b/app/ledger/income/list/page.tsx
@@ -3,7 +3,7 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, ButtonGroup, Grid, GridContainer } from '@trussworks/react-uswds'
-import { useTranslation } from '../../../i18n/client'
+import { useTranslation } from 'react-i18next'
import { useRouter } from "next/navigation"
import { selectBenefits } from "@/lib/features/benefits/benefitsSlice"
import { useAppSelector } from "@/lib/hooks"
@@ -12,7 +12,7 @@ import IncomeList from "@/app/components/IncomeList"
const DAY_COUNT = 30
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const router = useRouter()
const benefits = useAppSelector(state => selectBenefits(state))
diff --git a/app/ledger/review/LedgerReviewHeader.test.tsx b/app/ledger/review/LedgerReviewHeader.test.tsx
index b99e422..4c84e92 100644
--- a/app/ledger/review/LedgerReviewHeader.test.tsx
+++ b/app/ledger/review/LedgerReviewHeader.test.tsx
@@ -1,10 +1,8 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
-import { Provider } from 'react-redux'
import LedgerReviewHeader from './LedgerReviewHeader'
-import { makeStore } from '@/lib/store'
-import { EnhancedStore } from '@reduxjs/toolkit'
import { BenefitsState } from '@/lib/features/benefits/benefitsSlice'
+import TestWrapper from '@/app/TestWrapper'
describe('Ledger Review Header', async () => {
const SNAP_INCOME = 350.00
@@ -22,8 +20,7 @@ describe('Ledger Review Header', async () => {
snap: true,
}
- const store: EnhancedStore = makeStore()
- render (
)
+ render (
)
})
it('Displays SNAP and Medicaid header', () => {
@@ -55,8 +52,7 @@ describe('Ledger Review Header', async () => {
snap: false,
}
- const store: EnhancedStore = makeStore()
- render (
)
+ render (
)
})
it('Displays Medicaid only header', () => {
@@ -92,8 +88,7 @@ describe('Ledger Review Header', async () => {
snap: true,
}
- const store: EnhancedStore = makeStore()
- render (
)
+ render (
)
})
it('Does not display Medicaid only header', () => {
diff --git a/app/ledger/review/LedgerReviewHeader.tsx b/app/ledger/review/LedgerReviewHeader.tsx
index 9fa2634..3fed858 100644
--- a/app/ledger/review/LedgerReviewHeader.tsx
+++ b/app/ledger/review/LedgerReviewHeader.tsx
@@ -1,5 +1,5 @@
import { BenefitsState } from "@/lib/features/benefits/benefitsSlice"
-import { useTranslation } from "@/app/i18n/client"
+import { useTranslation } from "react-i18next"
interface ReviewHeaderProps {
benefits: BenefitsState
@@ -8,7 +8,7 @@ interface ReviewHeaderProps {
}
export default function LedgerReviewHeader({benefits, snapIncomeTotal, medicaidIncomeTotal}: ReviewHeaderProps) {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
if (benefits.medicaid && benefits.snap) {
return (
diff --git a/app/ledger/review/SnapExpenses.tsx b/app/ledger/review/SnapExpenses.tsx
index 9f757ea..76f8c21 100644
--- a/app/ledger/review/SnapExpenses.tsx
+++ b/app/ledger/review/SnapExpenses.tsx
@@ -1,5 +1,5 @@
import { BenefitsState } from "@/lib/features/benefits/benefitsSlice"
-import { useTranslation } from "@/app/i18n/client"
+import { useTranslation } from "react-i18next"
import { Card, CardBody, CardGroup, CardHeader } from "@trussworks/react-uswds"
interface SnapExpensesProps {
@@ -8,7 +8,7 @@ interface SnapExpensesProps {
}
export default function SnapExpenses({benefits, snapIncomeTotal}: SnapExpensesProps) {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
if (!benefits.snap || !benefits.deductionAmount) {
return <>>
diff --git a/app/ledger/review/page.tsx b/app/ledger/review/page.tsx
index 1e3117e..1f03504 100644
--- a/app/ledger/review/page.tsx
+++ b/app/ledger/review/page.tsx
@@ -2,7 +2,7 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, Grid, GridContainer } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
+import { useTranslation } from 'react-i18next'
import { useAppSelector } from "@/lib/hooks"
import { useRouter } from "next/navigation"
import { selectBenefits } from "@/lib/features/benefits/benefitsSlice"
@@ -16,7 +16,7 @@ import SnapExpenses from "./SnapExpenses"
const DAY_COUNT = 30
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const router = useRouter()
const benefits = useAppSelector(state => selectBenefits(state))
const incomeTotal = useAppSelector(state => selectIncomeTotal(state))
diff --git a/app/page.tsx b/app/page.tsx
index 04d026a..fd56fdb 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -3,12 +3,12 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
-import { useTranslation } from "@/app/i18n/client";
+import { useTranslation } from "react-i18next";
import { useRouter } from "next/navigation";
import { Grid, GridContainer, Header, Title, Icon, Button, Accordion, HeadingLevel } from "@trussworks/react-uswds";
export default function Home() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const router = useRouter()
function getStartedClicked() {
diff --git a/app/statement/confirmation/page.test.tsx b/app/statement/confirmation/page.test.tsx
index e7956e7..064a52f 100644
--- a/app/statement/confirmation/page.test.tsx
+++ b/app/statement/confirmation/page.test.tsx
@@ -1,12 +1,12 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
-import { Provider } from 'react-redux'
import Page from './page'
import { makeStore } from '@/lib/store'
import { vi } from 'vitest'
import { EnhancedStore } from '@reduxjs/toolkit'
import mockRouter from 'next-router-mock'
import { setConfimationNumber } from '@/lib/features/statement/statementSlice'
+import TestWrapper from '@/app/TestWrapper'
describe('Confirmation screen', async () => {
let store: EnhancedStore
@@ -15,7 +15,7 @@ describe('Confirmation screen', async () => {
mockRouter.push('/statement/confirmation')
store = makeStore()
store.dispatch(setConfimationNumber("1234567890"))
- render (
)
+ render (
)
})
afterEach(cleanup)
diff --git a/app/statement/confirmation/page.tsx b/app/statement/confirmation/page.tsx
index 3f6e54f..b9c875a 100644
--- a/app/statement/confirmation/page.tsx
+++ b/app/statement/confirmation/page.tsx
@@ -2,7 +2,7 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, Grid, GridContainer } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
+import { useTranslation } from 'react-i18next'
import { useAppDispatch, useAppSelector } from "@/lib/hooks"
import { useRouter } from "next/navigation"
import { selectSignedStatement } from "@/lib/features/statement/statementSlice"
@@ -11,7 +11,7 @@ import Image from "next/image"
import ledgerImage from './ledger.png'
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
const signedStatement = useAppSelector((state) => selectSignedStatement(state))
diff --git a/app/statement/set/page.tsx b/app/statement/set/page.tsx
index 995cdd3..a54ebc4 100644
--- a/app/statement/set/page.tsx
+++ b/app/statement/set/page.tsx
@@ -2,7 +2,7 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, Form, FormGroup, Grid, GridContainer, DatePicker, Label } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
+import { useTranslation } from 'react-i18next'
import { useAppDispatch } from "@/lib/hooks"
import { useRouter } from "next/navigation"
import { SubmitHandler, useForm, Controller } from "react-hook-form"
@@ -11,7 +11,7 @@ import ErrorSummary from "@/app/components/ErrorSummary"
import { SignedStatementState, setSignedStatement } from "@/lib/features/statement/statementSlice"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
diff --git a/app/statement/sign/page.tsx b/app/statement/sign/page.tsx
index 1366af3..be26077 100644
--- a/app/statement/sign/page.tsx
+++ b/app/statement/sign/page.tsx
@@ -1,8 +1,8 @@
'use client'
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
+import { useTranslation } from 'react-i18next'
import { Header, Title, Button, Form, FormGroup, Grid, GridContainer, CardHeader, Card, CardBody, CardGroup, Checkbox, RequiredMarker } from '@trussworks/react-uswds'
-import { useTranslation } from '@/app/i18n/client'
import { useAppDispatch, useAppSelector } from "@/lib/hooks"
import { useRouter } from "next/navigation"
import { SubmitHandler, useForm, Controller } from "react-hook-form"
@@ -12,7 +12,7 @@ import { selectSignedStatement, setSignedStatement } from "@/lib/features/statem
import RequiredFieldDescription from "@/app/components/RequiredFieldDescription"
export default function Page() {
- const { t } = useTranslation('en')
+ const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
const signedStatement = useAppSelector((state) => selectSignedStatement(state))