vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   End-User Options - Forum Translator by Google (https://vborg.vbsupport.ru/showthread.php?t=258009)

Infopro 01-28-2011 10:00 PM

Forum Translator by Google
 
1 Attachment(s)
I'm not sure if anyone else has posted this, if so I apologize. I did find some other earlier versions of mods to use Google Translate, but could not find one similar and as simple to use as this.

In the footer template, find the first instance of:

Code:

</form>
Just below it add this:

Code:

<!-- Translate vBulletin -->
<div id="google_translate_element" class="footer_select"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en',
    multilanguagePage: true,
    gaTrack: true,
    gaId: 'UA-12345-12',

    layout: google.translate.TranslateElement.InlineLayout.SIMPLE
  }, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<!-- /Translate vBulletin -->

Remove the 2 lines in red if you don't use Google Analytics. If you do, edit the number to your own.

It's so simple I think this would work on any version of vB. :)

COL NIL SATIS 01-29-2011 02:44 PM

Any screenshot's mate?

Infopro 01-29-2011 03:27 PM

Live example, check footer: http://forums.cpanel.net/

Hippy 01-29-2011 04:31 PM

installed
Nominated
rated..

very nice mod

RK KINGKONG 01-29-2011 04:49 PM

thanks HIPPY for directing me here , lol . to think i was just looking for something like this the other day on a site you have to pay for it. this is an amazing add on . GREAT JOB voted/installed/nominated.. remind me to get you a call girl.

COL NIL SATIS 01-29-2011 05:46 PM

Quote:

Originally Posted by Infopro (Post 2156098)
Live example, check footer: http://forums.cpanel.net/

Cheers :up:

BadgerDog 01-29-2011 06:12 PM

Installed for testing with thanks ... :)

Amazingly simple and effective ... :up:

Regards,
Doug

COL NIL SATIS 01-29-2011 06:14 PM

Does this add any strain to the server load??

Infopro 01-29-2011 06:54 PM

The only thing it might do is slow page load on a slow computer while the tool code is loaded from the google server, not yours.

Make your own depending on your needs. :)
http://translate.google.com/translate_tools

zelnik 01-29-2011 09:36 PM

brilliant thanks!

tafreeh 01-30-2011 04:53 AM

Thanks allot for this :)

thedvs 01-30-2011 01:32 PM

this messes with the thread titles when u go to edit them

seems to add code

Infopro 01-30-2011 01:46 PM

In my tests this had no effect on text areas whatsoever while editing.

BadgerDog 01-30-2011 02:18 PM

Quote:

Originally Posted by thedvs (Post 2156440)
this messes with the thread titles when u go to edit them

seems to add code

I'm running 4.04pl1 and have not had any problems with this ... :confused:

Regards,
Doug

freddie3218 01-30-2011 03:32 PM

This is great! However, how do you make it so that you only have 2 or 3 languages that it will translate? Is there a way to do it?

IE: English forum

Translated into French and Spanish.

Hippy 01-30-2011 05:16 PM

Quote:

Originally Posted by Infopro (Post 2156164)
The only thing it might do is slow page load on a slow computer while the tool code is loaded from the google server, not yours.

Make your own depending on your needs. :)
http://translate.google.com/translate_tools

Quote:

Originally Posted by freddie3218 (Post 2156484)
This is great! However, how do you make it so that you only have 2 or 3 languages that it will translate? Is there a way to do it?

IE: English forum

Translated into French and Spanish.

you can customize it here ;)

no issues with anything ..

BadgerDog 01-30-2011 06:14 PM

Ok, finished some testing ... :)

Great idea and adds a lot of value to users where the forum isn't in their native language, but for whatever reason, on our site it has a load penalty of between 3-4 seconds on home page, as an example.

If I remove this Google script, it speeds up etc ...

Although I don't have the skill, I think if this was a mod where the default language could be user selectable from a specific link and then when it went to that page, it only loaded the Google code then, it might be a compromise.

As is, I have to remove it from the footer as the drag on ALL individual page loading is too high...

Thanks anyway.. interesting mod .. :)

Regards,
Doug

Infopro 01-30-2011 10:55 PM

I did not test on a forum with as many cats as yours with googleads, groupon ads, livesupport, some sort of profilehover js and whatever else you've got going on there, which appears to be quite a bit.

Indeed, this may not be for everyone. ;)

You can surely wrap this with if tags of some sort and only show it on certain forums. Or, set it as I have on my test forum to only show for guests.

GL!

zelnik 01-31-2011 09:45 AM

Using Firefox is anyone getting a constant "transferring data from translate.googleapis.com" in the status bar?!?!

Doesn't seem to do it on Chrome or IE?

BadgerDog 01-31-2011 10:13 AM

Quote:

Originally Posted by Infopro (Post 2156680)
You can surely wrap this with if tags of some sort and only show it on certain forums. Or, set it as I have on my test forum to only show for guests.

GL!

Thanks for the link to that page. Has a lot of really good uses, other than solving our load problem. :D

