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>
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>
Share
Improve this question
edited Jul 27, 2014 at 17:14
Kartikeya Khosla
18.9k8 gold badges45 silver badges70 bronze badges
asked Jul 27, 2014 at 17:06
Jason ColeJason Cole
511 silver badge10 bronze badges
3
- ok, I'm replace 'google_translate_element' to 'lyrics', but I have the same result – Jason Cole Commented Jul 27, 2014 at 17:17
- Sorry. Take a look at this answer. – Halvor Holsten Strand Commented Jul 27, 2014 at 17:22
- I've seen this answer, but I can't apply this to my code, can you help me with this? – Jason Cole Commented Jul 27, 2014 at 17:25
2 Answers
Reset to default 6you 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>
Solved with this function:
function googleSectionalElementInit() {
new google.translate.SectionalElement({
sectionalNodeClassName: 'lyrics',
controlNodeClassName: 'translate-lyrics',
background: 'trasparent'
}, 'google_sectional_element');
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742369087a4430895.html
评论列表(0条)