Arreglo de idiomas en producción
This commit is contained in:
parent
07e873bb36
commit
c02adef593
@ -15,13 +15,11 @@ import { getAppRouter } from "./routes";
|
|||||||
|
|
||||||
import "./app.css";
|
import "./app.css";
|
||||||
|
|
||||||
import { initI18Next } from "@repo/i18next";
|
import { i18n } from "@repo/i18next";
|
||||||
|
|
||||||
export const App = () => {
|
export const App = () => {
|
||||||
DineroFactory.globalLocale = "es-ES";
|
DineroFactory.globalLocale = "es-ES";
|
||||||
|
|
||||||
const i18n = initI18Next();
|
|
||||||
|
|
||||||
const queryClient = new QueryClient({
|
const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: {
|
queries: {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { registerTranslations } from "@repo/i18next";
|
import { i18n, registerTranslations } from "@repo/i18next";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
||||||
|
|
||||||
@ -22,10 +22,6 @@ const ensureModuleTranslations = () => {
|
|||||||
* - Devuelve el hook react-i18next con namespace.
|
* - Devuelve el hook react-i18next con namespace.
|
||||||
*/
|
*/
|
||||||
export const useTranslation = () => {
|
export const useTranslation = () => {
|
||||||
// Hook base, sin namespace
|
|
||||||
const base = useI18NextTranslation();
|
|
||||||
const { i18n } = base;
|
|
||||||
|
|
||||||
// Asegura los bundles del módulo al montar (idempotente)
|
// Asegura los bundles del módulo al montar (idempotente)
|
||||||
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -33,5 +29,7 @@ export const useTranslation = () => {
|
|||||||
}, [i18n]);
|
}, [i18n]);
|
||||||
|
|
||||||
// Hook con namespace
|
// Hook con namespace
|
||||||
return useI18NextTranslation(MODULE_NAME);
|
return useI18NextTranslation(MODULE_NAME, {
|
||||||
|
i18n,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { registerTranslations } from "@repo/i18next";
|
import { i18n, registerTranslations } from "@repo/i18next";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ import { MODULE_NAME } from "./manifest";
|
|||||||
/**
|
/**
|
||||||
* Registra dinámicamente las traducciones del módulo.
|
* Registra dinámicamente las traducciones del módulo.
|
||||||
*/
|
*/
|
||||||
const ensureModuleTranslations = () => {
|
export const ensureModuleTranslations = () => {
|
||||||
registerTranslations(MODULE_NAME, "en", enResources);
|
registerTranslations(MODULE_NAME, "en", enResources);
|
||||||
registerTranslations(MODULE_NAME, "es", esResources);
|
registerTranslations(MODULE_NAME, "es", esResources);
|
||||||
};
|
};
|
||||||
@ -22,10 +22,6 @@ const ensureModuleTranslations = () => {
|
|||||||
* - Devuelve el hook react-i18next con namespace.
|
* - Devuelve el hook react-i18next con namespace.
|
||||||
*/
|
*/
|
||||||
export const useTranslation = () => {
|
export const useTranslation = () => {
|
||||||
// Hook base, sin namespace
|
|
||||||
const base = useI18NextTranslation();
|
|
||||||
const { i18n } = base;
|
|
||||||
|
|
||||||
// Asegura los bundles del módulo al montar (idempotente)
|
// Asegura los bundles del módulo al montar (idempotente)
|
||||||
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -33,5 +29,7 @@ export const useTranslation = () => {
|
|||||||
}, [i18n]);
|
}, [i18n]);
|
||||||
|
|
||||||
// Hook con namespace
|
// Hook con namespace
|
||||||
return useI18NextTranslation(MODULE_NAME);
|
return useI18NextTranslation(MODULE_NAME, {
|
||||||
|
i18n,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -20,7 +20,8 @@ import { useIssuedInvoiceListPageController } from "../../controllers";
|
|||||||
import { IssuedInvoicesGrid, useIssuedInvoicesGridColumns } from "../blocks";
|
import { IssuedInvoicesGrid, useIssuedInvoicesGridColumns } from "../blocks";
|
||||||
|
|
||||||
export const IssuedInvoiceListPage = () => {
|
export const IssuedInvoiceListPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const {
|
const {
|
||||||
listCtrl,
|
listCtrl,
|
||||||
@ -55,6 +56,8 @@ export const IssuedInvoiceListPage = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(i18n.store);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppHeader>
|
<AppHeader>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { registerTranslations } from "@repo/i18next";
|
import { i18n, registerTranslations } from "@repo/i18next";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
||||||
|
|
||||||
@ -22,10 +22,6 @@ const ensureModuleTranslations = () => {
|
|||||||
* - Devuelve el hook react-i18next con namespace.
|
* - Devuelve el hook react-i18next con namespace.
|
||||||
*/
|
*/
|
||||||
export const useTranslation = () => {
|
export const useTranslation = () => {
|
||||||
// Hook base, sin namespace
|
|
||||||
const base = useI18NextTranslation();
|
|
||||||
const { i18n } = base;
|
|
||||||
|
|
||||||
// Asegura los bundles del módulo al montar (idempotente)
|
// Asegura los bundles del módulo al montar (idempotente)
|
||||||
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -33,5 +29,7 @@ export const useTranslation = () => {
|
|||||||
}, [i18n]);
|
}, [i18n]);
|
||||||
|
|
||||||
// Hook con namespace
|
// Hook con namespace
|
||||||
return useI18NextTranslation(MODULE_NAME);
|
return useI18NextTranslation(MODULE_NAME, {
|
||||||
|
i18n,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { registerTranslations } from "@repo/i18next";
|
import { i18n, registerTranslations } from "@repo/i18next";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
||||||
|
|
||||||
@ -22,10 +22,6 @@ const ensureModuleTranslations = () => {
|
|||||||
* - Devuelve el hook react-i18next con namespace.
|
* - Devuelve el hook react-i18next con namespace.
|
||||||
*/
|
*/
|
||||||
export const useTranslation = () => {
|
export const useTranslation = () => {
|
||||||
// Hook base, sin namespace
|
|
||||||
const base = useI18NextTranslation();
|
|
||||||
const { i18n } = base;
|
|
||||||
|
|
||||||
// Asegura los bundles del módulo al montar (idempotente)
|
// Asegura los bundles del módulo al montar (idempotente)
|
||||||
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -33,5 +29,7 @@ export const useTranslation = () => {
|
|||||||
}, [i18n]);
|
}, [i18n]);
|
||||||
|
|
||||||
// Hook con namespace
|
// Hook con namespace
|
||||||
return useI18NextTranslation(PACKAGE_NAME);
|
return useI18NextTranslation(PACKAGE_NAME, {
|
||||||
|
i18n,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user