FactuGES_ERP/packages/rdx-ui/src/locales/i18n.ts

15 lines
536 B
TypeScript
Raw Normal View History

2025-07-08 18:50:08 +00:00
import i18next from "i18next";
import { useTranslation as useTrans } from "react-i18next";
import { PACKAGE_NAME } from "../index.ts";
import enResources from "./en.json" with { type: "json" };
import esResources from "./es.json" with { type: "json" };
export const useTranslation = () => {
if (!i18next.hasLoadedNamespace(PACKAGE_NAME)) {
i18next.addResourceBundle("en", PACKAGE_NAME, enResources, true, true);
i18next.addResourceBundle("es", PACKAGE_NAME, esResources, true, true);
}
return useTrans(PACKAGE_NAME);
};