diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsx index 1f20ba68..8c2475a1 100644 --- a/apps/web/src/app.tsx +++ b/apps/web/src/app.tsx @@ -15,13 +15,11 @@ import { getAppRouter } from "./routes"; import "./app.css"; -import { initI18Next } from "@repo/i18next"; +import { i18n } from "@repo/i18next"; export const App = () => { DineroFactory.globalLocale = "es-ES"; - const i18n = initI18Next(); - const queryClient = new QueryClient({ defaultOptions: { queries: { diff --git a/modules/core/src/web/i18n.ts b/modules/core/src/web/i18n.ts index 2d20799d..21d362ec 100644 --- a/modules/core/src/web/i18n.ts +++ b/modules/core/src/web/i18n.ts @@ -1,4 +1,4 @@ -import { registerTranslations } from "@repo/i18next"; +import { i18n, registerTranslations } from "@repo/i18next"; import { useEffect } from "react"; import { useTranslation as useI18NextTranslation } from "react-i18next"; @@ -22,10 +22,6 @@ const ensureModuleTranslations = () => { * - Devuelve el hook react-i18next con namespace. */ export const useTranslation = () => { - // Hook base, sin namespace - const base = useI18NextTranslation(); - const { i18n } = base; - // Asegura los bundles del módulo al montar (idempotente) // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { @@ -33,5 +29,7 @@ export const useTranslation = () => { }, [i18n]); // Hook con namespace - return useI18NextTranslation(MODULE_NAME); + return useI18NextTranslation(MODULE_NAME, { + i18n, + }); }; diff --git a/modules/customer-invoices/src/web/i18n.ts b/modules/customer-invoices/src/web/i18n.ts index 2d20799d..912e3eee 100644 --- a/modules/customer-invoices/src/web/i18n.ts +++ b/modules/customer-invoices/src/web/i18n.ts @@ -1,4 +1,4 @@ -import { registerTranslations } from "@repo/i18next"; +import { i18n, registerTranslations } from "@repo/i18next"; import { useEffect } from "react"; import { useTranslation as useI18NextTranslation } from "react-i18next"; @@ -10,7 +10,7 @@ import { MODULE_NAME } from "./manifest"; /** * Registra dinámicamente las traducciones del módulo. */ -const ensureModuleTranslations = () => { +export const ensureModuleTranslations = () => { registerTranslations(MODULE_NAME, "en", enResources); registerTranslations(MODULE_NAME, "es", esResources); }; @@ -22,10 +22,6 @@ const ensureModuleTranslations = () => { * - Devuelve el hook react-i18next con namespace. */ export const useTranslation = () => { - // Hook base, sin namespace - const base = useI18NextTranslation(); - const { i18n } = base; - // Asegura los bundles del módulo al montar (idempotente) // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { @@ -33,5 +29,7 @@ export const useTranslation = () => { }, [i18n]); // Hook con namespace - return useI18NextTranslation(MODULE_NAME); + return useI18NextTranslation(MODULE_NAME, { + i18n, + }); }; diff --git a/modules/customer-invoices/src/web/issued-invoices/list/ui/pages/issued-invoice-list-page.tsx b/modules/customer-invoices/src/web/issued-invoices/list/ui/pages/issued-invoice-list-page.tsx index 0c120e4b..8495256c 100644 --- a/modules/customer-invoices/src/web/issued-invoices/list/ui/pages/issued-invoice-list-page.tsx +++ b/modules/customer-invoices/src/web/issued-invoices/list/ui/pages/issued-invoice-list-page.tsx @@ -20,7 +20,8 @@ import { useIssuedInvoiceListPageController } from "../../controllers"; import { IssuedInvoicesGrid, useIssuedInvoicesGridColumns } from "../blocks"; export const IssuedInvoiceListPage = () => { - const { t } = useTranslation(); + const { t, i18n } = useTranslation(); + const navigate = useNavigate(); const { listCtrl, @@ -55,6 +56,8 @@ export const IssuedInvoiceListPage = () => { ); } + console.log(i18n.store); + return ( <> diff --git a/modules/customers/src/web/i18n.ts b/modules/customers/src/web/i18n.ts index 2d20799d..21d362ec 100644 --- a/modules/customers/src/web/i18n.ts +++ b/modules/customers/src/web/i18n.ts @@ -1,4 +1,4 @@ -import { registerTranslations } from "@repo/i18next"; +import { i18n, registerTranslations } from "@repo/i18next"; import { useEffect } from "react"; import { useTranslation as useI18NextTranslation } from "react-i18next"; @@ -22,10 +22,6 @@ const ensureModuleTranslations = () => { * - Devuelve el hook react-i18next con namespace. */ export const useTranslation = () => { - // Hook base, sin namespace - const base = useI18NextTranslation(); - const { i18n } = base; - // Asegura los bundles del módulo al montar (idempotente) // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { @@ -33,5 +29,7 @@ export const useTranslation = () => { }, [i18n]); // Hook con namespace - return useI18NextTranslation(MODULE_NAME); + return useI18NextTranslation(MODULE_NAME, { + i18n, + }); }; diff --git a/packages/rdx-ui/src/locales/i18n.ts b/packages/rdx-ui/src/locales/i18n.ts index f79b0602..db638e4e 100644 --- a/packages/rdx-ui/src/locales/i18n.ts +++ b/packages/rdx-ui/src/locales/i18n.ts @@ -1,4 +1,4 @@ -import { registerTranslations } from "@repo/i18next"; +import { i18n, registerTranslations } from "@repo/i18next"; import { useEffect } from "react"; import { useTranslation as useI18NextTranslation } from "react-i18next"; @@ -22,10 +22,6 @@ const ensureModuleTranslations = () => { * - Devuelve el hook react-i18next con namespace. */ export const useTranslation = () => { - // Hook base, sin namespace - const base = useI18NextTranslation(); - const { i18n } = base; - // Asegura los bundles del módulo al montar (idempotente) // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { @@ -33,5 +29,7 @@ export const useTranslation = () => { }, [i18n]); // Hook con namespace - return useI18NextTranslation(PACKAGE_NAME); + return useI18NextTranslation(PACKAGE_NAME, { + i18n, + }); };