The code allows users to translate the page content into selected languages. The function googleTranslateElementInit initializes the Google Translate widget with predefined languages, making it easy to implement multilingual support.
Our Site Testing Link : https://trinitedigital.com/features/googletranslate/ and https://trinitedigital.com/features/googletranslate/googletranslate.php
<!DOCTYPE html>
<html>
<style> <!-- Use this style to customize the appearance of the Google Translate widget and make it blend seamlessly with your webpage design. It hides unnecessary elements and styles the language dropdown for a better user experience. -->
.skiptranslate {
display: none;
}
.goog-te-gadget {
display: block !important;
}
.VIpgJd-ZVi9od-l4eHX-hSRGPd {
display: none;
}
.goog-te-combo {
display: block;
height: 40px;
padding: 0.375rem 0.75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: 0.25rem;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
/*position: absolute;*/
color: #071251;
}
#google_translate_element {
margin-top: 0 ;
margin-right:100px ;
}
}
</style>
<body>
<h1>My Google Translate</h1>
<div id="google_translate_element"></div>
<p>Good morning! This is a test paragraph designed to check the accuracy and effectiveness of the Google Translate tool. It contains various types of sentences, including questions, exclamations, and regular statements. How well can Google Translate maintain the meaning of this paragraph when converted into different languages? Let's find out!</p>
<script>
function googleTranslateElementInit() {
// new google.translate.TranslateElement({ pageLanguage: 'en', includedLanguages: 'es,fr,de,ja,ta,en,hi,zh,ar,bn,ru,pt,ur,sw,ko,it',
// autoDisplay: false }
new google.translate.TranslateElement({ pageLanguage: 'en', includedLanguages: 'es,fr,ta,en,hi',
autoDisplay: false }
, 'google_translate_element');
}
</script>
<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</body>
<html>
