Reputation: 51
How can I modify this code to translate the only one container on page with id #lyrics?
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'ru', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false, multilanguagePage: true}, 'google_translate_element');
}
</script>
Upvotes: 1
Views: 6194
Reputation: 61
you can add class call notranslate into the body or the meta tag of the class then add the class translate into the div whom you want to translate its poor approach but it sure do you wok e.g
<body class="notranslate">
<h1>no translate paragraph</h1>
<h1 class="translate"> i want to translate the line</h1>
</body>
Upvotes: 6
Reputation: 51
Solved with this function:
function googleSectionalElementInit() {
new google.translate.SectionalElement({
sectionalNodeClassName: 'lyrics',
controlNodeClassName: 'translate-lyrics',
background: 'trasparent'
}, 'google_sectional_element');
}
Upvotes: 1