import { useTranslation as useI18nTranslation } from 'react-i18next';
import { useUIStore } from '@/stores/ui';

export function useTranslation() {
  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,
  };
}
