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

Doburpally

Link to Mod

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:
  • SMF 1.1.10 - 1.1.16
  • SMF 2.0 RC4 & 2.0 RC5
  • SMF 2.0
  • SMF 2.0.x

Version History:
  • v1.3 (18 April 2012)
    • (SMF 1.1.xx & SMF 2.0.x) Added table to predefine space on page, this prevents the annoying page drop when google translate appears in its position. Thanks to Simtronx
  • v1.2 (24 March 2012)
    • Added Auto Detect forum language.
    • 27 March 2012 Added support for SMF 1.1.10 - 1.1.16 Thanks to samurai-lupin
  • v1.1 (16 January 2012)
    • Added location selection (left | center | right)
    • Added style selection (Horizontal | Drop down only | Vertical)
  • v1.0 (September 2011)
    • Initial Release
    • For SMF 2.0 only

krash661

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

Bugo

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

Mick.

Nice to see someone took my tut and made it into a mod.

Doburpally

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

Doburpally

#5
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 ;)

Mick.

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.

Doburpally

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.

traveler1

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.

4Kstore

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

¡¡NEW MOD: Sparkles User Names!!!

Doburpally

#10
@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.


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

BTW, nice site :)

Kreator

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

Doburpally

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

Kreator

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

Doburpally


warrior4christ

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.

That, that is, is, that, that is not, is not, is that it? It is!

crobbe

Is there away to get this mod so I can place it whereever I want, The position messes up my forum links section.

Doburpally

#17
@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.

Doburpally

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

Doburpally

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

Advertisement: