## Class TTranslate

Description

TTranslate class.

This component performs message/string translation. The translation source is set in the TGlobalization handler. The following example demonstrated a simple message translation.

     <com:TTranslate Text="Goodbye" />

Depending on the culture set on the page, the phrase "Goodbye" will be translated.

The 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.

     <com:TTranslate Parameters.time=<%= time() %> >
       The unix-time is "{time}".
     </com:TTranslate>

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.

- version: v1.0, last update on Fri Dec 24 21:38:49 EST 2004
- author: Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>

Located in /I18N/TTranslate.php (line 63)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TI18NControl
                |
                --TTranslate

Direct descendents

Class | Description
--- | ---
TChoiceFormat | TChoiceFormat class.

Method Summary
string getCatalogue ()
string getKey ()
string getParameter (mixed $name)
TAttributeCollection getParameters ()
string getText ()
boolean getTrim ()
boolean hasParameter (mixed $name)
string removeParameter (string $name)
void render (mixed $writer)
void setCatalogue (string $value)
void setKey (string $value)
void setParameter (string $name, string $value)
void setText (string $value)
void setTrim (boolean $value)
string translateText (string $text, array $subs)
Methods
getCatalogue (line 104)

Get the message catalogue.

- return: catalogue.
- access: public

string getCatalogue ()
getKey (line 95)

Get the key for message lookup.

- return: key
- access: public

string getKey ()
getParameter (line 169)

- return: parameter value, null if parameter does not exist
- access: public

string getParameter (mixed $name)
getParameters (line 142)

Returns the list of custom parameters.

Custom parameters are name-value pairs that may subsititute translation place holders during rendering.

- return: the list of custom parameters
- access: public

TAttributeCollection getParameters ()
getText (line 68)

- return: the text to be localized/translated.
- access: public

string getText ()
getTrim (line 131)

Trim the content or not.

- return: trim or not.
- access: public

boolean getTrim ()
hasParameter (line 158)

- return: whether the named parameter exists
- access: public

boolean hasParameter (mixed $name)
removeParameter (line 191)

Removes the named parameter.

- return: parameter value removed, null if parameter does not exist.
- access: public

string removeParameter (string $name)

- string $name: the name of the parameter to be removed.

render (line 202)

renders the translated string.

- access: public

void render (mixed $writer)

Redefinition of:

TControl::render()
  Renders the control.

setCatalogue (line 113)

Set the message catalogue.

- access: public

void setCatalogue (string $value)

- string $value: catalogue.

setKey (line 86)

Set the key for message lookup.

- access: public

void setKey (string $value)

- string $value: key

setParameter (line 181)

- access: public

void setParameter (string $name, string $value)

- string $name: parameter name
- string $value: value of the parameter

setText (line 77)

Sets the text for localization.

- access: public

void setText (string $value)

- string $value: the text for translation.

setTrim (line 122)

Set the option to trim the contents.

- access: public

void setTrim (boolean $value)

- boolean $value: trim or not.

translateText (line 234)

Translates the text with subsititution.

- return: translated text
- access: protected

string translateText (string $text, array $subs)

- string $text: text for translation
- array $subs: list of substitutions

Redefined in descendants as:

- TChoiceFormat::translateText() : Display the choosen translated string.

#### Inherited Methods

Inherited From TI18NControl

> TI18NControl::getCharset()
> TI18NControl::getCulture()
> TI18NControl::setCharset()
> TI18NControl::setCulture()

Inherited From TControl

> TControl::__construct()
> TControl::addedControl()
> TControl::addParsedObject()
> TControl::addToPostDataLoader()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::bubbleEvent()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::convertUniqueIdToClientId()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::dataBind()
> TControl::dataBindChildren()
> TControl::dataBindProperties()
> TControl::ensureChildControls()
> TControl::findControl()
> TControl::findControlsByID()
> TControl::findControlsByType()
> TControl::focus()
> TControl::getAdapter()
> TControl::getAllowChildControls()
> TControl::getAttribute()
> TControl::getAttributes()
> TControl::getChildControlsCreated()
> TControl::getClientID()
> TControl::getControls()
> TControl::getControlStage()
> TControl::getControlState()
> TControl::getCustomData()
> TControl::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasChildInitialized()
> TControl::getHasControls()
> TControl::getHasInitialized()
> TControl::getHasLoaded()
> TControl::getHasLoadedPostData()
> TControl::getHasPreRendered()
> TControl::getID()
> TControl::getNamingContainer()
> TControl::getPage()
> TControl::getParent()
> TControl::getRegisteredObject()
> TControl::getSkinID()
> TControl::getSourceTemplateControl()
> TControl::getTemplateControl()
> TControl::getUniqueID()
> TControl::getViewState()
> TControl::getVisible()
> TControl::hasAttribute()
> TControl::initRecursive()
> TControl::isDescendentOf()
> TControl::isObjectRegistered()
> TControl::loadRecursive()
> TControl::loadState()
> TControl::loadStateRecursive()
> TControl::onDataBinding()
> TControl::onInit()
> TControl::onLoad()
> TControl::onPreRender()
> TControl::onUnload()
> TControl::preRenderRecursive()
> TControl::raiseBubbleEvent()
> TControl::registerObject()
> TControl::removeAttribute()
> TControl::removedControl()
> TControl::render()
> TControl::renderChildren()
> TControl::renderControl()
> TControl::saveState()
> TControl::saveStateRecursive()
> TControl::setAdapter()
> TControl::setAttribute()
> TControl::setChildControlsCreated()
> TControl::setControlStage()
> TControl::setControlState()
> TControl::setCustomData()
> TControl::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> TControl::trackViewState()
> TControl::traverseChildControls()
> TControl::unbindProperty()
> TControl::unloadRecursive()
> TControl::unregisterObject()
> TControl::__get()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants

#### Inherited Constants

Inherited from TControl

> TControl::AUTOMATIC_ID_PREFIX
> TControl::CLIENT_ID_SEPARATOR
> TControl::CS_CHILD_INITIALIZED
> TControl::CS_CONSTRUCTED
> TControl::CS_INITIALIZED
> TControl::CS_LOADED
> TControl::CS_PRERENDERED
> TControl::CS_STATE_LOADED
> TControl::ID_FORMAT
> TControl::ID_SEPARATOR
> TControl::IS_CHILD_CREATED
> TControl::IS_CREATING_CHILD
> TControl::IS_DISABLE_THEMING
> TControl::IS_DISABLE_VIEWSTATE
> TControl::IS_ID_SET
> TControl::IS_SKIN_APPLIED
> TControl::IS_STYLESHEET_APPLIED
> TControl::RF_ADAPTER
> TControl::RF_AUTO_BINDINGS
> TControl::RF_CHILD_STATE
> TControl::RF_CONTROLS
> TControl::RF_CONTROLSTATE
> TControl::RF_DATA_BINDINGS
> TControl::RF_EVENTS
> TControl::RF_NAMED_CONTROLS
> TControl::RF_NAMED_CONTROLS_ID
> TControl::RF_NAMED_OBJECTS
> TControl::RF_SKIN_ID

Documentation generated on Mon, 21 Apr 2008 11:36:37 -0400 by phpDocumentor 1.3.0RC4