File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,13 @@ import { getUserLocales } from 'get-user-locale';
6
6
7
7
import DiagramWithLegend from './DiagramWithLegend.js' ;
8
8
import Footer from './Footer.js' ;
9
- import { supportedLocales } from './i18n/i18n.js' ;
9
+ import { defaultLocale , supportedLocales } from './i18n/i18n.js' ;
10
10
import Options from './Options.js' ;
11
11
import { supportedReactVersions } from './reactVersions.js' ;
12
12
13
13
import type { ReactVersion } from './types.js' ;
14
14
15
- function getLocalStorage ( key : string , defaultValue ? : string ) : string {
15
+ function getLocalStorage ( key : string , defaultValue : string ) : string {
16
16
return key in localStorage ? localStorage [ key ] : defaultValue ;
17
17
}
18
18
@@ -28,7 +28,7 @@ function setLocaleToDocument(locale: string) {
28
28
const locales = getUserLocales ( ) ;
29
29
const userLocale = getLocalStorage (
30
30
'locale' ,
31
- getMatchingLocale ( locales , supportedLocales ) || undefined ,
31
+ getMatchingLocale ( locales , supportedLocales ) || defaultLocale ,
32
32
) ;
33
33
const latestReactVersion = supportedReactVersions [ supportedReactVersions . length - 1 ] ;
34
34
setLocaleToDocument ( userLocale ) ;
Original file line number Diff line number Diff line change 1
- import { StrictMode } from 'react' ;
1
+ import { StrictMode , Suspense } from 'react' ;
2
2
import { createRoot } from 'react-dom/client' ;
3
3
import { TProvider } from '@wojtekmaj/react-t' ;
4
4
@@ -16,8 +16,10 @@ if (!root) {
16
16
17
17
createRoot ( root ) . render (
18
18
< StrictMode >
19
- < TProvider defaultLocale = { defaultLocale } languageFiles = { languageFiles } >
20
- < Root />
19
+ < TProvider defaultLocale = { defaultLocale } languageFiles = { languageFiles } suspend >
20
+ < Suspense fallback = { null } >
21
+ < Root />
22
+ </ Suspense >
21
23
</ TProvider >
22
24
</ StrictMode > ,
23
25
) ;
You can’t perform that action at this time.
0 commit comments