Skip to content

Commit

Permalink
fix: [internationalization] the translation object keys are visible f…
Browse files Browse the repository at this point in the history
…or a brief time
  • Loading branch information
NdekoCode committed Oct 26, 2023
1 parent 53d03c5 commit ce28252
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
Empty file removed apps/web/i18next.d.ts
Empty file.
15 changes: 0 additions & 15 deletions apps/web/next-i18next.config.js

This file was deleted.

22 changes: 19 additions & 3 deletions apps/web/ni18n.config.ts
Original file line number Diff line number Diff line change
@@ -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'];

Check warning on line 4 in apps/web/ni18n.config.ts

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Lngs)
export const ni18nConfig = {

i18n.use(initReactI18next).init({
lng: 'en',
fallbackLng: 'en',
ns: ['common'],
defaultNS: 'common',
supportedLngs,

Check warning on line 11 in apps/web/ni18n.config.ts

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Lngs)
ns: ['common']
};
interpolation: {
escapeValue: false
}
});

supportedLngs.forEach((lang) => {

Check warning on line 17 in apps/web/ni18n.config.ts

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Lngs)
i18n.addResourceBundle(lang, 'common', require(`/public/locales/${lang}/common.json`));
});

export default i18n;
17 changes: 9 additions & 8 deletions apps/web/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Check warning on line 17 in apps/web/pages/_app.tsx

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Jitsu)
import { ni18nConfig } from '../ni18n.config';

import i18n from '../ni18n.config';
const MyApp = ({ Component, pageProps }: AppProps) => {
const isJitsuEnvsPresent = jitsuConfiguration.host && jitsuConfiguration.writeKey;
return (
Expand Down Expand Up @@ -47,10 +46,12 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
<RecoilRoot>
<ThemeProvider attribute="class">
<SkeletonTheme baseColor="#F0F0F0" enableAnimation={false}>
<AppState />
<JitsuAnalytics user={pageProps?.user} />
<ChatwootWidget />
<Component {...pageProps} />
<I18nextProvider i18n={i18n}>
<AppState />
<JitsuAnalytics user={pageProps?.user} />
<ChatwootWidget />
<Component {...pageProps} />
</I18nextProvider>
</SkeletonTheme>
</ThemeProvider>
</RecoilRoot>
Expand All @@ -59,4 +60,4 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
</>
);
};
export default appWithI18Next(MyApp, ni18nConfig);
export default MyApp;
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5095,7 +5095,7 @@
lodash.merge "^4.6.2"
postcss-selector-parser "6.0.10"

"@tanstack/[email protected]":
"@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==
Expand Down

0 comments on commit ce28252

Please sign in to comment.