
// import React, { useEffect } from 'react';

// const Translator = () => {
//   useEffect(() => {
//     const script = document.createElement('script');
//     script.src = "https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
//     document.body.appendChild(script);

//     window.googleTranslateElementInit = () => {
//       new window.google.translate.TranslateElement({
//         pageLanguage: 'en',
//         includedLanguages: 'en,bn',
//         // layout: window.google.translate.TranslateElement.InlineLayout.SIMPLE
//       }, 'google_translate_element');
//     };

//     return () => {
//       document.body.removeChild(script);
//     };
//   }, []);

//   return (
//     <div>
//       <div id="google_translate_element" className='w-92'></div>
//     </div>
//   );
// };

// export default Translator;


import React, { useEffect } from 'react';

const Translator = () => {
  useEffect(() => {
    const script = document.createElement('script');
    script.src = "https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
    document.body.appendChild(script);

    window.googleTranslateElementInit = () => {
      new window.google.translate.TranslateElement({
        pageLanguage: 'en',
        includedLanguages: 'en,bn',
        layout: window.google.translate.TranslateElement.InlineLayout.HORIZONTAL
      }, 'google_translate_element');
    };

    return () => {
      document.body.removeChild(script);
    };
  }, []);

  return (
    <div>
      <div id="google_translate_element" ></div>
    </div>
  );
};

export default Translator;

