From a6ec09283cb2f4ad227678edb0e006de40ee27fb Mon Sep 17 00:00:00 2001 From: "Ibrahima G. Coulibaly" Date: Mon, 14 Jul 2025 19:38:46 +0100 Subject: [PATCH] fix: i18n.ts --- src/i18n/index.ts | 42 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 03582b4..63ff50a 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -2,26 +2,6 @@ import i18n, { ParseKeys } from 'i18next'; import { initReactI18next } from 'react-i18next'; import Backend from 'i18next-http-backend'; -const isDevelopment = !import.meta.env.PROD; -const isContributor = import.meta.env.VITE_CONTRIBUTOR_MODE === 'true'; - -const useLocize = isDevelopment && isContributor; -if (useLocize) { - const { default: LocizeBackend } = await import('i18next-locize-backend'); - i18n.use(LocizeBackend); - console.log('Using Locize backend in development/contributor mode'); -} else { - // Use static files in production - i18n.use(Backend); -} - -const locizeOptions = { - projectId: 'e7156a3e-66fb-4035-a0f0-cebf1c63a3ba', - apiKey: import.meta.env.LOCIZE_API_KEY, - referenceLng: 'en', - version: 'latest' -}; - export const validNamespaces: string[] = [ 'string', 'number', @@ -41,17 +21,15 @@ export type FullI18nKey = { [K in I18nNamespaces]: `${K}:${ParseKeys}`; }[I18nNamespaces]; -i18n.use(initReactI18next).init({ - lng: localStorage.getItem('lang') || 'en', - fallbackLng: 'en', - debug: false, - backend: useLocize - ? locizeOptions - : { - loadPath: '/locales/{{lng}}/{{ns}}.json' - }, - saveMissing: useLocize, - updateMissing: useLocize -}); +i18n + .use(Backend) + .use(initReactI18next) + .init({ + lng: localStorage.getItem('lang') || 'en', + fallbackLng: 'en', + backend: { + loadPath: '/locales/{{lng}}/{{ns}}.json' + } + }); export default i18n;