Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Forum Translator by Google Details »»
Forum Translator by Google
Version: 1.00, by Infopro Infopro is offline
Developer Last Online: Jun 2016 Show Printable Version Email this Page

Category: End-User Options - Version: 4.1.0 Rating:
Released: 01-28-2011 Last Update: Never Installs: 151
Template Edits
Re-useable Code Translations  
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
4 благодарности(ей) от:
CarpCharacin, Code Geass, hexeditor, Toorak Times

Comments
  #32  
Old 02-04-2011, 02:16 PM
Hippy's Avatar
Hippy Hippy is offline
 
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Attached Images
File Type: jpg Snap019.jpg (22.0 KB, 0 views)
Reply With Quote
  #33  
Old 02-04-2011, 02:50 PM
gosiah23's Avatar
gosiah23 gosiah23 is offline
 
Join Date: Jun 2009
Location: Morehead City NC
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #34  
Old 02-04-2011, 03:22 PM
BadgerDog BadgerDog is offline
 
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #35  
Old 02-04-2011, 06:12 PM
Infopro Infopro is offline
 
Join Date: May 2003
Location: Pennsylvania
Posts: 267
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gosiah23 View Post
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.
Attached Images
File Type: jpg gtransattop.jpg (68.9 KB, 0 views)
Reply With Quote
  #36  
Old 02-04-2011, 06:16 PM
Infopro Infopro is offline
 
Join Date: May 2003
Location: Pennsylvania
Posts: 267
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BadgerDog View Post
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.
Reply With Quote
  #37  
Old 02-04-2011, 06:31 PM
gosiah23's Avatar
gosiah23 gosiah23 is offline
 
Join Date: Jun 2009
Location: Morehead City NC
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Margaret
Reply With Quote
  #38  
Old 02-07-2011, 09:27 AM
imran_khatri imran_khatri is offline
 
Join Date: Jan 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but how to add URDU lang in it becouse Google Translater has urdu but this don't have. any sulotion?
Reply With Quote
  #39  
Old 02-07-2011, 12:54 PM
Crogge Crogge is offline
 
Join Date: Oct 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #40  
Old 02-07-2011, 01:09 PM
BadgerDog BadgerDog is offline
 
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Crogge View Post
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 View Post
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
Reply With Quote
  #41  
Old 02-07-2011, 03:50 PM
Infopro Infopro is offline
 
Join Date: May 2003
Location: Pennsylvania
Posts: 267
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by imran_khatri View Post
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 View Post
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:23 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.12193 seconds
  • Memory Usage 2,355KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_code
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete