\Aculab\WebServicesWrapperTextTranslationWebService

Text Translation Web Service.

Summary

Methods
Properties
Constants
setWebServicesServer()
setCryptoMethod()
__construct()
getSupportedLanguages()
translateFromFile()
translateText()
No public properties found
VERSION
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

VERSION

VERSION

The wrapper version.

The wrapper version number.

Methods

setWebServicesServer()

setWebServicesServer(string  $wsserver) 

Set the web services server address.

This allows the web service requests to be directed to a specific server. The default is https://ws-<cloud_id>.aculabcloud.net

Parameters

string $wsserver

The base URL of the web services server.

setCryptoMethod()

setCryptoMethod(integer  $method) 

Set the crypto method used when connectiing to the web services server.

This allows a specific crypto method to be used when connecting to the web service server. The values should be one of the STREAM_CRYPTO_METHOD_TLSv1_N_CLIENT constants. The default is STREAM_CRYPTO_METHOD_ANY_CLIENT.

Parameters

integer $method

The crypto method to use.

__construct()

__construct(string  $cloud_id, string  $username, string  $access_key) 

Create a TextTranslationWebService object.

Parameters

string $cloud_id

The cloud identifier, such as "1-2-0".

string $username

The cloud account username.

string $access_key

The access key for the cloud account.

getSupportedLanguages()

getSupportedLanguages() : array

Get the supported translation languages.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

Returns an array of TranslationLanguageDetails objects

translateFromFile()

translateFromFile(string  $local_filename, string  $target_language, string  $source_language = null) : \Aculab\WebServicesWrapper\TranslateResult

Translate text from a local file.

Parameters

string $local_filename

The local file containing UTF-8 text to be translated.

string $target_language

The code of the language to translate the text in to.

string $source_language

The code of the language of the text in the file.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

\Aculab\WebServicesWrapper\TranslateResult

translateText()

translateText(string  $source_text, string  $target_language, string  $source_language = null) : \Aculab\WebServicesWrapper\TranslateResult

Translate text from string.

Parameters

string $source_text

The text to be translated.

string $target_language

The code of the language to translate the text in to.

string $source_language

The code of the language of the text in the file.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

\Aculab\WebServicesWrapper\TranslateResult