Class GoogleTranslateWrapper

(line 39)

Description


Located in File: /googleTranslate.class.php

GoogleTranslateWrapper Main Class


Class Variables

Summary:
string $_apiKey
string $_fromLang
string $_ip
string $_postFields
string $_siteUrl
string $_text
string $_toLang
string $_version

$_apiKey = '' (line 87)

Data type : string

Google API key
  • access: - private

$_detectedSourceLanguage = "" (line 117)

Data type : string

Detected source language
  • access: - private

$_fromLang = '' (line 57)

Data type : string

Language to translate from
  • access: - private

$_googleDetectUrl = 'http://ajax.googleapis.com/ajax/services/language/detect' (line 51)

Data type : string

URL of Google language detection
  • access: - private

$_googleTranslateUrl = 'http://ajax.googleapis.com/ajax/services/language/translate' (line 45)

Data type : string

URL of Google translate
  • access: - private

$_ip = '' (line 93)

Data type : string

Host IP address
  • access: - private

$_postFields (line 99)

Data type : string

POST fields
  • access: - private

$_serviceError = "" (line 111)

Data type : string

Service Error
  • access: - private

$_siteUrl = '' (line 81)

Data type : string

Site url using the code
  • access: - private

$_text = '' (line 75)

Data type : string

Text to translate
  • access: - private

$_toLang = '' (line 63)

Data type : string

Language to translate to
  • access: - private

$_translatedText (line 105)

Data type : string

Translated Text
  • access: - private

$_version = '1.0' (line 69)

Data type : string

API version
  • access: - private

Class Constants

Summary:

DETECT = 1 (line 119)

TRANSLATE = 2 (line 120)

Method Detail

Summary:
boolean detectLanguage (string $text)
String getDetectedSource ()
String getLastError ()
boolean selfTest ()
void setCredentials (string $apiKey,  $ip)
boolean translate ([string $text = ''], string $to, [string $from = ''])
void _composeUrl ( $type)
string _remoteQuery (string $query)
string _remoteQueryDetect (string $query)

Method detectLanguage (line 311)

boolean detectLanguage( string $text)

Detect the language of the given text

Parameters

  • string $text: text language to detect

Info

  • return - | string
  • access - public

Method getDetectedSource (line 236)

String getDetectedSource( )

Get the detected source language, if the source is not provided during query

Info

  • access - public

Method getLastError (line 224)

String getLastError( )

Get the last generated service error

Info

  • access - public

Method selfTest (line 205)

boolean selfTest( )

Self test the class

Info

  • access - public

Method setCredentials (line 247)

void setCredentials( string $apiKey, $ip)

Set credentials (optional) when accessing Google translation services

Parameters

  • string $apiKey: your google api key
  • $ip:

Info

  • access - public

Method translate (line 262)

boolean translate( [string $text = ''], string $to, [string $from = ''])

Translate the given text

Parameters

  • string $text: text to translate
  • string $to: language to translate to
  • string $from: optional language to translate from

Info

  • return - | string
  • access - public

Method _composeUrl (line 127)

void _composeUrl( $type)

Build a POST url to query Google

Parameters

  • $type:

Info

  • access - private

Method _remoteQuery (line 154)

string _remoteQuery( string $query)

Process the built query using cURL and POST

Parameters

  • string $query: POST fields

Info

  • return - response
  • access - private

Method _remoteQueryDetect (line 182)

string _remoteQueryDetect( string $query)

Process the built query using cURL and GET

Parameters

  • string $query: GET fields

Info

  • return - response
  • access - private

Inherited Variables

Inherited Class Variable Summary

Inherited Methods

Inherited Method Summary


Documentation generated on Mon, 22 Mar 2010 12:42:33 +0000 by phpDocumentor 1.4.1