blob: db021f9bb3d4509029d9244c71094331544af3ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { useEffect } from 'react';
import { i18n } from '@lingui/core';
import { I18nProvider } from '@lingui/react';
import { AppPropsWithLayout } from '@ts/types/app';
import { activateLocale, defaultLocale, initLingui } from '@utils/helpers/i18n';
import '../styles/globals.scss';
import { ThemeProvider } from 'next-themes';
initLingui(defaultLocale);
const MyApp = ({ Component, pageProps }: AppPropsWithLayout) => {
const locale: string = pageProps.locale || defaultLocale;
useEffect(() => {
activateLocale(locale, pageProps.translation);
});
const getLayout = Component.getLayout ?? ((page) => page);
return (
<I18nProvider i18n={i18n}>
<ThemeProvider
defaultTheme="system"
enableColorScheme={true}
enableSystem={true}
>
{getLayout(<Component {...pageProps} />)}
</ThemeProvider>
</I18nProvider>
);
};
export default MyApp;
|