diff --git a/apps/web/i18next.d.ts b/apps/web/i18next.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/web/next-i18next.config.js b/apps/web/next-i18next.config.js deleted file mode 100644 index 3efdefac9..000000000 --- a/apps/web/next-i18next.config.js +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -const isDev = process.env.NODE_ENV === 'development'; -/**@type import('react-i18next').UserConfig */ -module.exports = { - debug: isDev, - i18n: { - locales: ['en', 'fr', 'ar', 'bg', 'zh', 'nl', 'de', 'he', 'it', 'pl', 'pt', 'ru', 'es'], - defaultLocale: 'en' - }, - defaultNS: 'common', - ns: ['common'], - /** To avoid issues when deploying*/ - localePath: typeof window === 'undefined' ? require('path').resolve('./public/locales') : '/locales', - reloadOnPrerender: true -}; diff --git a/apps/web/ni18n.config.ts b/apps/web/ni18n.config.ts index f4ebc6a4c..1c8600021 100644 --- a/apps/web/ni18n.config.ts +++ b/apps/web/ni18n.config.ts @@ -1,5 +1,21 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +import i18n from 'i18next'; +import { initReactI18next } from 'react-i18next'; const supportedLngs = ['en', 'fr', 'ar', 'bg', 'zh', 'nl', 'de', 'he', 'it', 'pl', 'pt', 'ru', 'es']; -export const ni18nConfig = { + +i18n.use(initReactI18next).init({ + lng: 'en', + fallbackLng: 'en', + ns: ['common'], + defaultNS: 'common', supportedLngs, - ns: ['common'] -}; + interpolation: { + escapeValue: false + } +}); + +supportedLngs.forEach((lang) => { + i18n.addResourceBundle(lang, 'common', require(`/public/locales/${lang}/common.json`)); +}); + +export default i18n; diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx index 03131caf6..5e517c059 100644 --- a/apps/web/pages/_app.tsx +++ b/apps/web/pages/_app.tsx @@ -11,12 +11,11 @@ import { ThemeProvider } from 'next-themes'; import type { AppProps } from 'next/app'; import Head from 'next/head'; import Script from 'next/script'; -import { appWithI18Next } from 'ni18n'; +import { I18nextProvider } from 'react-i18next'; import { SkeletonTheme } from 'react-loading-skeleton'; import { RecoilRoot } from 'recoil'; import { JitsuAnalytics } from '../lib/components/services/jitsu-analytics'; -import { ni18nConfig } from '../ni18n.config'; - +import i18n from '../ni18n.config'; const MyApp = ({ Component, pageProps }: AppProps) => { const isJitsuEnvsPresent = jitsuConfiguration.host && jitsuConfiguration.writeKey; return ( @@ -47,10 +46,12 @@ const MyApp = ({ Component, pageProps }: AppProps) => { - - - - + + + + + + @@ -59,4 +60,4 @@ const MyApp = ({ Component, pageProps }: AppProps) => { ); }; -export default appWithI18Next(MyApp, ni18nConfig); +export default MyApp; diff --git a/yarn.lock b/yarn.lock index 665121aa7..593bfa1ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5095,7 +5095,7 @@ lodash.merge "^4.6.2" postcss-selector-parser "6.0.10" -"@tanstack/react-table@8.10.7": +"@tanstack/react-table@^8.10.7": version "8.10.7" resolved "https://registry.yarnpkg.com/@tanstack/react-table/-/react-table-8.10.7.tgz#733f4bee8cf5aa19582f944dd0fd3224b21e8c94" integrity sha512-bXhjA7xsTcsW8JPTTYlUg/FuBpn8MNjiEPhkNhIGCUR6iRQM2+WEco4OBpvDeVcR9SE+bmWLzdfiY7bCbCSVuA==