Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Doburpally on October 27, 2011, 07:34:55 PM

Title: Google Translate for SMF 2.0
Post by: Doburpally on October 27, 2011, 07:34:55 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3213)

Google Translate for SMF 2.0

Adds a language drop down to your forum powered by Google Translate.  It works for guests and logged users.

Compatibility:

Version History:
Title: Re: Google Translate for SMF 2.0
Post by: krash661 on October 27, 2011, 08:17:15 PM
I'm having problems installing it.



Installations actions for "Google Translate for SMF 2.0"
Installing this package will perform the following actions:
      Type    Action    Description
*    1.    Execute Modification    ./Themes/default/index.template.php    Test successful

Install in Other Themes
To use this modification in themes other than the default, the package manager needs to make additional changes to the other themes. If you'd like to install this modification in the other themes, please select these themes below.
      insidious
*       Execute Modification    ./Themes/Insidius2/index.template.php    Test failed
      1.    Add Before    ./Themes/Insidius2/index.template.php    Test failed
Title: Re: Google Translate for SMF 2.0
Post by: Bugo on October 28, 2011, 04:53:20 AM
@Reaper.CSF., you can replace this block

<script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en',
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, 'google_translate_element');
}
</script>

with:

<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: "' . $txt['lang_dictionary'] . '",
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, \'google_translate_element\');
}
</script>
Title: Re: Google Translate for SMF 2.0
Post by: Mick. on October 28, 2011, 03:36:20 PM
Nice to see someone took my tut and made it into a mod.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on October 28, 2011, 04:10:29 PM
Quote from: bluedevil on October 28, 2011, 03:36:20 PM
Nice to see someone took my tut and made it into a mod.

Actually my source was from Google translate site.

You have a tut? where? ???
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on October 28, 2011, 04:17:40 PM
Quote from: krash661 on October 27, 2011, 08:17:15 PM
I'm having problems installing it.



Installations actions for "Google Translate for SMF 2.0"
Installing this package will perform the following actions:
      Type    Action    Description
*    1.    Execute Modification    ./Themes/default/index.template.php    Test successful

Install in Other Themes
To use this modification in themes other than the default, the package manager needs to make additional changes to the other themes. If you'd like to install this modification in the other themes, please select these themes below.
      insidious
*       Execute Modification    ./Themes/Insidius2/index.template.php    Test failed
      1.    Add Before    ./Themes/Insidius2/index.template.php    Test failed

It seems that your custom themes are missing the // Show the navigation tree. line or it's reworded, meaning it's different to the default theme.
You can edit the index.template.php file for the custom themes or you can attach index.template.php file to your post and I will have a quick look for you.
I can then make the change so that you can install the mod ;)
to attach the file click on Attachments and other options link under the message body and then click on browse and select file, to submit click on save button ;)
Title: Re: Google Translate for SMF 2.0
Post by: Mick. on October 28, 2011, 05:45:07 PM
You kidding right?  Yes, google script is the same but it seems odd that you and me thought the exact same words and simple codes.

1. It works for guests and logged users.

2. <br />

3. <div align="right">

4. </div>

http://www.bluedevilcustoms.com/community/index.php/topic,173.0.html

http://www.simplemachines.org/community/index.php?topic=424328.0


thief.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on October 28, 2011, 11:38:02 PM
Quote from: bluedevil on October 28, 2011, 05:45:07 PM
1. It works for guests and logged users.

Um, any html / javascript you insert is seen by guest's / logged user's, unless you use php script to specify for admin's or moderator's etc.

Quote from: bluedevil on October 28, 2011, 05:45:07 PM
2. <br />

3. <div align="right">

4. </div>

Simple html codes, everyone knows them.  ???

I know for a fact that I have not visited your site, tbh I didn't know that you had a site ???
I suppose it's your word against mine.
Title: Re: Google Translate for SMF 2.0
Post by: traveler1 on October 30, 2011, 11:46:11 AM
I installed the mod and it said it installed in my theme correctly.
I can not see the option anywhere on my board.

I know I am missing something. But what ?

I cleared all the cache browser server etc.
Title: Re: Google Translate for SMF 2.0
Post by: 4Kstore on October 30, 2011, 03:39:35 PM
Quote from: traveler1 on October 30, 2011, 11:46:11 AM
I installed the mod and it said it installed in my theme correctly.
I can not see the option anywhere on my board.

I know I am missing something. But what ?

I cleared all the cache browser server etc.

If your forum is: enoughallready.com, The mod is not installed correctly, attach the file index.template.php of theme you are using
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on October 31, 2011, 10:11:26 PM
@Bugo

Thanks buddy, I have added your changes to the package ;)

@traveler1

The problem might be that you have not ticked your custom theme/s to apply the changes to during the installation of Google translate mod.

To fix this it is quite simple.
Go to Browse Packages in your Admin cp.
Click on Uninstall.
Once Uninstalled click on Browse Packages, then click on Install.
Tick all Custom theme/s that you may have. (see the pic below)
Now check to see if you can see Google Translate above the Link tree on the right hand side.

Please see this pic.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2Fpics%2FPic2.PNG&hash=5e35756fd19bb695053dce4ad401476253326824)

If that does not work, please do what 4Kstore has suggested ;)

BTW, nice site :)
Title: Re: Google Translate for SMF 2.0
Post by: Kreator on November 13, 2011, 03:51:05 AM
Quote from: Reaper.CSF. on October 28, 2011, 04:17:40 PM
Quote from: krash661 on October 27, 2011, 08:17:15 PM
I'm having problems installing it.



Installations actions for "Google Translate for SMF 2.0"
Installing this package will perform the following actions:
      Type    Action    Description
*    1.    Execute Modification    ./Themes/default/index.template.php    Test successful

Install in Other Themes
To use this modification in themes other than the default, the package manager needs to make additional changes to the other themes. If you'd like to install this modification in the other themes, please select these themes below.
      insidious
*       Execute Modification    ./Themes/Insidius2/index.template.php    Test failed
      1.    Add Before    ./Themes/Insidius2/index.template.php    Test failed

It seems that your custom themes are missing the // Show the navigation tree. line or it's reworded, meaning it's different to the default theme.
You can edit the index.template.php file for the custom themes or you can attach index.template.php file to your post and I will have a quick look for you.
I can then make the change so that you can install the mod ;)
to attach the file click on Attachments and other options link under the message body and then click on browse and select file, to submit click on save button ;)


I am also having the same problem with a missing // Navigation tree on a custom theme (Darkbasic64)


Would be grateful  if you could have a look at the attached index.template
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on November 14, 2011, 01:23:49 AM
Quote from: Kreator on November 13, 2011, 03:51:05 AM
Quote from: Reaper.CSF. on October 28, 2011, 04:17:40 PM
Quote from: krash661 on October 27, 2011, 08:17:15 PM
I'm having problems installing it.



Installations actions for "Google Translate for SMF 2.0"
Installing this package will perform the following actions:
      Type    Action    Description
*    1.    Execute Modification    ./Themes/default/index.template.php    Test successful

Install in Other Themes
To use this modification in themes other than the default, the package manager needs to make additional changes to the other themes. If you'd like to install this modification in the other themes, please select these themes below.
      insidious
*       Execute Modification    ./Themes/Insidius2/index.template.php    Test failed
      1.    Add Before    ./Themes/Insidius2/index.template.php    Test failed

It seems that your custom themes are missing the // Show the navigation tree. line or it's reworded, meaning it's different to the default theme.
You can edit the index.template.php file for the custom themes or you can attach index.template.php file to your post and I will have a quick look for you.
I can then make the change so that you can install the mod ;)
to attach the file click on Attachments and other options link under the message body and then click on browse and select file, to submit click on save button ;)


I am also having the same problem with a missing // Navigation tree on a custom theme (Darkbasic64)


Would be grateful  if you could have a look at the attached index.template

Try this now. Just rename old index.template.php to index.template_old.php and then upload this in it's place.
Install the mod, it should work ;)
Title: Re: Google Translate for SMF 2.0
Post by: Kreator on November 14, 2011, 03:39:30 AM
Magic Reaper, worked a treat! thank you very much, its just knowing where the navigation code starts does it not, I didnt had had lots of trouble with it
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on November 14, 2011, 07:33:30 AM
You're welcome buddy (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2FSmileys%2FCSF%2Fgoodstuff.gif&hash=c8e0b4b024c6849a6a570efce66cac4bd549bdd6)
Title: Re: Google Translate for SMF 2.0
Post by: warrior4christ on November 17, 2011, 11:38:31 AM
I think this mod makes all the current implemented language packages not necessary.

I am using this mod and found a way to disable the popup menu  bar at the top.. So all you see is the dropdown.

Also..  Same tweek that disables that menu at the top when translate..  stops flash files from loading twice...  Because it is that very menu bar div that when loaded but hidden causes the entire page to reload.
Title: Re: Google Translate for SMF 2.0
Post by: crobbe on December 10, 2011, 07:58:35 AM
Is there away to get this mod so I can place it whereever I want, The position messes up my forum links section.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on December 20, 2011, 02:03:43 AM
@crobbe

Yes you can, I successfully added it above the forum (meaning, in the header)

All you need to to is edit index.template.php
Find + Remove:echo'
<br />
<div align="right"><div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: "' . $txt['lang_dictionary'] . '",
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, \'google_translate_element\');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>';


Find:// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];


Replace with:// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];

      echo '
<div align="right"><div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: "' . $txt['lang_dictionary'] . '",
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, \'google_translate_element\');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>';


Or you can download the following zip file which does the above for you but with an Admin enable / disable feature and it is only set for Only logged users.
If you log out, you can't see the google translate. ;)

