PDA

View Full Version : Mini Mods - Quick "Translate This Page" Link


RWerksman
12-28-2007, 10:00 PM
This modification adds a drop down box in the lower right corner of each page directly under the Forum Jump Box that is currently there. When a user selects an option from this box, they'll be forwarded on to a Google translation of the page at hand.

Please note that when viewing the translated version of this page, the user will not be logged in.

In the forumjump template, look for:

<br /><br />

and

</div>

Place the following code between the two entires:



<strong>Translate This Page<br />
<form action="http://translate.google.com/translate" method="post">
<input type="hidden" name="u" value="http://YOURSITE.COM/$scriptpath" />
<select name="langpair" onchange="this.form.submit();">
<option value="en|de">English to German</option>
<option value="en|nl">English to Dutch</option>
<option value="en|es">English to Spanish</option>
<option value="en|fr">English to French</option>
<option value="en|it">English to Italian</option>
<option value="en|pt">English to Portuguese</option>
<option value="en|ko">English to Korean</option>
<option value="en|ja">English to Japanese</option>
<option value="en|ar">English to Arabic</option>
<option value="de|en">German to English</option>
<option value="de|nl">German to Dutch</option>
<option value="de|es">German to Spanish</option>
<option value="de|fr">German to French</option>
<option value="de|it">German to Italian</option>
<option value="de|pt">German to Portuguese</option>
<option value="de|ko">German to Korean</option>
<option value="de|ja">German to Japanese</option>
<option value="de|ar">German to Arabic</option>
<option value="nl|en">Dutch to English</option>
<option value="nl|de">Dutch to German</option>
<option value="nl|es">Dutch to Spanish</option>
<option value="nl|fr">Dutch to French</option>
<option value="nl|it">Dutch to Italian</option>
<option value="nl|pt">Dutch to Portuguese</option>
<option value="nl|ko">Dutch to Korean</option>
<option value="nl|ja">Dutch to Japanese</option>
<option value="nl|ar">Dutch to Arabic</option>
<option value="es|en">Spanish to English</option>
<option value="es|de">Spanish to German</option>
<option value="es|nl">Spanish to Dutch</option>
<option value="es|fr">Spanish to French</option>
<option value="es|it">Spanish to Italian</option>
<option value="es|pt">Spanish to Portuguese</option>
<option value="es|ko">Spanish to Korean</option>
<option value="es|ja">Spanish to Japanese</option>
<option value="es|ar">Spanish to Arabic</option>
<option value="fr|en">French to English</option>
<option value="fr|de">French to German</option>
<option value="fr|nl">French to Dutch</option>
<option value="fr|es">French to Spanish</option>
<option value="fr|it">French to Italian</option>
<option value="fr|pt">French to Portuguese</option>
<option value="fr|ko">French to Korean</option>
<option value="fr|ja">French to Japanese</option>
<option value="fr|ar">French to Arabic</option>
<option value="it|en">Italian to English</option>
<option value="it|de">Italian to German</option>
<option value="it|nl">Italian to Dutch</option>
<option value="it|es">Italian to Spanish</option>
<option value="it|fr">Italian to French</option>
<option value="it|pt">Italian to Portuguese</option>
<option value="it|ko">Italian to Korean</option>
<option value="it|ja">Italian to Japanese</option>
<option value="it|ar">Italian to Arabic</option>
</select>
<input type="hidden" name="hl" value="en" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="hidden" name="oe" value="UTF-8" />
<input type="hidden" name="safe" value="active" />
<input type="hidden" name="prev" value="/language_tools" />
</select>$gobutton
</form>


Make sure that you change the YOURSITE.COM to the correct domain name.

Save.

Enjoy.


Credit goes to oldfan (for his or her post here (https://vborg.vbsupport.ru/showpost.php?p=1313815&postcount=48)) that I tweaked to make work better. :D


For a demo of what this looks like go here: http://f800riders.org/forum/forumdisplay.php?f=67

RWerksman
12-29-2007, 03:45 AM
Reserved

iogames
12-29-2007, 04:48 AM
This is great! why nobody is installing??? :confused:

RWerksman
12-29-2007, 05:12 AM
This is great! why nobody is installing??? :confused:
Probably because it was just posted today :D

iogames
12-29-2007, 06:08 AM
Whenever I translate the site, it automatically logs me out of the site and says that the admin must add the URL to the whitelist. Can you fix this issue?

RWerksman
12-29-2007, 10:15 PM
Admin CP -> vBulletin Options -> General Settings

Add translate.google.com to the Post Referrer Whitelist.

Save.

rcwild
12-29-2007, 11:18 PM
Cool.

Our site gets visitors from around the world, so the translation will add convenience. Would be even nicer if it was more obvious to users. Would be awesome if it was near the top of the page and included country flags to indicate languages, with image linked to the correct translation.

iogames
12-30-2007, 04:23 PM
Cool.

Our site gets visitors from around the world, so the translation will add convenience. Would be even nicer if it was more obvious to users. Would be awesome if it was near the top of the page and included country flags to indicate languages, with image linked to the correct translation.

Mine just stopped working! :confused: I just upgraded vBSEO...
Yes the flags could be a nice addition!

<div align="left">
<strong>Translate Forum<br />
<form action="http://translate.google.com/translate" method="post">
<input type="hidden" name="u" value="http://iogames.com/$scriptpath" />
<select name="langpair" onchange="this.form.submit();">
<option value="en|es">English -> Spanish</option>
<option value="en|ja">English -> Japanese</option>
<option value="en|de">English -> German</option>
<option value="en|fr">English -> French</option>
<option value="en|it">English -> Italian</option>
<option value="en|nl">English -> Dutch</option>
<option value="en|pt">English -> Portuguese</option>
<option value="en|ko">English -> Korean</option>
<option value="en|ar">English -> Arabic</option>
</select>
<input type="hidden" name="hl" value="en" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="hidden" name="oe" value="UTF-8" />
<input type="hidden" name="safe" value="active" />
<input type="hidden" name="prev" value="/language_tools" />
</select>$gobutton
</form>

RWerksman
12-30-2007, 06:39 PM
Mine just stopped working! :confused: I just upgraded vBSEO...
Yes the flags could be a nice addition!
I have no plans to include flags as they represent countries, not languages.

I currently don't have vBSEO installed, is there somewhere that I can see this not working on your site?

iogames
01-04-2008, 06:46 PM
Well after a few hours I've improved mine alot!

http://chat.iogames.com/ ;)

even I put flags :D

rcwild
01-05-2008, 03:50 PM
Well after a few hours I've improved mine alot!

http://chat.iogames.com/ ;)

even I put flags :D

That is AWESOME! How did you do it?

Netaudio
01-05-2008, 05:26 PM
Thx! Installed...

SuperTaz
01-06-2008, 08:26 AM
I dont have the double <br /> code in my template, just one. Where should I put your code at?


<div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
<form action="forumdisplay.php" method="get">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="daysprune" value="$daysprune" />
<strong>$vbphrase[forum_jump]</strong><br />
<select name="f" onchange="this.form.submit();">
<optgroup label="$vbphrase[site_areas]">
<option value="cp" $frmjmpsel[usercp]>$vbphrase[user_control_panel]</option>
<option value="pm" $frmjmpsel[pm]>$vbphrase[private_messages]</option>
<option value="subs" $frmjmpsel[subs]>$vbphrase[subscriptions]</option>
<option value="wol" $frmjmpsel[wol]>$vbphrase[whos_online]</option>
<option value="search" $frmjmpsel[search]>$vbphrase[search_forums]</option>
<option value="home" $frmjmpsel[home]>$vbphrase[forums_home]</option>
</optgroup>
<optgroup label="$vbphrase[forums]">
$jumpforumbits
</optgroup>
</select>$gobutton
</form>
</div>

wim s
01-06-2008, 02:07 PM
install

RWerksman
01-07-2008, 02:31 AM
Warden,

I'd put it in right above the </div> and after the form end. You might need to plop a line break or two in there for it to look right.

RWerksman
01-07-2008, 02:32 AM
install
Click the install button please - don't just post it in the notes. :)

wim s
01-07-2008, 06:10 PM
sleeping ;), done now.

ginnser
01-10-2008, 04:53 AM
THANKS VERY MUCH!!!

This was just what I was looking for, surprised so few people have installed this

Mark

SBlueman
01-10-2008, 05:30 AM
Admin CP -> vBulletin Options -> General Settings

Add translate.google.com to the Post Referrer Whitelist.

Save.

Still logs me out even after adding this link to the Post Referrer Whitelist.

ginnser
01-13-2008, 06:26 AM
I see from the Google Translate site that Chinese translation is supported, how do i amend the code to have English to Chinese (Simp and Trad) ?

Also would like to move the translate button from the Jump page, to somewhere higher up the page, can anyone sugguest a suitable location and the code !

Much appreicated

fishhub
02-02-2008, 01:43 PM
Still logs me out even after adding this link to the Post Referrer Whitelist.

I get this too! any kind soul can sort this.:o

RWerksman
02-03-2008, 10:57 PM
Adding to the post referrer whitelist doesn't prevent you from being logged out, it enables the translation to function without the the error message.

In any case, you can click on the back button and continue to be logged in.

RWerksman
02-03-2008, 11:03 PM
You might want to try placing it in the footer perhaps.

For English to Chinese (Simp & Trad) you can add these two lines:

<option value="en|zh-CN">English to Chinese Simplified</option>
<option value="en|zh-TW">English to Chinese Traditional</option>

CareyG
02-07-2008, 02:33 PM
I keep getting this error.

The requested URL /scriptpath was not found on this server.

CareyG
02-07-2008, 02:35 PM
and this..

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

CareyG
02-12-2008, 04:26 PM
Can anyone help me out with this? Please?

RWerksman
02-12-2008, 07:14 PM
Did you follow the directions? Check the following line:


<input type="hidden" name="u" value="http://YOURSITE.COM/$scriptpath" />


Make sure that your website is in there correctly. It probably isn't.

CareyG
02-17-2008, 04:14 PM
I have my website in correctly, I keep trying different ways and still nothing. Which one am I supposed to be using?

http://www.mysite.com
http://www.mysite.com/forum
http://mysite.com
http://mysite.com/forum


I have tried them all and it still wont work.

And I get this error as well.

Apache/1.3.39 Server at streakgaming.com Port 80

ginnser
03-29-2008, 09:51 AM
Thanks for the Chinese bit

One question, I woul like to put the Translate option higher up the page, near the top so that people can see it without scrolling down, how do i do that?

Much appreciated

Brady1505
03-31-2008, 07:41 AM
I have my website in correctly, I keep trying different ways and still nothing. Which one am I supposed to be using?

http://www.mysite.com
http://www.mysite.com/forum
http://mysite.com
http://mysite.com/forum


I have tried them all and it still wont work.

And I get this error as well.

Apache/1.3.39 Server at streakgaming.com Port 80

Sorry, does not anybody has an answer to this question?
I also entered my domain correctly, but I get a "page not found" when Google tries to translate it.
How do I have to replace it correctly?
Wheather
<input type="hidden" name="u" value="http://www.mysite.de/forum/$scriptpath" />
nor
<input type="hidden" name="u" value="http://www.mysite.de/$scriptpath" /> work.
Think, the first has to work ...
Does the script not know the variable $scriptpath?

Thanks.
Brady

Brady1505
03-31-2008, 08:06 AM
Got it. Try and error ...

<input type="hidden" name="u" value="www.mysite.de$scriptpath" />

works correctly.

Brady

zerokun
03-31-2008, 11:05 AM
Wow,
I have built it some days before and found this thread today. :)

Now, If you want to remove the frame above your translated page, replace this link: http://translate.google.com/translate by http://www.google.com/translate_p.

To apply for all website (php site), you can use this link http://$_SERVER[SERVER_NAME]$scriptpath:
EX:
<input type="hidden" name="u" value="http://$_SERVER[SERVER_NAME]$scriptpath" />
replace for <input type="hidden" name="u" value="http://YOURSITE.COM/$scriptpath" />


demo: http://www.ue-global.com (the translation at the top of the page)

regards,
zerokun

frankybme
08-02-2008, 06:47 PM
Do these translated pages get indexed in the search engines?

yotsume
09-01-2008, 08:15 PM
Will this work if my forum is only viewable to registered members only? Also, my forum is v3.7.3

segwayon
10-23-2008, 04:31 AM
Wow,
I have built it some days before and found this thread today. :)

Now, If you want to remove the frame above your translated page, replace this link: http://translate.google.com/translate by http://www.google.com/translate_p.

To apply for all website (php site), you can use this link http://$_SERVER[SERVER_NAME]$scriptpath:
EX:
<input type="hidden" name="u" value="http://$_SERVER[SERVER_NAME]$scriptpath" />
replace for <input type="hidden" name="u" value="http://YOURSITE.COM/$scriptpath" />


demo: http://www.ue-global.com (the translation at the top of the page)

regards,
zerokun

Slick language selector you have on your website. It changes all the text without reloading the whole webpage, and allows users to re-select English easily. May I ask how you do that?

I altered this mod as you directed and yes the framing is gone now. But I wonder how to allow a user to choose English again after browsing some languages, as Google shows an error page stating that English-to-English translations are not supported. With the framing the users had an option for reverting back to the original language.

segwayon
10-23-2008, 04:43 AM
Will this work if my forum is only viewable to registered members only? Also, my forum is v3.7.3

Yes, as this translation feature is on your forum, and if non-members can't reach your forum then they won't be able to reach this feature either.

Now, if you allow non-members to view the forum but only want to provide this translation feature to registered members, then place these lines of code around this mod's whole section of code:

<if condition="$bbuserinfo['userid']">
(this mod's code)
</if>

We use this mod on 3.7.3 without any problems, by the way.

wraggster
11-01-2008, 11:34 PM
this looks fantastic but is the mod the same one thats on the forum now

http://f800riders.org/forum/forumdisplay.php?f=67

because that mod looks a lot better than what the code implies.

im also curious to know if this bring visitors from other regions of world ?

chick
01-28-2009, 05:51 PM
this looks fantastic but is the mod the same one thats on the forum now

http://f800riders.org/forum/forumdisplay.php?f=67

because that mod looks a lot better than what the code implies.

im also curious to know if this bring visitors from other regions of world ?

is this mod the same???

Meestor_X
08-14-2009, 05:15 AM
http://f800riders.org/forum/forumdisplay.php?f=67 (http://f800riders.org/forum/forumdisplay.php?f=67)

You must have added to this mod. There's drop-down at the top left of the page as well as one to the right of the forum style chooser.

What's the code for the mod as it shows on your forum?

DieselMinded
06-21-2010, 04:31 PM
is this available for vb 4 ?