Please note that today we will release new vBET version which is prepared for translation providers limits. It means that in case if one provider is not available it will switch to another and check previous once per our to see is it available again. Also in case when you already reach your limits in all providers it will use dummy translator - cached translations will be displayed, but for new one you will just see original test instead of empty one like until now. Details will be in announcements. We will release in about 1 hour.
I actually implemented these features back when I discovered microsoft's translator. However, their limit is 400,000 chars/hours, or 2,000,000 chars per day (even with OAuth). In the past I was caching over 1GB of translations per day, which would equate to billions of characters, give or take. This means that I would always exceed the providers' quotas during each hour, as I was getting over 2,000 hourly translated pageviews.
This is a real shame as I really liked vbet, my users found it useful, and I had a lot of fun extending and improving it (i.e. ReviewPost integration, etc).
Here is the function I wrote to fetch an OAuth token (which I then stored in memcache until it expired), this would be another suggestion for a future release as microsoft will soon be requiring it:
PHP Code:
function request_new_token() {
$obj_connection = curl_init();
$arr_query_bits = array (
'client_id' => 'your client id',
'client_secret' => 'your secret',
'scope' => 'http://api.microsofttranslator.com',
'grant_type' => 'client_credentials'
);
$str_query = http_build_query($arr_query_bits);
curl_setopt($obj_connection, CURLOPT_URL, 'https://datamarket.accesscontrol.windows.net/v2/OAuth2-13');
curl_setopt($obj_connection, CURLOPT_HEADER, 0);
curl_setopt($obj_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($obj_connection, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($obj_connection, CURLOPT_POSTFIELDS, $str_query);
curl_setopt($obj_connection, CURLOPT_POST, TRUE);
curl_setopt($obj_connection, CURLOPT_TIMEOUT, 1);
$str_response = curl_exec($obj_connection);
curl_close($obj_connection);
$matches = array();
preg_match('/\"access_token\":\"([^"]+)\"/', $str_response, $matches);
$token = $matches[1];
preg_match('/\"expires_in\":\"([\d]+)\"/', $str_response, $matches);
$expires = $matches[1];
return array($token, $expires);
}
Another interesting issue in my case is that with vbet off, it seems that google is much more happy to index our site:
Seems like our loss in traffic won't be that big after all- at least that's good news!