Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about usage of i18n #3972

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading