javascript - Automatically translate web page -
how can automatically translate web page when entered it.
this translator there connected dropdown.
<script type="text/javascript"> function googletranslateelementinit() { new google.translate.translateelement({pagelanguage: 'da', includedlanguages: 'da,de,el,en,es,fi,fr,it,ja,ko,nl,no,pl,ru,sv,uk,zh-cn,zh-tw', layout: google.translate.translateelement.floatposition.top_left, gatrack: true, gaid: 'ua-32978177-1'}, 'google_translate_element'); } </script> <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googletranslateelementinit"> </script>
i want translate automatically danish (da) english (en). have read function:
http://www.blabla.com/#googtrans(da|en)
where should implement it?
you need create div called google_translate_element mentioned in first script this:
<div id="google_translate_element"> here area google fetches part translated </div> <script type="text/javascript"> function googletranslateelementinit() { new google.translate.translateelement({pagelanguage: 'en', layout: google.translate.translateelement.floatposition.bottom_right, multilanguagepage: true}, 'google_translate_element'); } </script>
this second script generates nice tiny language selection :
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googletranslateelementinit"> </script>
and if wish hide resulting google translation bar (first script) :
<style> .goog-te-banner-frame.skiptranslate { display: none !important; } body { top: 0px !important; } .goog-tooltip { display: none !important; } .goog-tooltip:hover { display: none !important; } .goog-text-highlight { background-color: transparent !important; border: none !important; box-shadow: none !important; } </style>
Comments
Post a Comment