To change the position from Right to Different position, change the following line <div align="right">
to one of the following:
Center
<div align="center">

Left
<div align="left">

Perhaps later on I'll incorporate Admin CP functions to include enable / disable; align left, center, right. ;)

P.S, this edit will not work for the latest version of this mod.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 16, 2012, 04:36:14 PM
Mod updated ;D

Please remember to completely uninstall and remove the old version before installing this new one ;)

This new package will have:
An enable / disable feature in admin cp
A location selector (left | center | right)

Enjoy! :)
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 17, 2012, 06:25:30 AM
After more fiddling around with this mod, I have added a new feature, this new feature allows the admin to change the style of the Google Translate Dropdown.
The selections available are:
Horizontal, Dropdown only, Vertical

I will be updating the package ;)

The File has been updated.
Quote from: Reaper.CSF. on January 16, 2012, 04:36:14 PM
Please remember to completely uninstall and remove the old version before installing this new one ;)

Enjoy! 8)

I am looking at other options to add but, I'll add them on a later date. ;)
Title: Re: Google Translate for SMF 2.0
Post by: inkys on January 30, 2012, 05:00:47 AM
 Thanks for this mod ;) using and I  found few problems maybe somebody can help me.
I  m using the default theme curve

1)My forum is not  for english speaker, so   I select another language(english for example) from the dropdown, I
have always a translation instantly from google who can show me the alternative translation for every word.
Is it possible do not show this box from google??(attachment)

2) I disable the top bar, but I have always a refresh on my boards, is it possible to not have?
maybe @warrior4christ fixed this problem?

3)how to remove the text (powered by google translate?) I saw on this forum we do not have

Thanks the author for this mod and apologies for all question together
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 31, 2012, 09:02:03 PM
Quote from: inkys on January 30, 2012, 05:00:47 AM
Thanks for this mod

Thanks

Quote from: inkys on January 30, 2012, 05:00:47 AM
I  found few problems maybe somebody can help me.
I  m using the default theme curve

sorry to hear that you are having some problems with this mod

Quote from: inkys on January 30, 2012, 05:00:47 AM
1)My forum is not  for english speaker, so   I select another language(english for example) from the dropdown, I
have always a translation instantly from google who can show me the alternative translation for every word.
Is it possible do not show this box from google??(attachment)

Far as I have seen from Google Translate it self, no, all translations will be shown the original text in a box shown in the attachment.

Quote from: inkys on January 30, 2012, 05:00:47 AM
2) I disable the top bar, but I have always a refresh on my boards, is it possible to not have?
maybe @warrior4christ fixed this problem?

I can't see how he could possibly done that.
As I have said previously, I have looked at other settings for Google Translate, nothing support his claims.

Quote from: inkys on January 30, 2012, 05:00:47 AM
3)how to remove the text (powered by google translate?) I saw on this forum we do not have

I have added an option in Admin > Configuration > Modification Settings
"Google Translate Position" you can now choose Left, Center, Right alignment.
"Google Translate Style" you can change the style to Horizontal, Vertical, Dropdown Only.
See attachments

If you can't see the text for the Google Translate Position, Google Translate Style, Google Translate System
Please let me know and tell me your forum language so I can do translations for you and add them to my mod accordingly ;)
Title: Re: Google Translate for SMF 2.0
Post by: DrBermant on February 25, 2012, 12:42:59 PM
Thank you for your mod. It was just what I was looking for as I just made my other sites Google Translate capable.

I see you did not opt to offer the Google Analytics option.

http://translate.google.com/translate_tools check box under optional settings:

Track translation usage in Google Analytics.

I am awaiting to see it power on the installed sites, but it should be an option for the site using the tool.

I am also having an issue with a dark background on the site, the placement of the google code hides all but the drop down. The fix is to choose drop down only. But another option would be to offer a selectable button for those with dark background themes to have the google div color different so that the horizontal code would be visible.

Thank you for the mod.

Michael Bermant, MD
Retired Plastic Surgeon
Plastic Surgery Encyclopedia (http://www.plasticsurgery4u.com/)
Title: Re: Google Translate for SMF 2.0
Post by: brynn on February 28, 2012, 07:23:17 PM
Hi Friends,
I don't have a SMF myself, but participate in many forums which use this software.  One of them uses this Google Translate for version 2.0.  It's a forum which I like, and would like to participate more.  But the translation provided is.....well, not as good as what I would have expected.

I will put screenshots below.  The forum is in the Italian language, and I use the translation for English.  Some people on the forum are able to read and write English.  But if they write in English, and I'm using the translation on it, frequently words are mixed up (out of order).  Also, the translator seems to apply random capitalization of words.  For example, in the middle of a sentence, 3 consecutive words might be capitalized, for which there is no grammatic reason.  Usually it's just one or 2 words, though.

When the messages are written originally in Italian, the translations are equally hard to understand, despite being English words.  So I have to wonder if it's malfunctioning.  But of course since I don't read Italian, I can't be sure, or provide examples.

Is this acceptable behavior for this mod, or could there be a problem with it?  The message in the screenshot was typed originally in English, but the translator has put words in the wrong order, and added unneccesary capitalization.  I'm not sure what order these attachments will appear, so I'll try to edit the message to indicate which is which.

And 2nd question -- which mod provides the translation for this forum (that I see in top right corner)?  It appears that the Google Translate is the only one that works with the current version of SMF.  But that one looks very different from the one on the Italian forum.

Thanks for your help  :)

(Hhhhm, if I'm logged in, why is there a captcha?)

Edit #1
PS -  The file "without trans" is how the original message was typed, and how it appears without using the mod.  The file "with trans" is what happens when the translator works on it.  Thanks again :)

Edit #2
The aformentioned problems are not the only ones.  Apparently using the translator causes the message to lose all formatting.  So the sentences all just run together.

Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 02, 2012, 09:26:58 PM
Quote from: DrBermant on February 25, 2012, 12:42:59 PM
Thank you for your mod. It was just what I was looking for as I just made my other sites Google Translate capable.

:)

Quote from: DrBermant on February 25, 2012, 12:42:59 PM
I see you did not opt to offer the Google Analytics option.

http://translate.google.com/translate_tools check box under optional settings:

Track translation usage in Google Analytics.

I am awaiting to see it power on the installed sites, but it should be an option for the site using the tool.

I will include this option in my new version. (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2FSmileys%2Fdefault%2Fnoworries.gif&hash=e51aa0e2b981e4fa6a7077f8b014f6c56a95782d)

Quote from: DrBermant on February 25, 2012, 12:42:59 PM
I am also having an issue with a dark background on the site, the placement of the google code hides all but the drop down. The fix is to choose drop down only. But another option would be to offer a selectable button for those with dark background themes to have the google div color different so that the horizontal code would be visible.

I will include a fix for this issue in my new version.

It will have a drop down selection to include:
Light Theme
Dark Theme Left
Dark Theme Center
Dark Theme Right

Since I am using CSS in the the above, I have chosen to use something like the following.
#googletranslatedarkcenter
{
position: absolute;
top: 0px;
left:40%;
height: 30px;
width: 335px;
background-color: rgb(238,238,238);
-moz-border-radius: 15px;
border-radius: 15px;
}


It will look better than a background color stretching across the full width of your page with only a 300px object aligned to the Left, Center or Right.
IMHO it won't look professional.

It will also require the index.css to be edited to change the background color so the Horizontal text can be visible on dark themes.

The style that I have added will look better in Firefox, but, it should still display in other browsers though.

I can add other effects, such as, shadows etc. This will reduce the browser compatibility.
Most effects that I know are CSS3 (Cascading Style Sheet), this again, will also reduce the compatibility of browsers even further.

Quote from: brynn on February 28, 2012, 07:23:17 PM
Hi Friends,
I don't have a SMF myself, but participate in many forums which use this software.  One of them uses this Google Translate for version 2.0.  It's a forum which I like, and would like to participate more.  But the translation provided is.....well, not as good as what I would have expected.

I will put screenshots below.  The forum is in the Italian language, and I use the translation for English.  Some people on the forum are able to read and write English.  But if they write in English, and I'm using the translation on it, frequently words are mixed up (out of order).  Also, the translator seems to apply random capitalization of words.  For example, in the middle of a sentence, 3 consecutive words might be capitalized, for which there is no grammatic reason.  Usually it's just one or 2 words, though.

When the messages are written originally in Italian, the translations are equally hard to understand, despite being English words.  So I have to wonder if it's malfunctioning.  But of course since I don't read Italian, I can't be sure, or provide examples.

Is this acceptable behavior for this mod, or could there be a problem with it?  The message in the screenshot was typed originally in English, but the translator has put words in the wrong order, and added unneccesary capitalization.  I'm not sure what order these attachments will appear, so I'll try to edit the message to indicate which is which.

And 2nd question -- which mod provides the translation for this forum (that I see in top right corner)?  It appears that the Google Translate is the only one that works with the current version of SMF.  But that one looks very different from the one on the Italian forum.

Thanks for your help  :)

(Hhhhm, if I'm logged in, why is there a captcha?)

Edit #1
PS -  The file "without trans" is how the original message was typed, and how it appears without using the mod.  The file "with trans" is what happens when the translator works on it.  Thanks again :)

Edit #2
The aformentioned problems are not the only ones.  Apparently using the translator causes the message to lose all formatting.  So the sentences all just run together.



The problem is not this mod, they might be using a different mod or they are using the code straight from the Google Translate site.

Those questions should be pointed to the site owner of the site in question or Google Translate it self, not here.
It will more than likely be on the site that you are talking about, I would try them first. (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2FSmileys%2Fdefault%2Fderisive.gif&hash=01824fb61f8620bf8665571a6096cd2293534525)

The problem could also be a miss translation.
I would also expect formatting to be lost during the translation process, IMHO I'm not really fussed. If the end result is translated then I'm happy (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2FSmileys%2Fdefault%2Fvictory.gif&hash=7a27f45a65d2f945ada7dc5ac31a3631d6f85242)

The captcha would be up to the site administrator/s, they may have the option set for x amount of posts to display the captcha for logged users as well as guests.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 03, 2012, 12:19:29 AM
Quote from: DrBermant on February 25, 2012, 12:42:59 PM
I see you did not opt to offer the Google Analytics option.

http://translate.google.com/translate_tools check box under optional settings:

Track translation usage in Google Analytics.

I am awaiting to see it power on the installed sites, but it should be an option for the site using the tool.

I have just tested my new version, the new feature Google Analytics conflicts with a pre existing mod called 'Google Analytics Code'.
Up on adding other options to my mod I did come across this, I have just simply forgotten why I didn't add it..

The fix for the Dark Themes works just fine.

I'll now remove all Google Analytics edits.
Title: Re: Google Translate for SMF 2.0
Post by: brynn on March 04, 2012, 05:34:13 AM
Thanks for your reply  :)

I've thoroughly discussed this with the site's owner.  Since I may want to use SMF myself someday, I thought it might be a good opportunity to acquaint myself with the product.  So that was also a consideration in deciding to register and post my questions.

They are definitely using this mod.  Because I'm somewhat not satisfied with the result, I sent him a link to all the translation mods available for SMF (not realizing that what he is using is actually a forum mod) (I thought it was something directly from Google).  He said he was using Google Translate for 2.0, because that's the only one that apparently works with the current forum software.

Quote...or they are using the code straight from the Google Translate site.
Is there any way I can tell by how it looks, whether they are using code straight from Google, or the forum mod?  Of course I will report to him what you say, but details might help.

QuoteThe problem could also be a miss translation.
By "miss translation" do you mean like a glitch with a script or something?  I could submit countless examples; this is not a rare occurence by any stretch.  Or what does "miss translation" mean? 

I don't mean to sound critical.  I'm grateful that they can provide any translation at all.  And I'm grateful for this mod.  It's just the translation seems off so much that I do honestly wonder if it's malfunctioning, somehow.  Maybe I should explain that I don't understand anything about coding or writing mods.  I'm not sure if there should be some obvious explanation, but I don't have the technical knowledge needed?

The lost formatting is not a huge problem, if the translation is understandable.  The example I provided is really a mild example.  It's just so hard to understand, that  I think formatting would help me understand better.   I do think all the proper words are being provided by the translation, they're just in the wrong order.

QuoteThe captcha would be up to the site administrator/s,.....
No, no, in THIS forum I have a captcha, for every message I post, and every edit!  I was just curious why.

Thanks again  :)
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 04, 2012, 03:17:21 PM
Quote from: brynn on March 04, 2012, 05:34:13 AM
They are definitely using this mod.

Cool.

Quote from: brynn on March 04, 2012, 05:34:13 AM
Is there any way I can tell by how it looks, whether they are using code straight from Google, or the forum mod?  Of course I will report to him what you say, but details might help.

No, it will look the same.
The code that I am using is the exactly the same as the one that you obtain from the google translate site.
The only difference is that I have added something like this:
' . $modSettings['google_translate_function'] . ' to insert the Admins config for that setting.

Quote from: brynn on March 04, 2012, 05:34:13 AM
By "miss translation" do you mean like a glitch with a script or something?

No

Quote from: brynn on March 04, 2012, 05:34:13 AM
I could submit countless examples; this is not a rare occurence by any stretch.  Or what does "miss translation" mean?

What I mean "miss translation" is when you insert a word  or character, the translator will not pick it up. This goes for any translator.

I have the Translator mod enabled in my third test site here (http://www.test-site3.csf-squad.com/index.php).
You are welcome to go there and have a look.

How to use it?
Simply click the down drop and select the language to translate to.
In my case (for a test, I'll select Chinese (Simplified)) I chose that because it is so distinctive like Arabic.
Please see my screenshots.

Original
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2Fpics%2Ftranslation_1a.jpg&hash=877c71b9c3aabb958b9ad571a6b7c7bfe70d7a42)

With Translation
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2Fpics%2Ftranslation_1.jpg&hash=2207bcbb9ef488e94e8908439223a72c801dd77f)

Original
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2Fpics%2Ftranslation_2a.jpg&hash=813cdec10d7176deb0c7f3306711313436e4767b)

With Translation
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2Fpics%2Ftranslation_2.jpg&hash=7286eff25ab9fd256d4272f0b312651b80c696be)

As you can see, the Text has been translated, the smileys used have been moved to under the translated text.

This is coming from an English forum, if this doesn't work on the site that you are trying this on, it may be the first to show a problem.
The problem may be the language detection code used doesn't recognise the different language from the forum. ' . $txt['lang_dictionary'] . '
The fix would be to include a drop down in the mod settings area that will include all the language codes e.g. English = 'en'. This must be done so that Google Translate knows what language to translate from. With out it knowing what language to translate from, it will be very hard to get a translation.

I would be very interested to see if you can get this to work in my test site, if you can. If you can't get it to work in the site you're mentioning, that is clear to me that I'll need to create a language selection.

Thanks 8)
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 05, 2012, 03:20:01 AM
On the 07 March I will be flying to Brisbane and returning on the 21 March.
After the 21 march I will be continuing with fixing this mod.
Title: Re: Google Translate for SMF 2.0
Post by: brynn on March 23, 2012, 06:00:52 PM
I'm sorry it has taken me so long to respond.  I will give that forum admin a link to this discussion, because I don't know exactly what  you mean by the little pieces of code that you showed.

I will try on your test site, and let you know if I can offer any comments.  But if that site is already in the English language, I will have no way of knowing the quality of the translation, because I only read English.  For example, in the examples you posted, clearly some kind of translation has occurred, but I can't judge the quality.  If it would be a simple thing for you to switch it to some other language, then when I have it traslated to English, I will be able to judge the quality of the translation.  If you can easily switch to another language, you can type the message in English anyway. 

The problem for me is that the translation mod/script is affecting messages that are originally typed in the translated language.  And whatever is happening, seems to also happen to the legitimately translated text.  (Did that make sense?) 

Oh look, another captcha for me!  Should I report this captcha thing somewhere else on this forum?  Because unless it is a spam control feature, usually once I'm registered and logged in, I don't expect captchas.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 23, 2012, 08:26:41 PM
Seriously, I don't know why you would want to translate a site to English if it is already in English ???

If the site that you are using is using Italian and you translate to English from the drop down, it should translate the whole forum (main menu, boards / posts, absolutely everything)
By looking at the attachments that you have provided tells me that the forum language is not getting detected 100%.

I am in the process of adding a forum language selection feature and double checking every piece of code before I upload my new version for this mod.

-edit-
Okay I have worked out the problem, I didn't add a Language selector in the Admin area due to too many languages to add. In stead, I have made it automatic detect forum language (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2FSmileys%2Fdefault%2Fgoodstuff.gif&hash=130dce4d73afe88db793e3c28e52d9bfd0ff21f2)

I have uploaded the new v1.2

Later on down the track I will:
Enable / Disable Header location
Enable / Disable Link Tree Location

That way you get to choose where you want the Google Translate to go ;)
Title: Re: Google Translate for SMF 2.0
Post by: brynn on March 23, 2012, 09:06:26 PM
QuoteSeriously, I don't know why you would want to translate a site to English if it is already in English
You seem not to be thinking through all the issues involved.

The site is not in English.  As I've said, the entire forum is in the Italian language, except here and there where someone types in English.  I did not know at first that some people were typing messages in English.  I was using the translation to read the entire forum.  When I started to ask about some of the weird translation I was getting, that's when the people I was talking to at the time told me they were typing in English.  But the messages were equally hard to understand as the translated messages.  It was only when I turned off the translation, to read the English messages, that I noticed that the translation was somehow working on English messages translated to English (because I would think a message typed in English should not be affected by the translation).

In my screenshots, you're looking at what I see with the translation mod in use, and again without.  The reason it looks like not everything is translated is the shot where I turned off the translator.  The person was typing in English on an Italian language forum.

As I've said, I don't understand much from a technical or coding perspective.  It appears to me that all the words are fairly accurately translated, but somehow, the word order gets all scrambled (and random, inappropriate capitalization added).  When I look at English messages translated to English, they do contain all the same words, except that they are not in the same order.  I think that somehow, the word order is changed by the translator, and I think that must be a bug.

I understand that your mod simply uses the Google script, and that you probably can't change anything about it.  But I was hoping that you could at least explain it.  Perhaps I will eventually contact Google about it.  I'm not sure.  But if I can find something better than the Google script, I will certainly use it instead.  To that end, I'm curious what kind of translator is in use in this forum?

Thanks again

PS - I looked at your Test Forum 3.  Unfortunately, I can't read any messages without registering and logging in.  If you can make it so I can read the messages without registering, I will be glad to test  :)

Edit
Perhaps you'd like to visit the forum, and test the translator.  Maybe seeing the problem in person will help you to understand?
http://inkscapeforum.it/index.php
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 23, 2012, 10:04:05 PM
Quote from: brynn on March 23, 2012, 09:06:26 PM
QuoteSeriously, I don't know why you would want to translate a site to English if it is already in English
You seem not to be thinking through all the issues involved.

The site is not in English.  As I've said, the entire forum is in the Italian language, except here and there where someone types in English.  I did not know at first that some people were typing messages in English.  I was using the translation to read the entire forum.  When I started to ask about some of the weird translation I was getting, that's when the people I was talking to at the time told me they were typing in English.  But the messages were equally hard to understand as the translated messages.  It was only when I turned off the translation, to read the English messages, that I noticed that the translation was somehow working on English messages translated to English (because I would think a message typed in English should not be affected by the translation).

In my screenshots, you're looking at what I see with the translation mod in use, and again without.  The reason it looks like not everything is translated is the shot where I turned off the translator.  The person was typing in English on an Italian language forum.

As I've said, I don't understand much from a technical or coding perspective.  It appears to me that all the words are fairly accurately translated, but somehow, the word order gets all scrambled (and random, inappropriate capitalization added).  When I look at English messages translated to English, they do contain all the same words, except that they are not in the same order.  I think that somehow, the word order is changed by the translator, and I think that must be a bug.

I understand that your mod simply uses the Google script, and that you probably can't change anything about it.  But I was hoping that you could at least explain it.  Perhaps I will eventually contact Google about it.  I'm not sure.  But if I can find something better than the Google script, I will certainly use it instead.  To that end, I'm curious what kind of translator is in use in this forum?

Thanks again

PS - I looked at your Test Forum 3.  Unfortunately, I can't read any messages without registering and logging in.  If you can make it so I can read the messages without registering, I will be glad to test  :)

Edit
Perhaps you'd like to visit the forum, and test the translator.  Maybe seeing the problem in person will help you to understand?
http://inkscapeforum.it/index.php

I went to the site, translations works fine for me.

The problem you have is not my mod it's with google.........
Title: Re: Google Translate for SMF 2.0
Post by: samurai-lupin on March 26, 2012, 01:20:05 AM
Hello, this looks like a great mod! Could it be backported to SMF 1.1 ?
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 27, 2012, 02:36:31 AM
Quote from: samurai-lupin on March 26, 2012, 01:20:05 AM
Hello, this looks like a great mod! Could it be backported to SMF 1.1 ?

Sure, I can add support for 1.1.xx
However, I wouldn't know where to start by adding support for Administration Setting Functions. I am a SMF 2.0 supporter.

For now I can add automatic Lang Detect that will go straight in to the index.template.php, that's it.
As for customisation as in the type of bar (vertical, horizontal, drop down only) and dark theme styles etc will have to wait until I learn what files in 1.1.xx to add the changes to etc.

I am adding support for 1.1.xx now ;)
Thanks mate (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.csf-squad.com%2FSmileys%2FCSF%2Fgoodstuff.gif&hash=c8e0b4b024c6849a6a570efce66cac4bd549bdd6)
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on March 29, 2012, 05:36:05 AM
I have made the changes and tested accordingly.

I have removed the Style CSS background because I have changed the location of the Google Translate drop down bar.
The new position is underneath the Link Tree, still have the ability to change left, center, right and you still have the ability to change horizontal, vertical, dropdown only.

I will add the option for the API in this mod. However, the API will not work until you install the Google API mod.

I have successfully added support for 1.1.10 - 1.1.16. If you want support lower than 1.1.10 then you will have to ask me so I can check the code to search for to see if it has changed, if not I'll change the package forum version.

Quote from: Reaper.CSF. on January 16, 2012, 04:36:14 PM
Please remember to completely uninstall and remove the old version before installing this new one ;)
Title: Re: Google Translate for SMF 2.0
Post by: samurai-lupin on April 01, 2012, 07:23:23 PM
Thank you! I will download the mod and test it on SMF 1.1!
Title: Re: Google Translate for SMF 2.0
Post by: samurai-lupin on April 02, 2012, 02:25:55 PM
I have tested it and it works fine on SMF 1.1 ... thank you!

Is there a way though to disable the Google Bar that appears on the top of the pages? I think the pull down menue is sufficient.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on April 04, 2012, 07:13:22 AM
You can fix it by editing index.template.php
Find:// Google Translate Mod
echo'
<br />
<div align="right"><div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: \'auto\',
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, \'google_translate_element\');
}</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>';


Change the following:
    pageLanguage: \'auto\',

with one of the following language codes to your forum language:
Eg:
English forum = en

af = AFRIKAANS
sq = ALBANIAN
ar = ARABIC
be = BELARUSIAN
bg = BULGARIAN
ca = CATALAN
zh-CN = CHINESE_SIMPLIFIED
zh-TW = CHINESE_TRADITIONAL
hr = CROATIAN
cs = CZECH
da = DANISH
nl = DUTCH
en = ENGLISH
eo = ESPERANTO
et = ESTONIAN
tl = FILIPINO
fi = FINNISH
fr = FRENCH
de = GERMAN
el = GREEK
ht = HAITIAN_CREOLE
iw = HEBREW
hi = HINDI
hu = HUNGARIAN
is = ICELANDIC
id = INDONESIAN
ga = IRISH
it = ITALIAN
vc = JAPANESE
ko = KOREAN
lv = LATVIAN
lt = LITHUANIAN
mk = MACEDONIAN
ms = MALAY
mt = MALTESE
no = NORWEGIAN
fa = PERSIAN
pl = POLISH
pt = PORTUGUESE
pt-br = PORTUGUESE_BRAZ
ro = ROMANIAN
ru = RUSSIAN
sr = SERBIAN
sk = SLOVAK
sl = SLOVENIAN
es = SPANISH
sw = SWAHILI
sv = SWEDISH
th = THAI
tr = TURKISH
uk = UKRAINIAN
vi = VIETNAMESE
cy = WELSH
yi = YIDDISH

I am working on a Admin settings page but atm it's not going too good.
Title: Re: Google Translate for SMF 2.0
Post by: samurai-lupin on April 04, 2012, 08:28:28 PM
Thank you very much! I will give it a try!
Title: Re: Google Translate for SMF 2.0
Post by: milenko_soe on April 12, 2012, 01:57:27 AM
having the same test failed, I would have edited the index.template.php but you never wrote what needs to be edited/added to the file. Can you post what needs to be added or edited for future members please?
Here is a copy of my index.template.php, if you could fix, thanks!
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on April 18, 2012, 05:16:25 AM
I have fixed your index.template.php file for you.

It's very complicated to explain how to find and fix the issue.

I will try to explain later.

Simply rename your original index.template.php to something like index.template_php.old
then simply up load this new one in it's place.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on April 18, 2012, 10:33:32 PM
Quote from: milenko_soe on April 12, 2012, 01:57:27 AM
having the same test failed, I would have edited the index.template.php but you never wrote what needs to be edited/added to the file. Can you post what needs to be added or edited for future members please?
Here is a copy of my index.template.php, if you could fix, thanks!

This is to explain how to fix the issue with "test failed"

In your themes index.template.php
Find:
theme_linktree();

Add Before:
// Custom banners and shoutboxes should be placed here, before the linktree.

// Show the navigation tree.


Save the file.

This should only apply to custom themes.

I hope this helps ;)
Title: Re: Google Translate for SMF 2.0
Post by: _sebas_ on July 17, 2012, 01:09:26 PM
hi !
I have a problem !:   in Internet Explorer 8,  this "display window" for language selection is NOT VISIBLE, not exist?

in Firefox 13.0.1  all is ok !
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on July 31, 2012, 12:05:03 PM
Sorry for the late reply.

What language is your forum using?

Attached to this reply is a screenshot of my test site using Internet Explorer 8.0 & 9.0. I have tested using Internet Explorer 6.0 & 7.0 as well, all look exactly the same as my screenshot provided.
Title: Re: Google Translate for SMF 2.0
Post by: johnpaul2k2 on September 06, 2012, 11:57:25 AM
after a successful installation , the logo or the translator is nowhere to be found on my custom theme? what will i do?
Title: Re: Google Translate for SMF 2.0
Post by: Shambles on September 06, 2012, 12:09:37 PM
Did you turn it on?

Admin > Configuration > Modifications > Miscellaneous >

tick "Google Translate System".

There are related options beneath that checkbox - make sure they're set to what you want ;)
Title: Re: Google Translate for SMF 2.0
Post by: johnpaul2k2 on September 06, 2012, 12:24:22 PM
Quote from: Shamblesâ„¢ on September 06, 2012, 12:09:37 PM
Did you turn it on?

Admin > Configuration > Modifications > Miscellaneous >

tick "Google Translate System".

There are related options beneath that checkbox - make sure they're set to what you want ;)
yes but this is not working....will you help me
Title: Re: Google Translate for SMF 2.0
Post by: Shambles on September 06, 2012, 12:50:58 PM
Does it show up if you switch to the default SMF theme (Curve) ?
Title: Re: Google Translate for SMF 2.0
Post by: johnpaul2k2 on September 06, 2012, 01:26:10 PM
Quote from: Shamblesâ„¢ on September 06, 2012, 12:50:58 PM
Does it show up if you switch to the default SMF theme (Curve) ?
YES!! it appeared on the default  SMF theme (Curve). what will i do for it to appear on my custom theme???
Title: Re: Google Translate for SMF 2.0
Post by: Shambles on September 06, 2012, 01:39:12 PM
When you installed the mod, I'm guessing you didn't tick the box to install it (also) into your personalised theme?

Two choices now.

Uninstall it, then reinstall, making sure you tick the box(es) for any other themes you wish to install it into.

Or, make the changes manually to the files that got overlooked when you originally installed it.
Title: Re: Google Translate for SMF 2.0
Post by: johnpaul2k2 on September 06, 2012, 02:07:25 PM
Quote from: Shamblesâ„¢ on September 06, 2012, 01:39:12 PM
When you installed the mod, I'm guessing you didn't tick the box to install it (also) into your personalised theme?

Two choices now.

Uninstall it, then reinstall, making sure you tick the box(es) for any other themes you wish to install it into.

Or, make the changes manually to the files that got overlooked when you originally installed it.

working now ;D ;D ;D ;D ;D thanks
Title: Re: Google Translate for SMF 2.0
Post by: Andrew Evenstar on September 10, 2012, 12:19:57 AM
wow, thanks so much for this! i didn't install it with the package, just did it manually with the code.

this is the best mod ever if you have many international users.
Title: Re: Google Translate for SMF 2.0
Post by: tMicky on September 23, 2012, 01:56:13 AM
Is it possible to move this mod to the header, right at the top and on the right hand side.

I tried the instruction on the first page and it no longer works.

thanks.
Title: Re: Google Translate for SMF 2.0
Post by: tMicky on September 24, 2012, 07:36:53 AM
Installed this yesterday, was working perfectly, however today the bar is no longer showing on Firefox, the mod is enabled and shows up on other browsers, but strangely not showing up in Firefox, any ideas?
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on October 01, 2012, 12:20:58 PM
Sorry for my late response

I'd start with deleting ALL cookies using Tools > Options > Privacy > remove individual cookies > Remove all Cookies
Since browsers doesn't really remove ALL cookies, I'd then run the free version of SUPERAntiSpyware, just google it and install and run the free version.
On an average PC it takes 5 - 10 mins for a full scan.

If you still can't see the google traslate bar, try full refreshing the page by holding right CTRL button and then press F5 at the same time.
This will force the browser to refresh and fully update the page.

If that still doesn't work then we will have to look at something else.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on October 01, 2012, 12:27:53 PM
Quote from: Reaper.CSF. on December 20, 2011, 02:03:43 AM
@crobbe

Yes you can, I successfully added it above the forum (meaning, in the header)

All you need to to is edit index.template.php
Find + Remove:echo'
<br />
<div align="right"><div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: "' . $txt['lang_dictionary'] . '",
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, \'google_translate_element\');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>';


Find:// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];


Replace with:// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];

      echo '
<div align="right"><div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: "' . $txt['lang_dictionary'] . '",
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, \'google_translate_element\');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>';


Or you can download the following zip file which does the above for you but with an Admin enable / disable feature and it is only set for Only logged users.
If you log out, you can't see the google translate. ;)

To change the position from Right to Different position, change the following line <div align="right">
to one of the following:
Center
<div align="center">

Left
<div align="left">

Perhaps later on I'll incorporate Admin CP functions to include enable / disable; align left, center, right. ;)

The above will not work because I have done major changes to the mod.

can you please attach your index.template.php file and I will fix this problem for you.
Title: Re: Google Translate for SMF 2.0
Post by: tMicky on October 02, 2012, 05:57:58 AM
Quote from: Reaper.CSF. on October 01, 2012, 12:27:53 PM

The above will not work because I have done major changes to the mod.

can you please attach your index.template.php file and I will fix this problem for you.

Thank you, I found a way to make it work, in the current location. Thanks for your help and for the awesome mod :)
Title: Re: Google Translate for SMF 2.0
Post by: ApplianceJunk on December 21, 2012, 11:45:20 PM
Seems to work great, thanks!
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on December 28, 2012, 08:00:22 PM
I have updated the package.

I have added Google Analytics.
I have fixed the forum version.

On a later date I will add more features.

This package has been updated for both 2.0 - 2.0.3 and 1.1.10 - 1.1.17 ;)
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 05, 2013, 01:46:24 PM
smf 2.0.3  default theme curve  simple portal

Installed the mod.
copied modifications.english-utf8.php  to   modifications.mylanguage-utf8.php

receiving lots of

Undefined index: google_translate_analytics_id
file: /home/myuser/public_html/Themes/default/index.template.php
Satır: 348



