News:

Wondering if this will always be free?  See why free is better.

Main Menu

Google Translate for SMF 2.0

Started by Doburpally, October 27, 2011, 07:34:55 PM

Previous topic - Next topic

simplebeer

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!

Sorry for my poor English, but i think it's probably better then your Dutch :)

Jade Elizabeth

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>';
}
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Jade Elizabeth

Hello? Can anyone help with a fix please? :)
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Siirist

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
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Siirist

Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Siirist

Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Jade Elizabeth

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.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

villasg

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 )

In internet explorer and edge banner language are english


my settings :

Siirist

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?
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Siirist

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 )

In internet explorer and edge banner language are english


A link to your forum please. I have all three browsers.
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Shambles

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.

Siirist

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
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Kindred

right... the box SHOULD BE checked... you need to DISABLE the eval in order to get the correct location of the actual error
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Siirist

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
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Kindred

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?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Siirist

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
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Kindred

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.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Siirist

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
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Kindred

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.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Jade Elizabeth

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 :).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Advertisement: