PDA

View Full Version : Integration with vBulletin - Google's website translator


linuxututs
01-01-2010, 10:00 PM
Google's website translator

Translate your website with Google: Expand your audience globally

Live Demo: LinuxTuts (http://www.linuxtuts.net/forum/)

This is straight from google and is nothing compared to "NLP-er's (https://vborg.vbsupport.ru/showthread.php?t=220886)" translator Mod for 3.8x version of vBulletin.

But if you're like me and had That translator Mod installed and have people from different parts of the world already visiting your website, you have to do something while That Mod is getting upgraded.

Here's How...

1) Copy/paste this code into the bottom of your "header" template.

<div align="right">
<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</div>

2) Here's the official API code from google to put into your "headinclude" template.
Including the Transliteration API on Your Page

AJAX Transliteration API is packaged under the "elements" module. To include the Google Transliteration API in your page, first you need the Google AJAX APIs script tag:

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

This script tag will load the google.load function, which lets you load the individual Google APIs. For loading Google Transliteration API, calls to google.load look like this:

<script type="text/javascript">
google.load("elements", "1", {
packages: "transliteration"
});
</script>

That's a quote from google.

Here's the code again for you to copy/paste into your "headinclude" template.

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("elements", "1", {
packages: "transliteration"
});
</script>

Mine worked without the API, but I figure this makes it load faster and work better.
I'm no programmer/coder, but I get by with my own few little hacks and just thought some of you might like this as well until something better comes along.

Official Google resources are Here.
http://translate.google.com/translate_tools?hl=en&layout=1&eotf=1
and
http://code.google.com/apis/ajaxlanguage/documentation/#TransliterationApiLoading

BlackJacket
01-01-2010, 11:22 PM
Thanks! :)

linuxututs
01-01-2010, 11:26 PM
Its nothing really, but a google gadget, but it gets the job done, and its quick to.

I'm sure alot of webmasters here no of this but just thought I'd help a few of you out who didn't.

Thanks,

sebaldus
01-02-2010, 03:31 AM
Thanks from me to..:)

edwinlar
01-03-2010, 02:19 AM
thank from melchorsito guatemala

KevinGupta
01-03-2010, 06:10 AM
hey.. sorry but I will wait for something better... It made my website load a little slower...once I removed it .. It works just fine :)
I would love to have it on my website .... :( but something that will not affect the loading of the website lol

Thanks a lot for this but :)

linuxututs
01-03-2010, 10:49 AM
It only slows down when your actually translating a page.

vBulletin 4.0.0 Debug Information

* Page Generation 0.74765 seconds
* Memory Usage 33,746KB
* Queries Executed 17

And that's a slow page load. Usually average around the .5 area on my site....

Thanks,

Vaupell
01-05-2010, 03:14 PM
Thank you, like it..

i often use google translater for other sites, manually.
but would ofcourse offer my visitors and alternative :D

rated 5 :D

bandare
01-05-2010, 03:33 PM
Superb addition!

linuxututs
01-13-2010, 05:48 AM
Just to let everyone know, I have switched to using this Mod from NLP-er.
Witch can be found HERE (https://vborg.vbsupport.ru/showthread.php?t=232456).

This is still a Great little tool/hack, but I choose to use the other for SEO purposes.
If not for that I'd stay with this one here.

Thanks,

twizzler
01-22-2010, 02:25 PM
Seems to be good one, but I will wait a bit

jnrdavo
01-28-2010, 06:49 PM
anybody know a way to get it to be inline with the main logo of the forum?

Mines sitting just below (and to the right), taking up unwanted space... I would really like it to be under the Welcome message if possible...

Happy to post up a link to the site if required.

linuxututs
02-11-2010, 07:17 PM
Ok, I can get above the logo by finding...

{vb:raw ad_location.ad_header_logo}

and place this code "below" it...

<div align="justify"><div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>

I'm fixing to figure out how to get it below the navbar and to the right...

linuxututs
02-11-2010, 09:06 PM
If navigate to "Navigation / Breadcrumb Templates "
Then to "navbar"

And place this code at the end of the file you can get it to line up at the right below your navbar as well.


<div align="right"><div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div>


Think I will be leaving it there Myself.

Its fast to.

jnrdavo
03-13-2010, 07:47 PM
great hack, but how can I get it to sit up here...

First pic is existing location
http://www.ozvolks.com/forums/google.png

Second pic is where I want it to be...
http://www.ozvolks.com/forums/google2.png

Any help appreciated...

DieselMinded
06-21-2010, 04:54 PM
thanks worked great

speakeasy media
07-03-2010, 04:13 PM
When I place the Google script code at the bottom of the header template (or anywhere else in any template, for that matter) it gives me an internal server error.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [my email address] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

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

The error log says:
[Sat Jul 03 13:12:42 2010] [error] [client 200.62.106.103] File does not exist: /home... .../admincp/template.php?s=&do=edit&templateid=4047&group=&searchstring=&expandset=2[/url]

I can make minor non-code changes and it saves just fine, but not this. And I have several customized templates.

So I'm lost and don't know what to do...

speakeasy media
07-08-2010, 08:11 PM
So I guess I'm the only one with this problem.

friendlymela
10-16-2015, 07:01 AM
any screenshot for this?