function googleTranslateElementInit() {
  new google.translate.TranslateElement({
pageLanguage: \''. $modSettings['google_translate_language'] . '\',
autoDisplay: \'' . $modSettings['google_translate_autodisplay'] . '\',
multilanguagePage: \'' . $modSettings['google_translate_multilanguage'] . '\',
gaTrack: \'' . $modSettings['google_translate_analytics'] . '\',
gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',
layout: google.translate.TranslateElement.InlineLayout.' . $modSettings['google_translate_style'] . '
  }, \'google_translate_element\');



Any idea, what is wrong ?

analytics left as default  "false"


nb.  This error is strange

h t t p://mysite123/index.php?http://mysite123/   ??????????????????????   I modified the "h t t p" but the rest ?
8: Undefined index: google_translate_analytics_id
file: /home/myuser/public_html/Themes/default/index.template.php
Satır: 348
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 14, 2013, 12:23:45 PM
I am so sorry, I have been unable to recreate this error in any of my test sites.

I have had it set to false and no error is present, not even in the log's.
I have enabled it (true) inputted my analytics id and still unable to get error, not even in the logs.

Not just one site but 3 all using different versions 2.0.1 | 2.0.2 | 2.0.3

I have no suggestions other than try to uninstall the mod and ensure that all files are clean of all edits that this mod does, and then try installing this mod again.
To check after uninstalling using package manager, go here (http://custom.simplemachines.org/mods/index.php?mod=3213).
Find Manual Install Instructions for SMF ensure it's on 2.0.3 and then click on Parse button.

If you still get errors please post them here if they differ from what you posted earlier.

Perhaps its the edits to get the mod to work for your correct template file.
Please specify your language and perhaps I can include it in my package.

By looking at your code, you are missing quite a lot! :o
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 14, 2013, 03:40:06 PM
Reinstalled today and received same messages in the error log, so uninstalled.

Unfortunatly the indextamplate.php lines attached are after the lines ( Gtranslate mod) removed from it .

managesettings.php  and indextemplate.php before the mod attached.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 15, 2013, 11:12:36 AM
I have found your problem, the problem is with your ManageSettings.php file.

Q: do you get any errors during the install process? as in Test Failed.

you will need to ignore the errors and continue to install.

Not sure if you use cPanel so I will instruct you to use FTP.

Open your FTP program and connect to your server.
Browse to the Sources folder and find ManageSettings.php file.
Download your ./Sources/ManageSettings.php file any where on your computer.
Use an editor and edit the ManageSettings.php.

Find:
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!

make a new line after the above and then add the following:
// Google Translate Mod
array('check', 'enable_google_translate', 'subtext' => $txt['google_translate_desc']),
array('select', 'google_translate_language', array('auto' => $txt['google_translate_language_AUTO'],
'af' => $txt['google_translate_language_AFRIKAANS'],
'sq' => $txt['google_translate_language_ALBANIAN'],
'ar' => $txt['google_translate_language_ARABIC'],
'be' => $txt['google_translate_language_BELARUSIAN'],
'bg' => $txt['google_translate_language_BULGARIAN'],
'ca' => $txt['google_translate_language_CATALAN'],
'zh-CN' => $txt['google_translate_language_CHINESE_SIMPLIFIED'],
'zh-TW' => $txt['google_translate_language_CHINESE_TRADITIONAL'],
'hr' => $txt['google_translate_language_CROATIAN'],
'cs' => $txt['google_translate_language_CZECH'],
'da' => $txt['google_translate_language_DANISH'],
'nl' => $txt['google_translate_language_DUTCH'],
'en' => $txt['google_translate_language_ENGLISH'],
'eo' => $txt['google_translate_language_ESPERANTO'],
'et' => $txt['google_translate_language_ESTONIAN'],
'tl' => $txt['google_translate_language_FILIPINO'],
'fi' => $txt['google_translate_language_FINNISH'],
'fr' => $txt['google_translate_language_FRENCH'],
'de' => $txt['google_translate_language_GERMAN'],
'el' => $txt['google_translate_language_GREEK'],
'ht' => $txt['google_translate_language_HAITIAN_CREOLE'],
'iw' => $txt['google_translate_language_HEBREW'],
'hi' => $txt['google_translate_language_HINDI'],
'hu' => $txt['google_translate_language_HUNGARIAN'],
'is' => $txt['google_translate_language_ICELANDIC'],
'id' => $txt['google_translate_language_INDONESIAN'],
'ga' => $txt['google_translate_language_IRISH'],
'it' => $txt['google_translate_language_ITALIAN'],
'vc' => $txt['google_translate_language_JAPANESE'],
'ko' => $txt['google_translate_language_KOREAN'],
'lv' => $txt['google_translate_language_LATVIAN'],
'lt' => $txt['google_translate_language_LITHUANIAN'],
'mk' => $txt['google_translate_language_MACEDONIAN'],
'ms' => $txt['google_translate_language_MALAY'],
'mt' => $txt['google_translate_language_MALTESE'],
'no' => $txt['google_translate_language_NORWEGIAN'],
'fa' => $txt['google_translate_language_PERSIAN'],
'pl' => $txt['google_translate_language_POLISH'],
'pt' => $txt['google_translate_language_PORTUGUESE'],
'pt-br' => $txt['google_translate_language_PORTUGUESE_BRAZ'],
'ro' => $txt['google_translate_language_ROMANIAN'],
'ru' => $txt['google_translate_language_RUSSIAN'],
'sr' => $txt['google_translate_language_SERBIAN'],
'sk' => $txt['google_translate_language_SLOVAK'],
'sl' => $txt['google_translate_language_SLOVENIAN'],
'es' => $txt['google_translate_language_SPANISH'],
'sw' => $txt['google_translate_language_SWAHILI'],
'sv' => $txt['google_translate_language_SWEDISH'],
'th' => $txt['google_translate_language_THAI'],
'tr' => $txt['google_translate_language_TURKISH'],
'uk' => $txt['google_translate_language_UKRAINIAN'],
'vi' => $txt['google_translate_language_VIETNAMESE'],
'cy' => $txt['google_translate_language_WELSH'],
'yi' => $txt['google_translate_language_YIDDISH'], )),
array('select', 'google_translate_autodisplay', array('false' => $txt['google_translate_autodisplay_false'],
'true' => $txt['google_translate_autodisplay_true'], )),
array('select', 'google_translate_multilanguage', array('false' => $txt['google_translate_multilang_false'],
'true' => $txt['google_translate_multilang_true'], )),
array('select', 'google_translate_location', array('left' => $txt['google_translate_left'],
'center' => $txt['google_translate_center'],
'right' => $txt['google_translate_right'], )),
array('select', 'google_translate_style', array('HORIZONTAL' => $txt['google_translate_horizontal'],
'SIMPLE' => $txt['google_translate_dropdown'],
'NULL' => $txt['google_translate_vertical'], )),
array('select', 'google_translate_analytics', array('false' => $txt['google_translate_analytics_false'],
'true' => $txt['google_translate_analytics_true'], )),
array('text', 'google_translate_analytics_id', 20),


Save the file.
Rename old file on the server by calling it ManageSettings.php.old
Upload new edited file in its place.

Log in to Admin.
Maintenance > Forum Maintenance... > Routine
Empty the file cache.
Empty out unimportant logs
Recount all forum totals and statistics

Now press CTRL + F5

Now look at the Maintenance > Logs > Error Log

The other option would be to uninstall the The Posting Announcement mod which is the cause for your errors, then install my mod, after that, reinstall The Posting Announcement mod.

I seriously hope that this helps. ;)
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 15, 2013, 11:20:23 AM
Thanks for your efforts ..

The answer to your questions ...
Yes, I received error while installing gtranslate in manage.settings.php  so I modified php according to parse statements.

But, this is unrelated to posting anouncement mod because it's just installed yesterday,very recently it is just a considence.

Gtranslate tested with it or without it several times formarly.

I know it added lines before :
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!


I will still follow your recommendations and feedback accordingly.
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 15, 2013, 11:29:38 AM
Quote from: teos55 on January 15, 2013, 11:20:23 AM
I know it added lines before :
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!

No, not before, After.
My mod goes under "// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!"
(very important!)
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 15, 2013, 11:35:51 AM
Uninstalled  Posting announcement

Followed steps you mentioned.   Added lines after //Mod authors .....
Unfortunately faced the same problem ... 


even with clear cache ...

http://mysite . org/index.php?action=admin;area=maintain;sa=routine;activity=cleancache
8: Undefined index: google_translate_analytics_id
File: /home/myuser/public_html/Themes/default/index.template.php
Line: 348



And after  contrl+ f5

http://mysite . org/index.php?
8: Undefined index: google_translate_analytics_id
File: /home/karavant/public_html/Themes/default/index.template.php
Line: 348



  I think there is something wrong in my manage.settings.php  that leads to this error, but not specificly related to this mod.

Can you have a check my php in that sense ...

attached the file after the mod application.  (posting announcement uninstalled)

and also index.template.php  after mod install ...




Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 15, 2013, 11:45:43 AM
Out of curiosity, what language template is your forum using?

Modifications.{language}.php
Modifications.{language}-utf8.php

Eg Modifications.italian.php
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 15, 2013, 11:52:56 AM
If you mean utf-8   yes it is set utf8

and I copied modifications.english-ut8.php  mod changes to  modifications.turkish-utf8.php accordingly.
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 15, 2013, 11:57:59 AM
In the settings I set it use analytics with uid, guess what ?  runs clear ...

So,  "false" logic fails , in my opinion ...
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 15, 2013, 12:08:58 PM
False may seem to fail in your case, you are 1 of 72 whom downloaded and installed this new updated mod, 71 of which has not reported any errors.
Not to mention that I have extensively tested this updated code before I have added it to my package ready to be downloaded.

Not only my 3 test sites, I have added it to 2 other LIVE sites too. ALL of which don't have any issues that you are reporting.

Can you please post your language translation [code]{translation}[/code]
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 15, 2013, 12:31:00 PM
Seems you are right. Some other code piece causes to "false" logic to fail.  I'll keep it running with analytics on.

Hope to find the failing part in the future.

Thanks for your efforts .

I'll try my best to translate to turkish :-)
Title: Re: Google Translate for SMF 2.0
Post by: teos55 on January 15, 2013, 12:49:41 PM
You know what , just to my curiosity , I set it back to "false" again and works error clean ...

something is reset somehow.  Maybe cache, I dont know, but I'm sure I cleaned cache for the tests ...

Funny and strange ...

 
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on January 17, 2013, 03:35:52 PM
I'm glad that you got it working ;)
Title: Re: Google Translate for SMF 2.0
Post by: chereneb on March 05, 2013, 06:48:19 AM
I am using a custom theme (Gray Style). I installed Google Translate, but it doesnt work on my theme. Does anyone know what i have to do or change in index.template.php to make it work?



Title: Re: Google Translate for SMF 2.0
Post by: Shambles on March 05, 2013, 06:52:49 AM
You can click that picture of the pad and pen and it'll show you what the installer is looking for. Just take it from there.
Title: Re: Google Translate for SMF 2.0
Post by: chereneb on March 05, 2013, 07:13:55 AM
is it possible to translate posts only and not the whole forum?
Title: Re: Google Translate for SMF 2.0
Post by: Doburpally on May 28, 2013, 12:09:49 PM
No sorry, the script supplied by Google Translate site targets the whole site as a whole.
Title: Re: Google Translate for SMF 2.0
Post by: badon on August 23, 2013, 06:53:56 PM
I just tried installing the mod for SMF 1.1.18, but it didn't work. I don't think it modified the right file, and I don't think there's any configuration options added. Ideas?
Title: Re: Google Translate for SMF 2.0
Post by: simplebeer on April 30, 2015, 05:37:41 AM
Works great at 2.0.10!

Question:
The drop down menu is set on " select a language".
When i go to the drop down menu an choose a language it seems not possible to return to the option " select a language" , i can only choose other languages.
So for a user it seems no option to turn off this feature when you once choose te use it?

Is this right?
Title: Re: Google Translate for SMF 2.0
Post by: simplebeer on September 25, 2015, 04:25:38 AM
No one?

I hear from vistitors in china they can't see the tool, do you know this?

This is the site www.titaniumforum.nl

Maybe some foreign smf users can have a look and tell me if they see the tool or not?

Thanks!

Title: Re: Google Translate for SMF 2.0
Post by: Jade Elizabeth on December 15, 2015, 10:45:45 PM
People getting the undefined index aren't imagining it...

8: Undefined index: google_translate_analytics_id
Themes/default/index.template.php
Line: 361


That line is not calling a text string it's calling a value. It needs to use isset or !empty or something to validate there is a value there. You should be doing this for all the values.

gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',


// Google Translate Mod
if (!empty($modSettings['enable_google_translate']))
{
echo '
<table border="0" width="100%" height="55px">
<tr>
<td>
<div align="' . $modSettings['google_translate_location'] . '"><div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
pageLanguage: \''. $modSettings['google_translate_language'] . '\',
autoDisplay: \'' . $modSettings['google_translate_autodisplay'] . '\',
multilanguagePage: \'' . $modSettings['google_translate_multilanguage'] . '\',
gaTrack: \'' . $modSettings['google_translate_analytics'] . '\',
gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',
layout: google.translate.TranslateElement.InlineLayout.' . $modSettings['google_translate_style'] . '
  }, \'google_translate_element\');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div><br />
</td>
</tr>
</table>';
}
Title: Re: Google Translate for SMF 2.0
Post by: Jade Elizabeth on January 15, 2016, 10:22:52 PM
Hello? Can anyone help with a fix please? :)
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 15, 2016, 11:44:16 PM
Quote from: Jade Elizabeth on January 15, 2016, 10:22:52 PM
Hello? Can anyone help with a fix please? :)

Almost the same problem for me


8: Undefined index: google_translate_analytics_id
File: forum2/Themes/default/languages/ManageSettings.english.php (body_above sub template - eval?)
Line: 339




339 <li>Where a file already exists on your forum the &quot;Already Exists&quot; column will have one of two values. &quot;Identical&quot; indicates that the file already exists in an identical form and need not be overwritten. &quot;Different&quot; means that the contents vary in some way and overwriting is probably the optimum solution.</li>


By the way, I had un-installed 2 days ago and just re-installed.
One page refresh and go to the error log and the error was listed twice.


SMF ver 2.0.11

Themes:
Ostara (Overall forum default)
Habboland
Habbingo
Fresh Looks

MODs:
1.    Simple Menu Icons    1.0    
2.    Like Posts    2.0.5    
3.    SMF Gallery Lite    5.6    
4.    PM Warning    1.0    
5.    Topic Solved    1.1.1    
6.    Google Translate for SMF 2.0    1.4    
7.    SMF 2.0.11 Update    1.0    
8.    Optimus Brave    1.8.7    
9.    Default_Membergroup    2.0    
10.    Welcome Back    1.0    
11.    Enhanced Dropdown    1.3    
12.    Board-color-and-icons    1.1


Thank you in advance.

Just Me,
Siirist
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 16, 2016, 10:50:57 PM

** nudge **
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 18, 2016, 03:53:22 PM

Anyone have any ideas?
Title: Re: Google Translate for SMF 2.0
Post by: Jade Elizabeth on January 19, 2016, 01:44:52 AM
We have exactly the same error, you just need to disable template eval or enable it in settings. I can't remember which one but since it's a checkbox I would suggest clicking it ha ha.
Title: Re: Google Translate for SMF 2.0
Post by: villasg on January 19, 2016, 07:57:23 AM
Hi .
installed ok in my smf 2.0.11 greek-utf8 forum .
No errors .
The only have i check are :
In firefox and chrome banner language are correct ( greek )
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FW785b97.png&hash=8439cc8a5986b64f8be419e52be5777738e065f2)
In internet explorer and edge banner language are english
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FI8hexOl.png&hash=62bef562d29a0f9d8c44be118e387a66d26f4387)

