The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
vB Global Translator - Multiply your indexed pages & put search traffic on autopilot Details »» | |||||||||||||||||||||||||||
vB Global Translator - Multiply your indexed pages & put search traffic on autopilot
Developer Last Online: Dec 2013
**Text Removed**
Show Your Support
|
Comments |
#102
|
|||
|
|||
trying this again....
|
#103
|
||||
|
||||
Quote:
ah yes thanks EN flag seems to be gone and so far working great. cheers |
#104
|
|||
|
|||
|
#105
|
|||
|
|||
Quote:
|
#106
|
|||
|
|||
Alright I have updated the translation exceptions a little bit.
Basically go to your plugins in VB, and if you remember you created one that hooked "global_complete". Find that plugin, and edit it. Replace that plugin with this: Code:
// Enable UTF-8 characters if(isset($_GET['hl'])) { require_once("translate.php"); $output = str_replace('lang="en"', 'lang="'.$_GET['hl'].'"', $output); header ('Content-type: text/html; charset=utf-8'); // Keep remainders of <style and <script tags! $time = time(); // Unique Tag Identifier! preg_match_all('|<script[^>]*>(.*?)</script>|si', $output,$scripttags, PREG_SET_ORDER); for($i=0;$i<count($scripttags);$i++) { $output = str_replace($scripttags[$i][0], "<a name=\"$i\"></a>",$output); } //preg_match_all("<style[^>]*>.*</style>",$buffer,$styletags); preg_match_all('|<style[^>]*>(.*?)</style>|si',$output,$styletags); for($i=0;$i<count($styletags);$i++) { $output = str_replace($styletags[1][$i], "<a name=\"s$i\"></a>",$output); } preg_match_all('/<!--ntstart-->.*?<!--ntend-->/', $output,$notranslatetags, PREG_SET_ORDER); for($i=0;$i<count($notranslatetags);$i++) { $output = str_replace($notranslatetags[$i][0], "<a name=\"t$i\"></a>",$output); } $output=callback($output); // Place back remainders of <style and <script tags! for($i=0;$i<count($notranslatetags);$i++) { $output = str_replace("<a name=\"t$i\"></a>", $notranslatetags[$i][0], $output); } for($i=0;$i<count($styletags);$i++) { $output = str_replace("<a name=\"s$i\"></a>", $styletags[1][$i], $output); } for($i=0;$i<count($scripttags);$i++) { $output = str_replace("<a name=\"$i\"></a>",$scripttags[$i][0] ,$output); } //print_r($scripttags); //die("c:".count($scripttags).":".count($styletags)); } $output = str_replace("<!--ntstart-->", "", $output); $output = str_replace("<!--ntend-->", "", $output); What you can do with this is if you have some piece of information that you dont want to be translated, wrap it in those tags. You can do so in your templates or php files or whatever. You should never see those tags in your actual html page as they will be removed. I have also made some improvements in regards to translating numbers and times. I've found that by disabling translation of time likes 01:30 PM and by disabling translation of numbers like 32,423, you sacrifice a bit of readibility for foreign users but the pages load MUCH faster. I haven't included this in any of my posts yet but I will soon. |
#107
|
|||
|
|||
I want to mainly know how to avoid Google being unhappy, how do I implement the API key? Thanks
|
#108
|
|||
|
|||
Ok sorry, first of all here is a small bug fix of what i posted earlier, as it was slightly bugged.
Code:
// Enable UTF-8 characters if(isset($_GET['hl'])) { require_once("translate.php"); $output = str_replace('lang="en"', 'lang="'.$_GET['hl'].'"', $output); header ('Content-type: text/html; charset=utf-8'); // Keep remainders of <style and <script tags! $time = time(); // Unique Tag Identifier! preg_match_all('|<script[^>]*>(.*?)</script>|si', $output,$scripttags, PREG_SET_ORDER); for($i=0;$i<count($scripttags);$i++) { $output = str_replace($scripttags[$i][0], "<a name=\"$i\"></a>",$output); } //preg_match_all("<style[^>]*>.*</style>",$buffer,$styletags); preg_match_all('|<style[^>]*>(.*?)</style>|si',$output,$styletags); for($i=0;$i<count($styletags);$i++) { $output = str_replace($styletags[1][$i], "<a name=\"s$i\"></a>",$output); } preg_match_all('/<!--ntstart-->.*?<!--ntend-->/s', $output,$notranslatetags, PREG_SET_ORDER); for($i=0;$i<count($notranslatetags);$i++) { $output = str_replace($notranslatetags[$i][0], "<a name=\"t$i\"></a>",$output); } $output=callback($output); // Place back remainders of <style and <script tags! for($i=0;$i<count($notranslatetags);$i++) { $output = str_replace("<a name=\"t$i\"></a>", $notranslatetags[$i][0], $output); } $output = str_replace("<!--ntstart-->", "", $output); $output = str_replace("<!--ntend-->", "", $output); for($i=0;$i<count($styletags);$i++) { $output = str_replace("<a name=\"s$i\"></a>", $styletags[1][$i], $output); } for($i=0;$i<count($scripttags);$i++) { $output = str_replace("<a name=\"$i\"></a>",$scripttags[$i][0] ,$output); } //print_r($scripttags); //die("c:".count($scripttags).":".count($styletags)); } As far as making google happy, ( This code will ONLY work if you have VBSEO) Do this: 1. Open up your translate.php. find these lines: Code:
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); Code:
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @curl_setopt($ch, CURLOPT_REFERER,"http://$_SERVER[SERVER_NAME]$_SERVER[VBSEO_URI]"); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); Go to http://code.google.com/apis/ajaxsearch/signup.html Get an api key for your site, copy it find: Code:
@curl_setopt($ch, CURLOPT_URL, "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&langpair=".urlencode($fl.'|'.$tl)."&q=".urlencode($text)); change it to Code:
@curl_setopt($ch, CURLOPT_URL, "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&key=COPYYOURKEYHERE&langpair=".urlencode($fl.'|'.$tl)."&q=".urlencode($text)); That's all. Easy as pie. This will ensure google knows where the requests are coming from and that they can contact you in case of problems instead of just banning you from all of google by ip. |
#109
|
||||
|
||||
FYI we have never had a site banned, after years of running these and similar scripts.
At most google will ban your IP from the API service for 24hrs, no big deal. |
#110
|
|||
|
|||
Quote:
I would not be able to easily change the ip of my site. I always say better safe than sorry. |
#111
|
||||
|
||||
They have only ever banned my IP for 24hrs and only on the API service. You're worrying about nothing.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|