-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cd7f60
commit 73d43e4
Showing
3 changed files
with
99 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
body { | ||
top: 0 !important; | ||
} | ||
|
||
font { | ||
background-color: transparent !important; | ||
box-shadow: none !important; | ||
} | ||
|
||
.google-translate-container { | ||
display: flex; | ||
align-items: center; | ||
margin-left: 30px; | ||
} | ||
|
||
.goog-logo-link, | ||
.goog-te-banner-frame, | ||
.VIpgJd-ZVi9od-l4eHX-hSRGPd, | ||
.VIpgJd-ZVi9od-aZ2wEe, | ||
.VIpgJd-ZVi9od-ORHb-OEVmcd { | ||
display: none !important; | ||
} | ||
|
||
.goog-te-gadget { | ||
color: transparent !important; | ||
} | ||
|
||
.goog-te-gadget .goog-te-combo { | ||
background-color: transparent !important; | ||
color: black !important; | ||
font-size: 15px; | ||
border: 1px solid black; | ||
padding: 5px; | ||
} | ||
|
||
.goog-te-gadget .goog-te-combo option { | ||
color: black; | ||
} | ||
|
||
#goog-gt-tt, .goog-te-balloon-frame{ | ||
display: none !important; | ||
} | ||
|
||
.goog-text-highlight { | ||
background: none !important; | ||
box-shadow: none !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { useEffect } from "react"; | ||
import "../Translator/Translator.css"; | ||
|
||
const Translate = () => { | ||
useEffect(() => { | ||
window.googleTranslateInit = () => { | ||
if (!window.google.translate.TranslateElement) { | ||
setTimeout(window.googleTranslateInit, 100); | ||
} else { | ||
new window.google.translate.TranslateElement({ | ||
pageLanguage: 'en', | ||
includedLanguages: 'en,hi,pa,sa,ur,bn,es,ja,ko,zh-CN,es,fr,de,it,ta,te', | ||
layout: window.google.translate.TranslateElement.InlineLayout.HORIZONTAL, | ||
defaultLanguage: 'en', | ||
}, '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 && window.google.translate) { | ||
window.googleTranslateInit(); | ||
} | ||
}, []); | ||
|
||
return <div id="google_element" className="google-translate-container"></div>; | ||
}; | ||
|
||
export default Translate; |