Author Topic: Google Translate icon does not appear on pages  (Read 67 times)

Hangar

  • Confirmed Member
  • **
  • Posts: 15
  • Karma: +0/-0
Google Translate icon does not appear on pages
« on: February 24, 2017, 08:30:07 PM »
Hello all!

Again with the language options, I have read this topic and followed guidance in http://forum.datemill.com/index.php?topic=4788.0 in order to use Google Translate on my web pages. However, what I've got is simply the scripts below without meta tag from Google:

<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', multilanguagePage: true}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Would you please help with this! (I am using the latest Etano 2.40).

Many thanks.

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 2883
  • Karma: +210/-7
    • Maverick Webworks
Re: Google Translate icon does not appear on pages
« Reply #1 on: February 25, 2017, 11:37:11 AM »
Well you must put the translation code where you want it appear on the pages. The most logical place would be in the header.

You'll need to add the code in the index.html, frame.html and the frame_general.html files.

Locate the header_body div tag and the logo-box div tag and add the google translate code in between them, like this:
Code: [Select]
<div id="header-body">
 
<!---GOOGLE TRANSLATE STARTS HERE--->

<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', multilanguagePage: true}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

<!---GOOGLE TRANSLATE ENDS HERE--->

<div id="logo-box">

Then you'll need to position the google translate menu in the header using some CSS.

Open the skins_site/def/styles/header.css file and include the following code (it can be added anywhere, such as the top or bottom of the file):
Code: [Select]
#google_translate_element {
position: absolute;
top: 75px;
left: 780px;
}


Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

Hangar

  • Confirmed Member
  • **
  • Posts: 15
  • Karma: +0/-0
Re: Google Translate icon does not appear on pages
« Reply #2 on: February 25, 2017, 10:31:20 PM »
Thank you Maverick!

It's always a perfect solution. It works well now with more than 100 languages. Though Google Translate sometimes does not translate as we expect but it's really useful.

Kind regards