Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
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
Version: 2.4, by Dave Hybrid Dave Hybrid is offline
Developer Last Online: Dec 2013 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.8.x Rating:
Released: 06-27-2009 Last Update: 07-07-2009 Installs: 67
Uses Plugins Template Edits
Additional Files  
No support by the author.

**Text Removed**

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #102  
Old 06-29-2009, 08:57 PM
GoTTi GoTTi is offline
 
Join Date: Jun 2002
Posts: 1,346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

trying this again....
Reply With Quote
  #103  
Old 06-29-2009, 10:43 PM
ShawneyJ's Avatar
ShawneyJ ShawneyJ is offline
 
Join Date: Jul 2006
Location: Australia
Posts: 1,758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dave Hybrid View Post
I believe they were, basically you need to remove the flag your base language is in.

So find the line for english and put

<!--

at the start. and

-->

at the end.

Or just delete the line altogether, same thing happens, the flag will not display.

ah yes thanks EN flag seems to be gone and so far working great.
cheers
Reply With Quote
  #104  
Old 06-29-2009, 10:49 PM
music legend music legend is offline
 
Join Date: Mar 2006
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i have curl enabled


and i get a white screen whenever i press a flag button
Reply With Quote
  #105  
Old 06-30-2009, 12:31 AM
Sweeks Sweeks is offline
 
Join Date: Jul 2008
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by T2x View Post
Hey dave, very nice plugin.

I figured it out for you

Code:
<!--notranslatestart-->
Do not translate this text
<!--notranslateend-->
That is the syntax.

Change the plugin code to the following:

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('|<!--notranslatestart-->(.*?)<!--notranslateend-->|si', $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($styletags);$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));
}
Also you are going to make google angry.

You need to add a
Code:
@curl_setopt($ch, CURLOPT_REFERER,"http://$_SERVER[SERVER_NAME]$_SERVER[VBSEO_URI]");
(this is vbseo only code)
according to google.

and adding an api key to the request doesn't hurt.

http://code.google.com/apis/ajaxsearch/signup.html

at http://code.google.com/apis/ajaxlanguage/documentation

it says:



so basically you just change the request to look like this
Can you tell us all how to implement this now please
Reply With Quote
  #106  
Old 06-30-2009, 02:43 AM
T2x T2x is offline
 
Join Date: May 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);
I have changed the tags to <!--ntstart--> and <!--ntend-->

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.
Reply With Quote
  #107  
Old 06-30-2009, 03:51 AM
Sweeks Sweeks is offline
 
Join Date: Jul 2008
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I want to mainly know how to avoid Google being unhappy, how do I implement the API key? Thanks
Reply With Quote
  #108  
Old 06-30-2009, 05:59 AM
T2x T2x is offline
 
Join Date: May 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);
change it to:

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);
2. Also in translate.php

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));
Of course replace "COPYYOURKEYHERE" with the key you got from google.


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.
Reply With Quote
  #109  
Old 06-30-2009, 09:11 AM
Dave Hybrid's Avatar
Dave Hybrid Dave Hybrid is offline
 
Join Date: Mar 2007
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #110  
Old 06-30-2009, 09:25 AM
T2x T2x is offline
 
Join Date: May 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dave Hybrid View Post
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, then you just get a new one for your server, no big deal.
Unfortunately an IP change for many sites can be a big problem.

I would not be able to easily change the ip of my site.

I always say better safe than sorry.
Reply With Quote
  #111  
Old 06-30-2009, 09:32 AM
Dave Hybrid's Avatar
Dave Hybrid Dave Hybrid is offline
 
Join Date: Mar 2007
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by T2x View Post
Unfortunately an IP change for many sites can be a big problem.

I would not be able to easily change the ip of my site.

I always say better safe than sorry.
They have only ever banned my IP for 24hrs and only on the API service. You're worrying about nothing.
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 10:59 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.05686 seconds
  • Memory Usage 2,328KB
  • Queries Executed 25 (?)
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
  • (9)bbcode_code
  • (4)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
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete