- Introduced `es.json` for Spanish translations in account management. - Created account routes and controllers for managing user accounts. - Implemented hooks and API calls for fetching and updating account profiles. - Developed forms and validation schemas for account profile and password management. - Added error handling and feedback mechanisms for account actions. - Built UI components for account settings page, including password change dialog. - Integrated translations for new UI components and error messages.
25 lines
762 B
TypeScript
25 lines
762 B
TypeScript
import { i18n, registerTranslations } from "@repo/i18next";
|
|
import { useEffect } from "react";
|
|
import { useTranslation as useI18NextTranslation } from "react-i18next";
|
|
|
|
import enResources from "../common/locales/en.json";
|
|
import esResources from "../common/locales/es.json";
|
|
|
|
import { MODULE_NAME } from "./manifest";
|
|
|
|
export const ensureModuleTranslations = () => {
|
|
registerTranslations(MODULE_NAME, "en", enResources);
|
|
registerTranslations(MODULE_NAME, "es", esResources);
|
|
};
|
|
|
|
export const useTranslation = () => {
|
|
// biome-ignore lint/correctness/useExhaustiveDependencies: registro idempotente del namespace del módulo
|
|
useEffect(() => {
|
|
ensureModuleTranslations();
|
|
}, [i18n]);
|
|
|
|
return useI18NextTranslation(MODULE_NAME, {
|
|
i18n,
|
|
});
|
|
};
|