The conditional we'd love to test for is one where the incoming user is NOT using English, but I have no idea how that would work. Regardless of what we use on our page which only usually takes 4.5-5 secs to load the entire home page without any caching at all, we've also tested this with other forums using Pingdom independent load analysis and the result is still a 15-20% load penalty, again, for whatever reason.


Quote:

Originally Posted by zelnik (Post 2156841)
Using Firefox is anyone getting a constant "transferring data from translate.googleapis.com" in the status bar?!?!

Doesn't seem to do it on Chrome or IE?

Yes, constant while we were testing, but of course, disappeared when we un-installed it.

Regards,
Doug

Infopro 01-31-2011 12:00 PM

Quote:

Originally Posted by zelnik (Post 2156841)
Using Firefox is anyone getting a constant "transferring data from translate.googleapis.com" in the status bar?!?!

Doesn't seem to do it on Chrome or IE?

Sounds like some sort of plugin preventing the connection if I was to guess.

I suppose another solution to using this might be to clone your main theme as a child style (so that any changes made to the parent are made to child as well) and name it multi-language. Make that style available on the style selector and only use this translator on that style, not the default.

If a guest visits and see this style and selects it, they would then be given the option to change language.

Just an idea of course. ;)

BadgerDog 01-31-2011 12:17 PM

Quote:

Originally Posted by Infopro (Post 2156877)
I suppose another solution to using this might be to clone your main theme as a child style (so that any changes made to the parent are made to child as well) and name it multi-language. Make that style available on the style selector and only use this translator on that style, not the default.

If a guest visits and see this style and selects it, they would then be given the option to change language.

Just an idea of course. ;)

That's an excellent idea ... :)

Regards,
Doug

RK KINGKONG 02-01-2011 05:58 AM

i second that installed
Nominated
rated..

very nice mod
Quote:

Originally Posted by Hippy (Post 2156117)
installed
Nominated
rated..

very nice mod


CharlieDelta 02-01-2011 09:07 PM

Simple, neat and fantastic!

Danasy 02-01-2011 09:14 PM

Nice mod, thank you!

zelnik 02-04-2011 08:03 AM

Hi Infopop.

Got an odd one for you.

A user on my site is claiming that ever since I installed this modification that it loads a toolbar on his browser?!?!

Supposedly it only happens on my site and doesn't show up when he is browsing other sites?

Infopro 02-04-2011 08:18 AM

Ask him to grab a screenshot that you can post here, for fun, to take a peek. There are no popups added to this from Google that I'm aware of.

zelnik 02-04-2011 12:32 PM

Quote:

Originally Posted by Infopro (Post 2158602)
Ask him to grab a screenshot that you can post here, for fun, to take a peek. There are no popups added to this from Google that I'm aware of.

Unfortunately the user is not very computer literate but has pasted the following he gets on the screen, I've googled the text and found nothing and I've installed every damn toolbar on the planet and can not replicate it. :)

"Ver esta p?gina en: espa?ol Traductor de Google Desactivar para: ingl?s
Traducci?n en curso (%) Cancelar
Traducido al: Mostrar texto original
Error: el servidor no ha podido completar la solicitud. Vuelve a intentarlo m?s tarde.
M?s informaci?n "

gosiah23 02-04-2011 01:20 PM

Infopro, I would love to have this right below the header or somewhere at the top of the forum so every visitor would see it. How do I do this?

Thanks,

Margaret

Infopro 02-04-2011 02:06 PM

Quote:

Originally Posted by zelnik (Post 2158675)
Unfortunately the user is not very computer literate but has pasted the following he gets on the screen, I've googled the text and found nothing and I've installed every damn toolbar on the planet and can not replicate it. :)

"Ver esta p?gina en: espa?ol Traductor de Google Desactivar para: ingl?s
Traducci?n en curso (%) Cancelar
Traducido al: Mostrar texto original
Error: el servidor no ha podido completar la solicitud. Vuelve a intentarlo m?s tarde.
M?s informaci?n "

From what I can make out of that message, it is indeed from Google, if I was to guess.

Something about timing out. Is this user on a dialup connection or old computer maybe? No clues, but if this continues for this user and others you might try my suggestion above to hide it from some user groups.

I can't really comment on the code for how this works or Googles servers responses of course. I have nothing to do with Google. I'm just adding some code from google to a forum. If that code from Google does not work properly, not much I can do except to suggest removing this, or hide it for specific user groups. If a user is bothered by it, add them to a special addon usergroup that can't see it, for example.

@gosiah23

Shouldn't be too much trouble, point me to exactly where you'd like to see it.

Hippy 02-04-2011 02:16 PM

1 Attachment(s)
with ie8 i noticed the Google Translator coming on just under the tabs.. but it don't stay there..
I wouldn't call it a tool bar...

I also think it could be disabled.. in ie or jsy tick the little box on the right of the bar..

screen shot ...attached

gosiah23 02-04-2011 02:50 PM

1 Attachment(s)
Infopro, thanks for your reply. These are 2 options I like. Whatever is easier, but I think the 1st choice will look better.

See attached image.

Attachment 126408

Thanks a million for this mod and your help!

Margaret

BadgerDog 02-04-2011 03:22 PM

We use Google Analytics and it provides a breakdown that shows visitors to our site by what language they're using.

