diff --git a/frontend/src/components/Shared/GoogleTranslate.jsx b/frontend/src/components/Shared/GoogleTranslate.jsx
deleted file mode 100644
index 8ba941fe..00000000
--- a/frontend/src/components/Shared/GoogleTranslate.jsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import React, { useEffect } from "react";
-
-const GoogleTranslate = () => {
- useEffect(() => {
- let retryCount = 0;
- const maxRetries = 50; // Adjust as needed
-
- window.googleTranslateInit = () => {
- if (!window.google?.translate?.TranslateElement) {
- if (retryCount < maxRetries) {
- retryCount++;
- } else {
- console.error('Failed to initialize Google Translate after maximum retries.');
- }
- setTimeout(window.googleTranslateInit, 100);
- } else {
- new window.google.translate.TranslateElement({
- pageLanguage: 'en',
- includedLanguages: 'en,hi,pa,sa,mr,ur,bn,es,ja,ko,zh-CN,nl,fr,de,it,ta,te',
- layout: window.google.translate.TranslateElement.InlineLayout.VERTICAL,
- defaultLanguage: 'en',
- autoDisplay: false,
- }, 'google_element');
- }
- };
-
- const loadGoogleTranslateScript = () => {
- if (!document.getElementById("google_translate_script")) {
- const script = document.createElement("script");
- script.type = "text/javascript";
- script.src = "https://translate.google.com/translate_a/element.js?cb=googleTranslateInit";
- script.id = "google_translate_script";
- script.onerror = () => console.error('Error loading Google Translate script');
- document.body.appendChild(script);
- }
- };
-
- loadGoogleTranslateScript();
-
- if (window.google?.translate) {
- window.googleTranslateInit();
- }
-
- return () => {
- // Cleanup logic if necessary
- };
- }, []);
-
- return (
-
-
-
- );
-};
-
-export default GoogleTranslate;
\ No newline at end of file
diff --git a/frontend/src/components/Shared/footer/Content.jsx b/frontend/src/components/Shared/footer/Content.jsx
index d3b8a8e0..fbf0e7d2 100644
--- a/frontend/src/components/Shared/footer/Content.jsx
+++ b/frontend/src/components/Shared/footer/Content.jsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import Logo from '../../../assets/Logo/playcafe.png';
import googleImage from '../../../assets/img/google.png';
import { FaFacebook, FaInstagram, FaTiktok, FaGithub } from 'react-icons/fa';
-import GoogleTranslate from '../GoogleTranslate';
+import Google from './Google';
export default function Content() {
return (
@@ -38,9 +38,8 @@ const Section2 = () => {
)}
{
className="w-[2rem] h-[2rem] mr-[65px]"
/>
*/}
-
+
);
diff --git a/frontend/src/components/Shared/footer/Google.jsx b/frontend/src/components/Shared/footer/Google.jsx
new file mode 100644
index 00000000..33443e9b
--- /dev/null
+++ b/frontend/src/components/Shared/footer/Google.jsx
@@ -0,0 +1,148 @@
+import React, { useEffect } from "react";
+
+const Google = () => {
+ useEffect(() => {
+ window.GoogleInit = () => {
+ if (!window.google?.translate?.TranslateElement) {
+ setTimeout(window.GoogleInit, 100);
+ } else {
+ new window.google.translate.TranslateElement({
+ pageLanguage: 'en',
+ includedLanguages: 'en,hi,ur,es,ja,ko,zh-CN,nl,fr,de,it,ta,te,ru,ar,pt,th',
+ layout: window.google.translate.TranslateElement.InlineLayout.HORIZONTAL,
+ defaultLanguage: 'en',
+ autoDisplay: false,
+ }, 'google_element');
+ }
+ cleanUpGadgetText();
+ };
+
+ const loadGoogleScript = () => {
+ if (!document.getElementById("google_translate_script")) {
+ const script = document.createElement("script");
+ script.type = "text/javascript";
+ script.src = "https://translate.google.com/translate_a/element.js?cb=GoogleInit";
+ script.id = "google_translate_script";
+ script.onerror = () => console.error('Error loading Google Translate script');
+ document.body.appendChild(script);
+ }
+
+ };
+ const cleanUpGadgetText = () => {
+ const gadgetElement = document.querySelector('.goog-te-gadget');
+ if (gadgetElement) {
+ const textNodes = gadgetElement.childNodes;
+ textNodes.forEach((node) => {
+ if (node.nodeType === Node.TEXT_NODE) {
+ node.textContent = ''; // Clear text content
+ }
+ });
+ }
+ };
+ loadGoogleScript();
+
+ if (window.google && window.google.translate) {
+ window.GoogleInit();
+ }
+
+ return () => {
+ // Cleanup logic if necessary
+ };
+ }, []);
+
+ return (
+
+
+
+ );
+};
+
+export default Google;