my settings :
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FeJQtQiP.png&hash=7e5b4a3ee92e25803c206046362682d6452013a7)
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 19, 2016, 10:54:49 AM
Quote from: Jade Elizabeth on January 19, 2016, 01:44:52 AM
We have exactly the same error, you just need to disable template eval or enable it in settings. I can't remember which one but since it's a checkbox I would suggest clicking it ha ha.

Hi Jade,

So glad that you found such an easy solution!   :laugh:

I went to ACP >> Configuration >> Server Settings >> General  and found "Disable evaluation of templates" (which did NOT have a check in it).
I checked it.
I clicked on "Save" (so many users forget to do this  O:) )
I went to my error log and clicked on "Remove All" and then clicked on "Okay".
All errors were removed.
I refreshed the page and BAM

http://www.asanctuary.net/forum2/index.php?action=admin;area=serversettings;a6e19803f=ee0bd93b56b2c5e471ff3787f4ff1b41  (sa=admin <-is NOT present)
8: Undefined index: google_translate_analytics_id
File: /home1/asanctua/public_html/forum2/Themes/ostara1/index.template.php
Line: 339



I figured as it says "admin;area=serversettings;", your idea would correct it but as you can see it did not.  :(
SO,
I went to "Themes and Layout" and changed default theme from "Ostara" to "Fresh Look" (and clicked on "Save")
I went to my error log and clicked on "Remove All" and then clicked on "Okay".
All errors were removed.
I refreshed the page and BAM

http://www.asanctuary.net/forum2/index.php?action=admin;area=theme;a6e19803f=ee0bd93b56b2c5e471ff3787f4ff1b41;sa=admin <-(this is different because it is AFTER the numbers)
8: Undefined index: google_translate_analytics_id
File: /home1/asanctua/public_html/forum2/Themes/default/Themes.template.php (body_above sub template - eval?)
Line: 351


I went to "Themes and Layout" and changed default theme from "Fresh Look" to "SMF Default - Curve" (and clicked on "Save")
Oh my God, it is HORRIBLE!  No words for Home, Help, or Admin - see attachment
Anyway, I went to my error log and clicked on "Remove All" and then clicked on "Okay".
All errors were removed.
I refreshed the page and BAM

http://www.asanctuary.net/forum2/index.php?action=admin;area=theme;
sa=admin;a6e19803f=ee0bd93b56b2c5e471ff3787f4ff1b41
8: Undefined index: google_translate_analytics_id
File: /home1/asanctua/public_html/forum2/Themes/default/Themes.template.php (body_above sub template - eval?)
Line: 345


So, changing the theme moves the error to a different line.  Hmm...

Well, I hope all this will help anyone that knows something about this.

Be Well,
Siirist

PS ~ Please note that these errors do NOT seem to effect the appearance or function of the forum, so should I care?
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 19, 2016, 10:57:48 AM
Quote from: villasg on January 19, 2016, 07:57:23 AM
Hi .
installed ok in my smf 2.0.11 greek-utf8 forum .
No errors .
The only have i check are :
In firefox and chrome banner language are correct ( greek )
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FW785b97.png&hash=8439cc8a5986b64f8be419e52be5777738e065f2)
In internet explorer and edge banner language are english
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FI8hexOl.png&hash=62bef562d29a0f9d8c44be118e387a66d26f4387)

A link to your forum please. I have all three browsers.
Title: Re: Google Translate for SMF 2.0
Post by: Shambles on January 19, 2016, 11:22:10 AM
Quote from: Siirist on January 19, 2016, 10:54:49 AM
So, changing the theme moves the error to a different line.  Hmm...

You seem to have re-enabled template evaluation.
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 19, 2016, 12:02:05 PM
Quote from: Shambles on January 19, 2016, 11:22:10 AM
You seem to have re-enabled template evaluation.

Shambles,

Thank you for taking a look and your thoughts

Just went to look and the box is NOT checked.

Hmm...
Perhaps looking at the template's "code" (if they have code)?
Will unzip it on my laptop and have a look/see at it.

Siirist
Title: Re: Google Translate for SMF 2.0
Post by: Kindred on January 19, 2016, 12:14:55 PM
right... the box SHOULD BE checked... you need to DISABLE the eval in order to get the correct location of the actual error
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 19, 2016, 12:43:33 PM
Quote from: Kindred on January 19, 2016, 12:14:55 PM
right... the box SHOULD BE checked... you need to DISABLE the eval in order to get the correct location of the actual error

Hi Kindred!   :D

Well, I went in checked the box and saved. Went to the error log and removed all (48) errors.

Then I refreshed and got this:
http://www.asanctuary.net/forum2/index.php?action=admin;area=logs;sa=errorlog;desc
8: Undefined index: google_translate_analytics_id
File: /home1/asanctua/public_html/forum2/Themes/ostara1/index.template.php
Line: 339


Went to host and opened the file and went to line 339. Here is the results of 331-351 (I think that the extra lines of code are relevant).

331 <td>
332   <div align="' . $modSettings['google_translate_location'] . '"><div id="google_translate_element"></div><script 333 type="text/javascript">
333   function googleTranslateElementInit() {
334    new google.translate.TranslateElement({
335  pageLanguage: \''. $modSettings['google_translate_language'] . '\',
336  autoDisplay: \'' . $modSettings['google_translate_autodisplay'] . '\',
337  multilanguagePage: \'' . $modSettings['google_translate_multilanguage'] . '\',
338  gaTrack: \'' . $modSettings['google_translate_analytics'] . '\',
339  gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',
340  layout: google.translate.TranslateElement.InlineLayout.' . $modSettings['google_translate_style'] . '
341    }, \'google_translate_element\');
342  }
343  </script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div><br />
344  </td>
345  </tr>
346  </table>';
347  }
348  }
349
350  function template_body_below()
351  {


I manually inserted the line#s to ease reading the code. Don't know if any of this helps.  :-\

Thank you and Be Well,
Siirist
Title: Re: Google Translate for SMF 2.0
Post by: Kindred on January 19, 2016, 01:24:34 PM
the error is telling you that this line:
339     gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',
is the problem


it appears that the variable is not getting defined.

did you enter an GA ID into the mod settings and SAVE?
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 19, 2016, 01:43:51 PM
Quote from: Kindred on January 19, 2016, 01:24:34 PM
the error is telling you that this line:
339     gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',
is the problem


it appears that the variable is not getting definedHi

did you enter an GA ID into the mod settings and SAVE?

Kindred,

Thank you for pointing this out.  To the best of my knowledge, I did NOT.

I went in and checked the index.template.php~ , and here are line# 338-340

338         <li class="copyright">', theme_copyright(), '</li>
339         <li class="copyright">',$txt['runic_copy'],'</li>
340         <li><a id="button_xhtml" href="http://validator.w3.org/check/referer" target="_blank" class="new_win" title="',

This would indicate that the MOD was not installed at the last back-up.

Should I just "fake it" and modify Line# 339 to:
  \'' . $modSettings['google_translate_analytics_id'] . '\',

DOH!!  I know better than that!
With my Test Forum running SMF ver. 2.0.11 (need to upgrade it) and the same Themes and Mods, I should load the mod into my Test Forum.
And THEN play around with the index.template.php

Is this the recommended way to go?

Be Well,
Siirist
Title: Re: Google Translate for SMF 2.0
Post by: Kindred on January 19, 2016, 02:01:47 PM
ummm.....  no

why don't you just go enter the data in the admin settings for this mod?
if you never entered the values, that is why the variable is undefined.
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 19, 2016, 04:26:44 PM
Quote from: Kindred on January 19, 2016, 02:01:47 PM
ummm.....  no

why don't you just go enter the data in the admin settings for this mod?
if you never entered the values, that is why the variable is undefined.

Went and got my id,
put it in there,
still got the same error,
went to the file and manually put the # in between the ' and ' ,
no change - same error,
went back to the file and removed ' and ' ,
this time the error said the address was bad,
went to the file and replaced the ' and ' ,
at this time I am now getting the following:

Today at 02:17:45 PM
Only show the error messages of this session 3ecc804045df31216e15ed11f3c8a72f
Only show the errors of this type Type of error: Undefined
Only show the error messages of this URL
http://www.asanctuary.net/forum2/index.php?action=admin;area=logs;sa=errorlog;desc
8: Undefined index: UA-72631001-1
File: /home1/asanctua/public_html/forum2/Themes/ostara1/index.template.php
Line: 339

I am done with this. It is way to frustrating.  Unless a viable solution appears, I will un-install in 6 hours.

Siirist
Title: Re: Google Translate for SMF 2.0
Post by: Kindred on January 19, 2016, 05:30:15 PM
why would you have done any of that other stuff?   You don't change CODE for this...  the probloem is in the CONFIGURATION... it just happens to be showing up when the setting is called.
Title: Re: Google Translate for SMF 2.0
Post by: Jade Elizabeth on January 20, 2016, 09:29:49 PM
Quote from: Kindred on January 19, 2016, 05:30:15 PM
why would you have done any of that other stuff?   You don't change CODE for this...  the probloem is in the CONFIGURATION... it just happens to be showing up when the setting is called.

No actually the problem is the code. The setting on mine says not to use the analytics id, it's set to false, but false is ignored in the code and it tries to call an id that's not entered, and we get this error. The setting on Siirist's says to use the analytics id, which has been entered, and it is not being put in there either. Somewhere, the ball is being dropped on this variable.



Siirist: Disabling template eval won't solve the issue, it will just make SMF show you the exact location of errors. With it enabled like you had before no one can really help you fix any errors because SMF can't tell anyone where they are exactly :).
Title: Re: Google Translate for SMF 2.0
Post by: Kindred on January 20, 2016, 09:42:46 PM
well, if you have tracked it that far -- then yes...   however, none of the stuff that Siirist was trying to do (and breaking things while doing) would have any effect on the root issue.

