PHP 클래스 Prado\I18N\TTranslate

This component performs message/string translation. The translation source is set in the TGlobalization handler. The following example demonstrated a simple message translation. Depending on the culture set on the page, the phrase "Goodbye" will be translated. The {@link getParameters Parameters} property can be use to add name values pairs for substitution. Substrings enclosed with "{" and "}" in the translation message are consider as the parameter names during substitution lookup. The following example will substitute the substring "{time}" with the value of the parameter attribute "Parameters.time=<%= time() %>. Note that the value of the parameter named "time" is evaluated. > The unix-time is "{time}". More complex string substitution can be applied using the TTranslateParameter component. Namespace: System.I18N Properties - Text, string,
Gets or sets the string to translate. - Catalogue, string,
Gets or sets the catalogue for message translation. The default catalogue can be set by the @Page directive. - Key, string,
Gets or sets the key used to message look up. - Trim, boolean,
Gets or sets an option to trim the contents. Default is to trim the contents.
상속: extends TI18NControl
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

공개 메소드들

메소드 설명
getCatalogue ( ) : string Get the message catalogue.
getKey ( ) : string Get the key for message lookup.
getParameter ( $name ) : string
getParameters ( ) : TAttributeCollection Returns the list of custom parameters.
getText ( ) : string
getTrim ( ) : boolean Trim the content or not.
hasParameter ( $name ) : boolean
removeParameter ( $name ) : string Removes the named parameter.
render ( $writer ) renders the translated string.
setCatalogue ( $value ) Set the message catalogue.
setKey ( $value ) Set the key for message lookup.
setParameter ( $name, $value )
setText ( $value ) Sets the text for localization.
setTrim ( $value ) Set the option to trim the contents.

보호된 메소드들

메소드 설명
translateText ( $text, $subs ) : string Translates the text with subsititution.

메소드 상세

getCatalogue() 공개 메소드

Get the message catalogue.
public getCatalogue ( ) : string
리턴 string catalogue.

getKey() 공개 메소드

Get the key for message lookup.
public getKey ( ) : string
리턴 string key

getParameter() 공개 메소드

public getParameter ( $name ) : string
리턴 string parameter value, null if parameter does not exist

getParameters() 공개 메소드

Custom parameters are name-value pairs that may subsititute translation place holders during rendering.
public getParameters ( ) : TAttributeCollection
리턴 Prado\Collections\TAttributeCollection the list of custom parameters

getText() 공개 메소드

public getText ( ) : string
리턴 string the text to be localized/translated.

getTrim() 공개 메소드

Trim the content or not.
public getTrim ( ) : boolean
리턴 boolean trim or not.

hasParameter() 공개 메소드

public hasParameter ( $name ) : boolean
리턴 boolean whether the named parameter exists

removeParameter() 공개 메소드

Removes the named parameter.
public removeParameter ( $name ) : string
리턴 string parameter value removed, null if parameter does not exist.

render() 공개 메소드

renders the translated string.
public render ( $writer )

setCatalogue() 공개 메소드

Set the message catalogue.
public setCatalogue ( $value )

setKey() 공개 메소드

Set the key for message lookup.
public setKey ( $value )

setParameter() 공개 메소드

public setParameter ( $name, $value )

setText() 공개 메소드

Sets the text for localization.
public setText ( $value )

setTrim() 공개 메소드

Set the option to trim the contents.
public setTrim ( $value )

translateText() 보호된 메소드

Translates the text with subsititution.
protected translateText ( $text, $subs ) : string
리턴 string translated text