File tree Expand file tree Collapse file tree 4 files changed +28
-16
lines changed Expand file tree Collapse file tree 4 files changed +28
-16
lines changed Original file line number Diff line number Diff line change 1
1
{
2
+ "smiley" : " :)" ,
2
3
"authorization" : " Authorization" ,
3
4
"signInHeader" : " Sign in with mnemonic" ,
4
5
"signIn" : " Sign In" ,
Original file line number Diff line number Diff line change 1
1
{
2
+ "smiley" : " :)" ,
2
3
"authorization" : " Авторизация" ,
3
4
"signInHeader" : " Войти с мнемоникой" ,
4
5
"signIn" : " Войти" ,
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import i18next from 'i18next'
3
+ import Backend from 'i18next-http-backend'
4
+ import { initReactI18next } from 'react-i18next'
5
+
6
+ export const I18nLoader = React . lazy ( async ( ) => {
7
+ await i18next
8
+ . use ( initReactI18next )
9
+ . use ( Backend )
10
+ . init ( {
11
+ lng : navigator . language || 'en' ,
12
+ fallbackLng : 'en' ,
13
+ backend : {
14
+ loadPath : '/locales/{{lng}}/{{ns}}.json' ,
15
+ } ,
16
+ defaultNS : 'common'
17
+ } )
18
+
19
+ return {
20
+ default : ( { children } : React . PropsWithChildren ) => children
21
+ }
22
+ } )
Original file line number Diff line number Diff line change 1
1
import '@/shared/styles/global.css'
2
2
import React , { Suspense } from 'react'
3
3
import ReactDOM from 'react-dom/client'
4
- import i18next from 'i18next'
5
- import Backend from 'i18next-http-backend'
6
- import { initReactI18next } from 'react-i18next'
7
4
import { Provider } from 'react-redux'
8
5
import { persistor , store } from '@/shared/store'
9
6
import { ThemeProvider } from '@/app/theme-provider'
@@ -12,18 +9,7 @@ import { AppLoader } from '@/widgets/loader'
12
9
import { ErrorBoundary } from '@/app/error-boundary'
13
10
import { SodiumLoader } from '@/app/sodium-loader'
14
11
import { IndexedDbLoader } from '@/app/indexeddb-loader'
15
-
16
- i18next
17
- . use ( initReactI18next )
18
- . use ( Backend )
19
- . init ( {
20
- lng : navigator . language || 'en' ,
21
- fallbackLng : 'en' ,
22
- backend : {
23
- loadPath : '/locales/{{lng}}/{{ns}}.json' ,
24
- } ,
25
- defaultNS : 'common'
26
- } )
12
+ import { I18nLoader } from '@/app/i18n-loader'
27
13
28
14
const AppComponent = React . lazy ( ( ) => import ( '@/app/app.tsx' ) )
29
15
@@ -36,7 +22,9 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
36
22
< ErrorBoundary >
37
23
< SodiumLoader >
38
24
< IndexedDbLoader >
39
- < AppComponent />
25
+ < I18nLoader >
26
+ < AppComponent />
27
+ </ I18nLoader >
40
28
</ IndexedDbLoader >
41
29
</ SodiumLoader >
42
30
</ ErrorBoundary >
You can’t perform that action at this time.
0 commit comments