mzubairsaleem / gtranslate-api-php

Automatically exported from code.google.com/p/gtranslate-api-php
GNU General Public License v3.0
0 stars 0 forks source link

setRequestType doesn't work, can't set to curl #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Just try to use example_curl.php - $gt->setRequestType('curl'); returns an 
error.

Here's the actual stack dump:

Notice: Undefined offset: 1 in 
/home/gharvey/workspace/fantasticommerce/trunk/www/sites/all/modules/i18n_a
uto_draft/gtranslate-api-php/GTranslate.php on line 251
Call Stack
#   Time    Memory  Function    Location
1   0.0001  44908   {main}( )   ../test.php:0
2   0.0011  70388   GTranslate->setRequestType( )   ../test.php:7
3   0.0011  70532   GTranslate->__call( )   ../GTranslate.php:0
4   0.0012  70980   GTranslate->isValidLanguage( )  
../GTranslate.php:270
Unsupported languages (setrequesttype,)

What version of the product are you using? On what operating system?

Latest, 0.7.4.

Please provide any additional information below.

Original issue reported on code.google.com by greg.har...@gmail.com on 13 Jan 2010 at 5:52

GoogleCodeExporter commented 8 years ago
I added a new public method, I guess it got dropped accidentally - I believe it 
should look like this:

  /**
  * Define request type
  * @access public
  * @param string $request_type
  * return boolean
  */
  public function setRequestType($request_type) {
      if (!empty($request_type)) {
          $this->request_type = $request_type;
      return true;
      }
    return false;
  }

Works for me. I put it in right after the setAPIKey() method.

Original comment by greg.har...@gmail.com on 13 Jan 2010 at 6:00

GoogleCodeExporter commented 8 years ago
It works like a charm.

Original comment by tiago.du...@googlemail.com on 22 Jan 2010 at 1:38

GoogleCodeExporter commented 8 years ago
Thanks for feeding back. Unfortunately, it seems using cURL doesn't make any
difference to the Google Translate API's refusal to accept longer strings. I 
suspect
that's why it was dropped. No need to be able to POST if Google can't accept 
longer
strings anyway!

We handled this in a slightly ugly way, but you can check the code here - it's a
Drupal module: http://drupal.org/project/i18n_auto

Original comment by greg.har...@gmail.com on 22 Jan 2010 at 8:16

GoogleCodeExporter commented 8 years ago
Can't reproduce this.

Original comment by josedasilva on 8 Mar 2010 at 7:03

GoogleCodeExporter commented 8 years ago
@josedasilva, if you actually check out the latest code from SVN, you'll see the
whole method is missing from the class! It's difficult *not* to reproduce. ;-)

Original comment by greg.har...@gmail.com on 8 Mar 2010 at 8:58