Skip to content

Commit

Permalink
Replace react-i18next imports with next-i18next
Browse files Browse the repository at this point in the history
  • Loading branch information
kachar committed Mar 2, 2021
1 parent 8f95627 commit a09cda3
Show file tree
Hide file tree
Showing 36 changed files with 36 additions and 37 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ A common way to sort the imports in the file is by their source: `external`, `ab

```tsx
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

import Nav from 'components/layout/Nav'
import Layout from 'components/layout/Layout'
Expand Down Expand Up @@ -418,7 +418,7 @@ Usage of translation hook `useTranslation` is preferred over usage of `<Trans />
#### Usage in components

```tsx
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

export default function CustomComponent() {
const { t } = useTranslation()
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"formik": "^2.2.6",
"highcharts": "^9.0.1",
"highcharts-react-official": "^3.0.0",
"i18next": "^19.8.4",
"mobx": "^6.0.4",
"mobx-react": "^7.0.5",
"next": "^10.0.5",
Expand Down
2 changes: 1 addition & 1 deletion src/common/form/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```tsx
import React from 'react'
import * as yup from 'yup'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Grid, TextField, Button } from '@material-ui/core'

import { AlertStore } from 'stores/AlertStore'
Expand Down
2 changes: 1 addition & 1 deletion src/common/form/validation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { setLocale } from 'yup'
import { TOptions } from 'i18next'
import { TFunction } from 'react-i18next'
import { TFunction } from 'next-i18next'

export type TranslatableField = (string | undefined) | { key: string; values?: TOptions }

Expand Down
2 changes: 1 addition & 1 deletion src/components/about/AboutPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Typography } from '@material-ui/core'
import Layout from 'components/layout/Layout'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

import styles from './about.module.scss'

Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/changePassword/ChangePasswordPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Container } from '@material-ui/core'

import Layout from 'components/layout/Layout'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import * as yup from 'yup'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Typography, Grid } from '@material-ui/core'

import SubmitButton from 'components/common/form/SubmitButton'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Container } from '@material-ui/core'

import Layout from 'components/layout/Layout'
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/login/LoginForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import * as yup from 'yup'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Grid } from '@material-ui/core'
import { AlertStore } from 'stores/AlertStore'

Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/login/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { signIn } from 'next-auth/client'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Container, Grid, Box, Button } from '@material-ui/core'

import Link from 'components/common/Link'
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/profile/ProfilePage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import {
Avatar,
Box,
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/register/RegisterPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Container } from '@material-ui/core'

import Layout from 'components/layout/Layout'
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/form/FormTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { FormikValues } from 'formik'
import { TextField, TextFieldProps } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

import { translateError } from 'common/form/useForm'
import { TranslatableField } from 'common/form/validation'
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/form/SubmitButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'
import { Button, ButtonProps, CircularProgress, CircularProgressProps } from '@material-ui/core'

Expand Down
2 changes: 1 addition & 1 deletion src/components/index/helpers/Typewriter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Typewriter from 'typewriter-effect'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

import { Typography } from '@material-ui/core'
import { makeStyles, createStyles } from '@material-ui/core/styles'
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/helpers/chart/TeamPie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import Highcharts from 'highcharts'
import HighchartsReact from 'highcharts-react-official'
import { teamPieData, teamPieOptions, TeamPieItem } from 'components/index/helpers/chart/pieData'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import handleViewport from 'react-in-viewport'

export type TeamPieProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/sections/ActivitySection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid, Typography } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { makeStyles, createStyles } from '@material-ui/core/styles'

const useStyles = makeStyles((theme) =>
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/sections/Jumbotron.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

import { Grid, Typography } from '@material-ui/core'
import { makeStyles, createStyles } from '@material-ui/core/styles'
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/sections/ProblemsToSolveSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid, Typography } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { makeStyles, createStyles } from '@material-ui/core/styles'

import CommissionsIcon from '../icons/problems-to-solve-icons/CommissionsIcon'
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/sections/SupportUsSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid, Typography } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { makeStyles, createStyles } from '@material-ui/core/styles'

import FinancesIcon from '../icons/support-us-icons/FinancesIcon'
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/sections/TeamChartSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid, Typography, Box } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { makeStyles, createStyles } from '@material-ui/core/styles'

import TeamPie from 'components/index/helpers/chart/TeamPie'
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/sections/TeamSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid, Typography } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { makeStyles, createStyles } from '@material-ui/core/styles'

const useStyles = makeStyles((theme) =>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/LocaleButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback } from 'react'
import { useRouter } from 'next/router'
import { Button } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

export default function LocaleMenu() {
const router = useRouter()
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/LocaleMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRouter } from 'next/router'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Button, Menu, MenuItem } from '@material-ui/core'

export default function LocaleMenu() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/LocaleSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from 'react'
import { useRouter } from 'next/router'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { Box, Button, ButtonGroup } from '@material-ui/core'

export default function LocaleSwitcher() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/nav/MainNavMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Grid } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

import { routes } from 'common/routes'
import LinkButton from 'components/common/LinkButton'
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/nav/MobileNav.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRouter } from 'next/router'
import React, { useEffect } from 'react'
import { useSession } from 'next-auth/client'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { makeStyles, createStyles } from '@material-ui/core/styles'
import { SwipeableDrawer, Hidden, Box, Grid } from '@material-ui/core'

Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/nav/PrivateMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import { useRouter } from 'next/router'
import { useSession } from 'next-auth/client'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { AccountCircle } from '@material-ui/icons'
import { Avatar, Grid, IconButton, Menu, MenuItem } from '@material-ui/core'

Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/nav/PublicMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Grid } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

import { routes } from 'common/routes'
import LinkButton from 'components/common/LinkButton'
Expand Down
2 changes: 1 addition & 1 deletion src/components/support-form/Actions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MouseEvent } from 'react'
import { Button, Grid } from '@material-ui/core'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'

type ActionsProps = {
nextLabel: string
Expand Down
2 changes: 1 addition & 1 deletion src/components/support-form/SupportPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormikErrors } from 'formik'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import React, { useEffect, useState } from 'react'
import { makeStyles, Theme, createStyles, withStyles } from '@material-ui/core/styles'
import { Container, Stepper, Step, StepLabel, StepConnector, Hidden, Grid } from '@material-ui/core'
Expand Down
2 changes: 1 addition & 1 deletion src/components/support-form/steps/AdditionalQuestions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { FormikProps } from 'formik'
import {
Checkbox,
Expand Down
2 changes: 1 addition & 1 deletion src/components/support-form/steps/GeneralInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import {
Checkbox,
FormControl,
Expand Down
2 changes: 1 addition & 1 deletion src/components/support-form/steps/Newsletter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { FormikProps } from 'formik'
import { Checkbox, FormControl, FormControlLabel, FormLabel } from '@material-ui/core'

Expand Down
2 changes: 1 addition & 1 deletion src/components/support-form/steps/Roles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import {
Checkbox,
FormControl,
Expand Down
2 changes: 1 addition & 1 deletion src/components/support-form/steps/ThankYou.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'next-i18next'
import { createStyles, Grid, makeStyles, Theme, Typography } from '@material-ui/core'

const useStyles = makeStyles((theme: Theme) =>
Expand Down

0 comments on commit a09cda3

Please sign in to comment.