diff --git a/__tests__/src/components/CanvasAnnotations.test.js b/__tests__/src/components/CanvasAnnotations.test.js index eef2ad78f..d5eb9fc35 100644 --- a/__tests__/src/components/CanvasAnnotations.test.js +++ b/__tests__/src/components/CanvasAnnotations.test.js @@ -1,6 +1,6 @@ import { render, screen } from 'test-utils'; import userEvent from '@testing-library/user-event'; -import i18next from 'i18next'; +import { t } from 'i18next'; import { CanvasAnnotations } from '../../../src/components/CanvasAnnotations'; import { ScrollTo } from '../../../src/components/ScrollTo'; @@ -15,7 +15,7 @@ function createWrapper(props) { index={0} label="A Canvas Label" selectAnnotation={() => {}} - t={i18next.t} + t={t} totalSize={1} windowId="abc" {...props} diff --git a/__tests__/src/components/ErrorContent.test.js b/__tests__/src/components/ErrorContent.test.js index 8662d26cb..f87af1cfb 100644 --- a/__tests__/src/components/ErrorContent.test.js +++ b/__tests__/src/components/ErrorContent.test.js @@ -1,4 +1,4 @@ -import i18next from 'i18next'; +import { t } from 'i18next'; import { render, screen } from 'test-utils'; import { ErrorContent } from '../../../src/components/ErrorContent'; @@ -11,7 +11,7 @@ describe('ErrorContent', () => { windowId="xyz" manifestId="foo" classes={{}} - t={i18next.t} + t={t} />, { preloadedState: { @@ -42,7 +42,7 @@ describe('ErrorContent', () => { manifestId="foo" showJsError={false} classes={{}} - t={i18next.t} + t={t} />, { preloadedState: { diff --git a/__tests__/src/components/SearchPanel.test.js b/__tests__/src/components/SearchPanel.test.js index cd7b50ee0..f69d82fa9 100644 --- a/__tests__/src/components/SearchPanel.test.js +++ b/__tests__/src/components/SearchPanel.test.js @@ -1,6 +1,6 @@ import { render, screen } from 'test-utils'; import userEvent from '@testing-library/user-event'; -import i18next from 'i18next'; +import { t } from 'i18next'; import { SearchPanel } from '../../../src/components/SearchPanel'; @@ -68,7 +68,7 @@ describe('SearchPanel', () => { const user = userEvent.setup(); const fetchSearch = jest.fn(); createWrapper({ - fetchSearch, query: '', suggestedSearches: ['abc'], t: i18next.t, + fetchSearch, query: '', suggestedSearches: ['abc'], t, }); expect(screen.getByRole('button', { name: 'Search this document for "abc"' })).toBeInTheDocument(); diff --git a/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js b/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js index 6faa978d6..6aa4b1f56 100644 --- a/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js +++ b/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js @@ -1,5 +1,5 @@ import { render, screen } from 'test-utils'; -import i18next from 'i18next'; +import { t } from 'i18next'; import CanvasAnnotations from '../../../src/containers/CanvasAnnotations'; import { WindowSideBarAnnotationsPanel } from '../../../src/components/WindowSideBarAnnotationsPanel'; @@ -11,7 +11,7 @@ function createWrapper(props, state) { annotationCount={4} classes={{}} id="xyz" - t={i18next.t} + t={t} windowId="abc" {...props} />, diff --git a/__tests__/src/components/WindowSideBarButtons.test.js b/__tests__/src/components/WindowSideBarButtons.test.js index e2b03bf31..919733154 100644 --- a/__tests__/src/components/WindowSideBarButtons.test.js +++ b/__tests__/src/components/WindowSideBarButtons.test.js @@ -1,6 +1,6 @@ import { render, screen } from 'test-utils'; import userEvent from '@testing-library/user-event'; -import i18next from 'i18next'; +import { t } from 'i18next'; import { WindowSideBarButtons } from '../../../src/components/WindowSideBarButtons'; /** create wrapper */ @@ -8,7 +8,7 @@ function createWrapper(props) { return render( {}} - t={i18next.t} + t={t} {...props} panels={{ annotations: true, diff --git a/src/i18n.js b/src/i18n.js index fb4531a24..3f6d0f4f2 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,4 +1,4 @@ -import i18n from 'i18next'; +import { createInstance } from 'i18next'; import { initReactI18next } from 'react-i18next'; import ar from './locales/ar/translation.json'; import de from './locales/de/translation.json'; @@ -50,7 +50,7 @@ function createI18nInstance() { 'zh-TW': zhTw, }; - const instance = i18n.createInstance(); + const instance = createInstance(); instance.use(initReactI18next).init({ fallbackLng: 'en', interpolation: {