Skip to content

Commit

Permalink
Fix warnings about usage of i18n
Browse files Browse the repository at this point in the history
```
Caution: `i18n` also has a named export `createInstance`. Check if you meant to write `import {createInstance} from 'i18next'` instead
```
  • Loading branch information
jcoyne committed Oct 31, 2024
1 parent 7f2e2fc commit 3e61c32
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions __tests__/src/components/CanvasAnnotations.test.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -15,7 +15,7 @@ function createWrapper(props) {
index={0}
label="A Canvas Label"
selectAnnotation={() => {}}
t={i18next.t}
t={t}
totalSize={1}
windowId="abc"
{...props}
Expand Down
6 changes: 3 additions & 3 deletions __tests__/src/components/ErrorContent.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18next from 'i18next';
import { t } from 'i18next';
import { render, screen } from 'test-utils';

import { ErrorContent } from '../../../src/components/ErrorContent';
Expand All @@ -11,7 +11,7 @@ describe('ErrorContent', () => {
windowId="xyz"
manifestId="foo"
classes={{}}
t={i18next.t}
t={t}
/>,
{
preloadedState: {
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('ErrorContent', () => {
manifestId="foo"
showJsError={false}
classes={{}}
t={i18next.t}
t={t}
/>,
{
preloadedState: {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/src/components/SearchPanel.test.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -11,7 +11,7 @@ function createWrapper(props, state) {
annotationCount={4}
classes={{}}
id="xyz"
t={i18next.t}
t={t}
windowId="abc"
{...props}
/>,
Expand Down
4 changes: 2 additions & 2 deletions __tests__/src/components/WindowSideBarButtons.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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 */
function createWrapper(props) {
return render(
<WindowSideBarButtons
addCompanionWindow={() => {}}
t={i18next.t}
t={t}
{...props}
panels={{
annotations: true,
Expand Down
4 changes: 2 additions & 2 deletions src/i18n.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -50,7 +50,7 @@ function createI18nInstance() {
'zh-TW': zhTw,
};

const instance = i18n.createInstance();
const instance = createInstance();
instance.use(initReactI18next).init({
fallbackLng: 'en',
interpolation: {
Expand Down

0 comments on commit 3e61c32

Please sign in to comment.