1- IS a value entered for the ID in the configuration
  -- if no, then enter something
  -- if yes, and this error still occurs, then the variable is not getting properly written into (or maybe read out of) the context array

2- check the variable/index name in the code where the mod settings are getting set...
  -- is the SAME variable/index name being written into $context which this code is trying to read out?
     -- if no, then that is the problem. Match/sync the variable/index names
     -- if yes, then the issue occurs after the variable/index is written INTO the array (and it looks like the array loses the variable/index

3- further analysis is needed
Title: Re: Google Translate for SMF 2.0
Post by: Siirist on January 20, 2016, 10:32:51 PM
Hey Kindred,

I apologize for all the heartache.

As pointed out earlier, I am using SMF ver 2.0.11 and Ostara1 is the forum's default theme.

Okay, so I went to uninstall and got Failures with the Ostara1 theme.
I did NOT uninstall, instead I went to the theme and parsed it for ver. 2.0.11

The code that it called for to be installed in the themes/default/index.template.php
I removed from themes/ostara1/index.template.php
I removed 6200 errors from the log.
I refreshed the page and NO ERRORS!!!   ;D

APPARENTLY this MOD is NOT COMPATIBLE with OSTARA1.

I have reset the forum's default theme to Fresh Leaf.

Thank you for all your thoughts on this.

Be Well,
Siirist
Title: Re: Google Translate for SMF 2.0
Post by: Jade Elizabeth on January 21, 2016, 01:05:12 PM
Quote from: Siirist on January 20, 2016, 10:32:51 PM
APPARENTLY this MOD is NOT COMPATIBLE with OSTARA1.

Those errors weren't actual errors, they weren't breaking things they were more annoying warnings that the code couldn't find a value. It doesn't matter what theme you use for the mod you will get the error.

Quote from: Kindred on January 20, 2016, 09:42:46 PM
well, if you have tracked it that far -- then yes...   however, none of the stuff that Siirist was trying to do (and breaking things while doing) would have any effect on the root issue.

1- IS a value entered for the ID in the configuration
  -- if no, then enter something
  -- if yes, and this error still occurs, then the variable is not getting properly written into (or maybe read out of) the context array

2- check the variable/index name in the code where the mod settings are getting set...
  -- is the SAME variable/index name being written into $context which this code is trying to read out?
     -- if no, then that is the problem. Match/sync the variable/index names
     -- if yes, then the issue occurs after the variable/index is written INTO the array (and it looks like the array loses the variable/index

3- further analysis is needed


Yep, it's failing to get a variable when there is one and to recognise it shouldn't be getting one when it's set not to.
Title: Re: Google Translate for SMF 2.0
Post by: TKW on February 20, 2016, 03:21:24 AM
Quote from: Doburpally on April 04, 2012, 07:13:22 AM
You can fix it by editing index.template.php
Find:// Google Translate Mod
echo'
<br />
<div align="right"><div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: \'auto\',
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, \'google_translate_element\');
}</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>';


Change the following:
    pageLanguage: \'auto\',

with one of the following language codes to your forum language:
Eg:
English forum = en

af = AFRIKAANS
sq = ALBANIAN
ar = ARABIC
be = BELARUSIAN
bg = BULGARIAN
ca = CATALAN
zh-CN = CHINESE_SIMPLIFIED
zh-TW = CHINESE_TRADITIONAL
hr = CROATIAN
cs = CZECH
da = DANISH
nl = DUTCH
en = ENGLISH
eo = ESPERANTO
et = ESTONIAN
tl = FILIPINO
fi = FINNISH
fr = FRENCH
de = GERMAN
el = GREEK
ht = HAITIAN_CREOLE
iw = HEBREW
hi = HINDI
hu = HUNGARIAN
is = ICELANDIC
id = INDONESIAN
ga = IRISH
it = ITALIAN
vc = JAPANESE
ko = KOREAN
lv = LATVIAN
lt = LITHUANIAN
mk = MACEDONIAN
ms = MALAY
mt = MALTESE
no = NORWEGIAN
fa = PERSIAN
pl = POLISH
pt = PORTUGUESE
pt-br = PORTUGUESE_BRAZ
ro = ROMANIAN
ru = RUSSIAN
sr = SERBIAN
sk = SLOVAK
sl = SLOVENIAN
es = SPANISH
sw = SWAHILI
sv = SWEDISH
th = THAI
tr = TURKISH
uk = UKRAINIAN
vi = VIETNAMESE
cy = WELSH
yi = YIDDISH

I am working on a Admin settings page but atm it's not going too good.

I don't have this code.  I'm trying to edit what languages are in the list, and what order they are listed.  is this possible?
Title: Re: Google Translate for SMF 2.0
Post by: badon on August 10, 2016, 01:29:27 AM
For some reason all the settings for this mod are appearing screwed-up, after years of working perfectly. The form fields aren't displaying properly. Any ideas what's going on?
Title: Re: Google Translate for SMF 2.0
Post by: landyvlad on February 02, 2017, 07:06:03 AM
Before I attempt to install this - does anyone know if it's working now?
Title: Re: Google Translate for SMF 2.0
Post by: badon on February 03, 2017, 02:45:41 AM
It has been a while since I've tinkered with it, but at the last SMF 2.0.13 update, it still had UI problems.
Title: Re: Google Translate for SMF 2.0
Post by: landyvlad on February 03, 2017, 08:34:02 AM
bugger...
Title: Re: Google Translate for SMF 2.0
Post by: landyvlad on February 05, 2017, 07:30:38 AM
Out of interest... I don't think the mod author has logged in here for 12 months.... has someone else got carriage of this mod or is it kinda "dead in the water"?
Title: Re: Google Translate for SMF 2.0
Post by: bravoure on April 09, 2017, 04:02:20 PM
Quote from: Jade Elizabeth on January 20, 2016, 09:29:49 PM
Quote from: Kindred on January 19, 2016, 05:30:15 PM
why would you have done any of that other stuff?   You don't change CODE for this...  the probloem is in the CONFIGURATION... it just happens to be showing up when the setting is called.

No actually the problem is the code. The setting on mine says not to use the analytics id, it's set to false, but false is ignored in the code and it tries to call an id that's not entered, and we get this error. The setting on Siirist's says to use the analytics id, which has been entered, and it is not being put in there either. Somewhere, the ball is being dropped on this variable.



Siirist: Disabling template eval won't solve the issue, it will just make SMF show you the exact location of errors. With it enabled like you had before no one can really help you fix any errors because SMF can't tell anyone where they are exactly :).

change into index.template.php

gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',

to

gaId: \'' . (isset($modSettings['google_translate_analytics_id'])?$modSettings['google_translate_analytics_id']:'') . '\',
Title: Re: Google Translate for SMF 2.0
Post by: Secureas on August 25, 2018, 09:36:06 PM
Hello I am using this mod and it appears everywhere and works, the only problem I have found is that it does not appear on a post in the forum?
Title: Re: Google Translate for SMF 2.0
Post by: jsx on December 17, 2020, 01:03:50 PM
I wonder if it is possible to prevent the translation of usernames by the Google Translate. Does anyone know if it can be changed?
Title: Re: Google Translate for SMF 2.0
Post by: Shades. on June 21, 2021, 04:04:50 AM
So this mod is for 2.0.3 but I have it installed in 2.0.18 and everything works on the front end but getting these errors in admin:
Quotehttps://xxxxx.com/index.php?
8: Undefined index: google_translate_analytics_id
File: /home2/xxxxx/public_html/xxxxx/Themes/xxxxx/index.template.php
Line: 374

#0 /Sources/Load.php(2135): template_body_above()
#1 /Sources/Subs.php(3530): loadSubTemplate(string, boolean)
#2 /Sources/Subs.php(2975): template_header()
#3 /index.php(193): obExit(NULL, boolean, boolean)
#4 {main}

Any ideas on the fix?
Title: Re: Google Translate for SMF 2.0
Post by: @rjen on June 21, 2021, 06:05:27 AM
I am guessing you did not enter a 'google_translate_analytics_id' in the settings section of the mod?
Title: Re: Google Translate for SMF 2.0
Post by: Shades. on June 21, 2021, 08:26:42 AM
No I didn't do that because it says "Track translation traffic using Google Analytics." and the option is set to "False". But I guess the "google_translate_analytics_id" is required then. :o
Title: Re: Google Translate for SMF 2.0
Post by: Shades. on June 21, 2021, 08:52:50 AM
So apparently you have to install the "GoogleAnalytics" mod then enter your "GoogleAnalytics ID" in both places and set the "Track translation traffic using Google Analytics." option to "True". After doing that I have no more errors. Thanks for the assist! 8)
Title: Re: Google Translate for SMF 2.0
Post by: @rjen on June 21, 2021, 09:02:57 AM
Quote from: Shades. on June 21, 2021, 08:26:42 AM
No I didn't do that because it says "Track translation traffic using Google Analytics." and the option is set to "False". But I guess the "google_translate_analytics_id" is required then. :o

I checked the code, and it does not validate if a value is provided, hence the error. So you can change the MOD code to check or just provide a value...