PHP 클래스 Stichoza\GoogleTranslate\TranslateClient

저자: Levan Velijanashvili ([email protected])
파일 보기 프로젝트 열기: stichoza/google-translate-php 1 사용 예제들

공개 메소드들

메소드 설명
__call ( $name, $args ) Override translate method for instance call.
__callStatic ( $name, $args ) Override translate method for static call.
__construct ( string $source = null, string $target = 'en', array $options = [], Stichoza\GoogleTranslate\Tokens\TokenProviderInterface $tokener = null ) Class constructor.
setHttpOption ( array $options ) : TranslateClient Set guzzleHttp client options.
setSource ( string $source = null ) : TranslateClient Set source language we are transleting from.
setTarget ( string $target ) : TranslateClient Set translation language we are transleting to.

비공개 메소드들

메소드 설명
checkStaticInstance ( ) : void Check if static instance exists and instantiate if not.
getResponse ( string | array $data ) : array Get response array.
instanceTranslate ( string | array $data ) : string | boolean Translate text.
isValidLocale ( string $lang ) : boolean Check if given locale is valid.
staticGetLastDetectedSource ( ) : string | boolean Get last detected language.
staticTranslate ( string $source, string $target, string $string ) : string | boolean Translate text statically.

메소드 상세

__call() 공개 메소드

Override translate method for instance call.
public __call ( $name, $args )

__callStatic() 공개 정적인 메소드

Override translate method for static call.
public static __callStatic ( $name, $args )

__construct() 공개 메소드

For more information about HTTP client configuration options, visit "Creating a client" section of GuzzleHttp docs. 5.x - http://guzzle.readthedocs.org/en/5.3/clients.html#creating-a-client
public __construct ( string $source = null, string $target = 'en', array $options = [], Stichoza\GoogleTranslate\Tokens\TokenProviderInterface $tokener = null )
$source string Source language (Optional)
$target string Target language (Optional)
$options array Associative array of http client configuration options (Optional)
$tokener Stichoza\GoogleTranslate\Tokens\TokenProviderInterface

setHttpOption() 공개 메소드

Set guzzleHttp client options.
public setHttpOption ( array $options ) : TranslateClient
$options array guzzleHttp client options.
리턴 TranslateClient

setSource() 공개 메소드

Set source language we are transleting from.
public setSource ( string $source = null ) : TranslateClient
$source string Language code
리턴 TranslateClient

setTarget() 공개 메소드

Set translation language we are transleting to.
public setTarget ( string $target ) : TranslateClient
$target string Language code
리턴 TranslateClient