Google Translate for SMF 2.0

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

Previous topic - Next topic

teos55

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

Doburpally

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.
Find Manual Install Instructions for SMF ensure it's on 2.0.3 and then click on Parse button.


  • ./Sources/ManageSettings.php
  • ./Themes/default/index.template.php
  • ./Themes/default/languages/Modifications.english.php
  • ./Themes/default/languages/Modifications.english-utf8.php
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

teos55

#62
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.

Doburpally

#63
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. ;)

teos55

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.

Doburpally

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

teos55

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





Doburpally

Out of curiosity, what language template is your forum using?

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

Eg Modifications.italian.php

teos55

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.

teos55

In the settings I set it use analytics with uid, guess what ?  runs clear ...

So,  "false" logic fails , in my opinion ...

Doburpally

#70
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]

teos55

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

teos55

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

 

Doburpally


chereneb

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?




Shambles

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.

chereneb

is it possible to translate posts only and not the whole forum?

Doburpally

No sorry, the script supplied by Google Translate site targets the whole site as a whole.

badon

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?

simplebeer

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?
Sorry for my poor English, but i think it's probably better then your Dutch :)

Advertisement: