diff --git a/src/components/Footer/Footer.jsx b/src/components/Footer/Footer.jsx index 0393d07..24659e8 100644 --- a/src/components/Footer/Footer.jsx +++ b/src/components/Footer/Footer.jsx @@ -1,8 +1,34 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import img from '../../assets/logo_white.png'; function Footer() { const currentYear = new Date().getFullYear(); + + useEffect(() => { + const script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = 'https://translate.google.com/translate_a/element.js?cb=loadGoogleTranslate'; + script.onerror = function () { + console.error('Error loading Google Translate script'); + }; + document.body.appendChild(script); + + window.loadGoogleTranslate = function () { + new window.google.translate.TranslateElement( + { + pageLanguage: 'en', + includedLanguages: 'en,hi,pa,sa,mr,ur,bn,es,fr,de,it', + layout: window.google.translate.TranslateElement.InlineLayout.SIMPLE, + }, + 'google_element' + ); + }; + + return () => { + document.body.removeChild(script); + }; + }, []); + return (
); diff --git a/src/components/Navbar/Navbar.jsx b/src/components/Navbar/Navbar.jsx index 02e031b..a6e6510 100644 --- a/src/components/Navbar/Navbar.jsx +++ b/src/components/Navbar/Navbar.jsx @@ -99,29 +99,6 @@ function Navbar() { } }; - useEffect(() => { - const loadGoogleTranslate = () => { - new window.google.translate.TranslateElement( - { - pageLanguage: 'en', - includedLanguages: 'en,hi,pa,sa,mr,ur,bn,es,fr,de,it', - layout: window.google.translate.TranslateElement.InlineLayout.SIMPLE, - }, - 'google_element' - ); - }; - - const script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = 'https://translate.google.com/translate_a/element.js?cb=loadGoogleTranslate'; - script.onerror = () => console.error('Error loading Google Translate script'); - document.body.appendChild(script); - - return () => { - document.body.removeChild(script); - }; - }, []); - return (