## 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 values of any attribute in TTranslate are consider as values for substitution. Strings enclosed with "{" and "}" are consider as the parameters. The following example will substitution the string "{time}" with the value of the attribute "time="#time()". Note that the value of the attribute time is evaluated.

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

More complex string substitution can be applied using the TParam 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 getText ()
boolean getTrim ()
void render (mixed $writer)
void setCatalogue (string $value)
void setKey (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 ()
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 ()
render (line 139)

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

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 169)

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::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::broadcastEventInternal()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::createdOnTemplate()
> 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::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasControls()
> 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::onBubbleEvent()
> 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::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> 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::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> 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

Documentation generated on Mon, 01 May 2006 23:04:57 -0400 by phpDocumentor 1.3.0RC4