2025-12-03 21:56:50 +00:00
|
|
|
import { useTranslation as useI18nTranslation } from 'react-i18next';
|
|
|
|
|
import { useUIStore } from '@/stores/ui';
|
2025-12-25 13:57:57 +00:00
|
|
|
import type { UseTranslationReturn } from './types';
|
2025-12-03 21:56:50 +00:00
|
|
|
|
2025-12-25 13:57:57 +00:00
|
|
|
/**
|
|
|
|
|
* Hook pour gérer les traductions
|
|
|
|
|
* FE-TYPE-012: Fully typed hook return
|
|
|
|
|
*/
|
|
|
|
|
export function useTranslation(): UseTranslationReturn {
|
2025-12-03 21:56:50 +00:00
|
|
|
const { i18n, t } = useI18nTranslation();
|
|
|
|
|
const { language, setLanguage } = useUIStore();
|
|
|
|
|
|
|
|
|
|
const changeLanguage = (newLanguage: 'en' | 'fr') => {
|
|
|
|
|
i18n.changeLanguage(newLanguage);
|
|
|
|
|
setLanguage(newLanguage);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
t,
|
|
|
|
|
i18n,
|
|
|
|
|
language,
|
|
|
|
|
changeLanguage,
|
|
|
|
|
isReady: i18n.isInitialized,
|
|
|
|
|
};
|
|
|
|
|
}
|