PHP 클래스 MPTranslate, gxc-cms

상속: extends CApplicationComponent
파일 보기 프로젝트 열기: nganhtuan63/gxc-cms

공개 프로퍼티들

프로퍼티 타입 설명
$acceptedLanguages array contains the languages accepted by your application
$autoSetLanguage wheter to automatically set the language on the initialization of the component
$autoTranslate wheter to auto translate the missing messages found on the page needs google api key to set
$defaultLanguage string defaults language to use if none is set
$dialogOptions options of the dialog
$googleApiKey string
$languageKey string an unique key to be used
$messages

공개 메소드들

메소드 설명
__callStatic ( mixed $method, mixed $args ) : mixed helper so you can use MPTransalate::someMethod($args)
dropdown ( ) : string generates a dropdown containing all accepted languages
editLink ( string $label = 'Edit translations', string $type = 'link' ) creates a link to the page where you edit the translations
getGoogleAcceptedLanguages ( string $targetLanguage = null ) : array returns an array containing all languages accepted by google translate
getLanguage ( ) : string returns the language in use the language is determined by many variables: session, post, get, header in this order it will filter the language by using accepted languages
googleTranslate ( string $message, string $targetLanguage = null, mixed $sourceLanguage = null ) : string translate some message from $sourceLanguage to $targetLanguage using google translate api googleApiKey must be defined to use this service
hasMessages ( )
init ( ) handles the initialization parameters of the components
missingLink ( string $label = 'Missing translations', string $type = 'link' ) : string creates a link to the page where you check all missing translations
missingTranslation ( CMissingTranslationEvent $event ) : string method that handles the on missing translation event
setLanguage ( string | null $language = null ) : string set the language that the application will use if $language is null then if you use getLanguage to determine the target language
translateDialogLink ( string $label = 'Translate', mixed $title = null, string $type = 'link' ) : string generates a link or button that generates a dialog to the page where you translate the missing translations found in this page
translateLink ( string $label = 'Translate', string $type = 'link' ) : string generates a link or button to the page where you translate the missing translations found in this page

보호된 메소드들

메소드 설명
queryGoogle ( array $args = [], string $method = null ) : stdClass query google translate api

비공개 메소드들

메소드 설명
ajaxDialog ( $label, $url, $title = null, $type = 'link', $ajaxOptions = [] )

메소드 상세

__callStatic() 정적인 공개 메소드

php 5.3 only
static public __callStatic ( mixed $method, mixed $args ) : mixed
$method mixed
$args mixed
리턴 mixed

dropdown() 공개 메소드

generates a dropdown containing all accepted languages
public dropdown ( ) : string
리턴 string

getGoogleAcceptedLanguages() 공개 메소드

returns an array containing all languages accepted by google translate
public getGoogleAcceptedLanguages ( string $targetLanguage = null ) : array
$targetLanguage string
리턴 array

getLanguage() 공개 메소드

returns the language in use the language is determined by many variables: session, post, get, header in this order it will filter the language by using accepted languages
public getLanguage ( ) : string
리턴 string

googleTranslate() 공개 메소드

translate some message from $sourceLanguage to $targetLanguage using google translate api googleApiKey must be defined to use this service
public googleTranslate ( string $message, string $targetLanguage = null, mixed $sourceLanguage = null ) : string
$message string to be translated
$targetLanguage string language to translate the message to, if null it will use the current language in use
$sourceLanguage mixed language that the message is written in, if null it will use the application source language
리턴 string translated message

hasMessages() 공개 메소드

public hasMessages ( )

init() 공개 메소드

handles the initialization parameters of the components
public init ( )

missingTranslation() 공개 메소드

method that handles the on missing translation event
public missingTranslation ( CMissingTranslationEvent $event ) : string
$event CMissingTranslationEvent
리턴 string the message to translate or the translated message if autoTranslate is set to true

queryGoogle() 보호된 메소드

query google translate api
protected queryGoogle ( array $args = [], string $method = null ) : stdClass
$args array
$method string the method to use, use null to translate accepted values are null(translate), "languages" and "detect"
리턴 stdClass the google response object

setLanguage() 공개 메소드

it doesn't check if the language is in the accepted languages
public setLanguage ( string | null $language = null ) : string
$language string | null
리턴 string the language setted

프로퍼티 상세

$acceptedLanguages 공개적으로 프로퍼티

contains the languages accepted by your application
public array $acceptedLanguages
리턴 array

$autoSetLanguage 공개적으로 프로퍼티

wheter to automatically set the language on the initialization of the component
public $autoSetLanguage

$autoTranslate 공개적으로 프로퍼티

wheter to auto translate the missing messages found on the page needs google api key to set
public $autoTranslate

$defaultLanguage 공개적으로 프로퍼티

defaults language to use if none is set
public string $defaultLanguage
리턴 string

$dialogOptions 공개적으로 프로퍼티

options of the dialog
public $dialogOptions

$googleApiKey 공개적으로 프로퍼티

public string $googleApiKey
리턴 string

$languageKey 공개적으로 프로퍼티

an unique key to be used
public string $languageKey
리턴 string

$messages 정적으로 공개적으로 프로퍼티

static public $messages