AJAX Google Translator

mastram

New Member
What this MOD do ?
It will translate a marked Text - that's all.

How does it works ?
Simply mark a text and a little Textbox appears. Choose Language to translate from an to. Click "Go".
Tested on the following Browsers:
  • IE
  • Mozilla 3
  • Opera
  • Safari
How to install with TMS ?
Simply import the Product - finish !

How to install without TMS ?
Import the Product.
Now, two Templates has to be changed
  • headinclude
search for

Code:
<script type="text/javascript" 
src="clientscript/vbulletin_global.js?v=$vboptions[simpleversion]"></script>
add below

Code:
<script type="text/javascript" src="clientscript/google_translate.js"></script>
<script type="text/javascript">
<!--
var GOOGLE_ERROR = "$vbphrase[googletranslator_error]";
var GOOGLE_TEXT  = "$vbphrase[googletranslator_text_first]";
// -->
</script>
  • footer
search for

Code:
$ad_location[ad_footer_start
add below

Code:
<script type="text/javascript">
<!--
var translate_from = "en";
var translate_to   = "de";
// -->
</script>
<div id="translation" style="visibility: hidden; border: 1px; position: absolute; left: 0px; top: 0px" class="tborder">
 <div class="tcat">
   <a style="display: block; text-align: right; padding: 6px; font-size: 9px;" href="#" onclick="this.parentNode.parentNode.style.visibility='hidden'">$vbphrase[googletranslator_close_window]</a>
  </div>
 <div style="padding: 6px;"></div>
</div>
<div id="translate" style="visibility: hidden; border: 1px; position: absolute; left: 0px; top: 0px" class="tborder">
 <div class="thead">
  <img src="images/ico_searching.gif" alt="" style="vertical-align: middle; display: none;" />
  <span class="normalfont">$vbphrase[googletranslator_translate_from]:
  <select name="trans_from" onchange="translate_from=this.options[this.selectedIndex].value">
   <option value="ar">$vbphrase[googletranslator_arabic]</option>
   <option value="bg">$vbphrase[googletranslator_bulgarian]</option>
   <option value="zh-CN">$vbphrase[googletranslator_chinese]</option>
   <option value="hr">$vbphrase[googletranslator_croatian]</option>
   <option value="cs">$vbphrase[googletranslator_czech]</option>
   <option value="da">$vbphrase[googletranslator_danish]</option>
   <option value="nl">$vbphrase[googletranslator_dutch]</option>
   <option value="en" selected="selected">$vbphrase[googletranslator_english]</option>
   <option value="fi">$vbphrase[googletranslator_finnish]</option>
   <option value="fr">$vbphrase[googletranslator_french]</option>
   <option value="de">$vbphrase[googletranslator_german]</option>
   <option value="el">$vbphrase[googletranslator_greek]</option>
   <option value="hi">$vbphrase[googletranslator_hindi]</option>
   <option value="it">$vbphrase[googletranslator_italian]</option>
   <option value="ja">$vbphrase[googletranslator_japanese]</option>
   <option value="ko">$vbphrase[googletranslator_korean]</option>
   <option value="no">$vbphrase[googletranslator_norwegian]</option>
   <option value="pl">$vbphrase[googletranslator_polish]</option>
   <option value="pt">$vbphrase[googletranslator_portuguese]</option>
   <option value="ro">$vbphrase[googletranslator_romanian]</option>
   <option value="ru">$vbphrase[googletranslator_russian]</option>
   <option value="es">$vbphrase[googletranslator_spanish]</option>
   <option value="sv">$vbphrase[googletranslator_swedish]</option>
  </select>
  $vbphrase[googletranslator_translate_to]  
  <select name="trans_to" onchange="translate_to=this.options[this.selectedIndex].value">
   <option value="ar">$vbphrase[googletranslator_arabic]</option>
   <option value="bg">$vbphrase[googletranslator_bulgarian]</option>
   <option value="zh-CN">$vbphrase[googletranslator_chinese]</option>
   <option value="hr">$vbphrase[googletranslator_croatian]</option>
   <option value="cs">$vbphrase[googletranslator_czech]</option>
   <option value="da">$vbphrase[googletranslator_danish]</option>
   <option value="nl">$vbphrase[googletranslator_dutch]</option>
   <option value="en">$vbphrase[googletranslator_english]</option>
   <option value="fi">$vbphrase[googletranslator_finnish]</option>
   <option value="fr">$vbphrase[googletranslator_french]</option>
   <option value="de" selected="selected">$vbphrase[googletranslator_german]</option>
   <option value="el">$vbphrase[googletranslator_greek]</option>
   <option value="hi">$vbphrase[googletranslator_hindi]</option>
   <option value="it">$vbphrase[googletranslator_italian]</option>
   <option value="ja">$vbphrase[googletranslator_japanese]</option>
   <option value="ko">$vbphrase[googletranslator_korean]</option>
   <option value="no">$vbphrase[googletranslator_norwegian]</option>
   <option value="pl">$vbphrase[googletranslator_polish]</option>
   <option value="pt">$vbphrase[googletranslator_portuguese]</option>
   <option value="ro">$vbphrase[googletranslator_romanian]</option>
   <option value="ru">$vbphrase[googletranslator_russian]</option>
   <option value="es">$vbphrase[googletranslator_spanish]</option>
   <option value="sv">$vbphrase[googletranslator_swedish]</option>
  </select>
  </span> <input type="button" class="button" name="btngo" value="$vbphrase[googletranslator_go]" onclick="translateSelection(translate_from, translate_to, 1);" />
 </div>
</div>
Supported Languages by Google:
  1. Arabic
  2. Bulgarian
  3. Chinese
  4. Croatian
  5. Czech
  6. Danish
  7. Dutch
  8. English
  9. Finnish
  10. French
  11. German
  12. Greek
  13. Hindi
  14. Italian
  15. Japanese
  16. Korean
  17. Norwegian
  18. Polish
  19. Portuguese
  20. Romanian
  21. Russian
  22. Spanish
  23. Swedish
Known Bugs ?
I didn't found some Bugs. Sometimes the translated Text doesn't appears, but if I marked a shorter Text, it works.

Used Queries ?
None
 
It works on version 3.7.3 also! Perfect! Thank you verry much mastram!
But do you know how to change the default language? I meen, when someone doesn't speek English.. Is it possible to equal the default translated language to the default language of the forum?
 
hmmm Any help? I understand that man had it working fine on his forum. But I could not get it to do so.

Thank you if you can help.
 
Ishida said:
hmmm Any help? I understand that man had it working fine on his forum. But I could not get it to do so.

Thank you if you can help.
What Problem you are Facing. Plz be more specific.
 
It does not work. I have successfully entered the codes into the correct areas in the templates... It did nothing though. I have 3.7.3 also.
 
@ Ishida: Did you upload the Files? And instead of changing Codes manually did you try Importing the product First?
 
Back
Top