It follows that there must be a variable on connection that can be interrogated to determine that information?

Would anyone know how to do that, so that we could have this mod display ONLY if the user is connecting using anything except English?

Thanks for any feedback.. :)

Regards,
Doug

Infopro 02-04-2011 06:12 PM

1 Attachment(s)
Quote:

Originally Posted by gosiah23 (Post 2158722)
Infopro, thanks for your reply. These are 2 options I like. Whatever is easier, but I think the 1st choice will look better.

See attached image.


Thanks a million for this mod and your help!

Margaret



Well, this is not perfect I don't think, but should put you in the right direction.

In your navbar template, find:

Code:

        <vb:if condition="$vboptions['enablesearches']">
Just above it place this:

Code:

<!-- Translate vBulletin -->
<div style="position:absolute; right:200px;top:28px;" id="google_translate_element" class="select"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en',
    multilanguagePage: true,
    layout: google.translate.TranslateElement.InlineLayout.SIMPLE
  }, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<!-- /Translate vBulletin -->

You really should want that style stuff added to your CSS instead of here but this will place it up by the Advanced Search text as you wanted for now. (see attachment, added to vB default style)

I didn't want to spend much time on this today but If I find some time I'd like to tweak the CSS and js to not be called from Google. In doing so the drop down and menu could be styled a bit nicer to match your site.

The stuff inside the div can be placed where ever you like, the js should be placed as close to the bottom of your page as possible for speed. That's why I originally placed it in footer.

In looking into the CSS end of this I did find one small tweak some might like:

Simply add this to the additional.css template to hide the "toolbar thing" and the balloon tips.

Code:

/* gtranslate */
.goog-te-banner-frame{display: none !important;}
body{top: 0px !important;}
.goog-te-balloon-frame{display: none !important;}
font{background: transparent !important;}
/* gtranslate */


Shamelessly stolen tip from here:

http://www.google.com/support/forum/...48c8591e&hl=en

Lots can be done with this. Just depends on how much playtime you have to experiment. :)

Infopro 02-04-2011 06:16 PM

Quote:

Originally Posted by BadgerDog (Post 2158728)
We use Google Analytics and it provides a breakdown that shows visitors to our site by what language they're using.

It follows that there must be a variable on connection that can be interrogated to determine that information?

Would anyone know how to do that, so that we could have this mod display ONLY if the user is connecting using anything except English?

Thanks for any feedback.. :)

Regards,
Doug

Not sure I follow you, but did you add your GA code to this? (marked in red in first post)

As for ONLY display if user is connecting using anything other than English, well, you can look at the google site in an earlier post and select your options yourself. Then just add your new code where this old code is located. This can be set to automatically translate and other things.

gosiah23 02-04-2011 06:31 PM

Infopro, many thanks again! I will give it a try :)

Margaret

imran_khatri 02-07-2011 09:27 AM

but how to add URDU lang in it becouse Google Translater has urdu but this don't have. any sulotion?

Crogge 02-07-2011 12:54 PM

I really like this modification, though I noticed a increased loading time because it is connecting to the Google servers each time. Is there a possibility to use this modification and let it access the Google servers only when you actually need it?

BadgerDog 02-07-2011 01:09 PM

Quote:

Originally Posted by Crogge (Post 2159748)
I really like this modification, though I noticed a increased loading time because it is connecting to the Google servers each time. Is there a possibility to use this modification and let it access the Google servers only when you actually need it?

That's what I was trying to say, albeit badly, in my post above, repeated here:

Quote:

Originally Posted by BadgerDog (Post 2158728)
We use Google Analytics and it provides a breakdown that shows visitors to our site by what language they're using.

It follows that there must be a variable on connection that can be interrogated to determine that information?

Would anyone know how to do that, so that we could have this mod display ONLY if the user is connecting using anything except English?

Thanks for any feedback.. :)

Regards,
Doug


Infopro 02-07-2011 03:50 PM

Quote:

Originally Posted by imran_khatri (Post 2159703)
but how to add URDU lang in it becouse Google Translater has urdu but this don't have. any sulotion?

In the code find:
Code:

    pageLanguage: 'en',
Add this below:
Code:

    includedLanguages: 'ur'
On the Translate Tools Site is where you'd generate the code if you need advanced options, you should have a close look there and at the auto generated code it provides.

Quote:

Originally Posted by BadgerDog (Post 2159752)
That's what I was trying to say, albeit badly, in my post above, repeated here:

I'm not sure I understand the increased loading time thing. Pages don't load any slower with this in footer that I can see.

If you mean the same thing as this comment:

Quote:

getting a constant "transferring data from translate.googleapis.com" in the status bar?!?!
as mentioned earlier, this is google's code. I can't account for the connection or accuracy of this tool. I didn't make the translator, I only added it to vB using the code I've shared here. I do not think that message in the footer of your browser is a problem, nor slowing page load speed when it's not being used.

When it is in use, sure the time it takes translate a page and finish "transferring data from translate.googleapis.com" to your browser there might be some delay.


All times are GMT. The time now is 07:14 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01444 seconds
  • Memory Usage 1,850KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (18)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete