import React from "react";
import { useTranslation } from "react-i18next";

interface SafeTranslationProviderProps {
  children: React.ReactNode;
}

export const SafeTranslationProvider: React.FC<SafeTranslationProviderProps> = ({ children }) => {
  return <>{children}</>;
};

// Хук для безопасного использования переводов
export const useSafeTranslation = () => {
  const { t } = useTranslation();

  const safeT = (key: string, options?: any) => {
    try {
      return t(key, options);
    } catch (error) {
      console.warn("Translation error:", error);
      return key;
    }
  };

  return { t: safeT };
};
