• Welcome to Simple Machines Community Forum. Please login or sign up.
December 03, 2021, 12:48:26 AM

News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord


Google Translate for SMF 2.0

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

Previous topic - Next topic

Kindred

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
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Siirist

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
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

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

TKW

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?

badon

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?

landyvlad

Before I attempt to install this - does anyone know if it's working now?
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

To paraphrase Kindred: "There are no technical solutions to social problems."

badon

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.

landyvlad

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

To paraphrase Kindred: "There are no technical solutions to social problems."

landyvlad

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"?
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

To paraphrase Kindred: "There are no technical solutions to social problems."

bravoure

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']:'') . '\',

Secureas

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?

jsx

I wonder if it is possible to prevent the translation of usernames by the Google Translate. Does anyone know if it can be changed?

Shades.

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?

ShadesWeb.com - Custom Logos
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

@rjen

I am guessing you did not enter a 'google_translate_analytics_id' in the settings section of the mod?
Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

Shades.

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

ShadesWeb.com - Custom Logos
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

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)

ShadesWeb.com - Custom Logos
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

@rjen

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...
Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

Advertisement: