PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TTranslate

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

<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.
TComponent
Extended by TApplicationComponent
Extended by TControl implements IRenderable, IBindable
Extended by TI18NControl
Extended by TTranslate

Direct known subclasses

TChoiceFormat
Package: System\I18N
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
Version: v1.0, last update on Fri Dec 24 21:38:49 EST 2004
Located at I18N/TTranslate.php
Methods summary
public string
# getText( )

Returns

string
the text to be localized/translated.
public
# setText( string $value )

Sets the text for localization.

Sets the text for localization.

Parameters

$value
string
the text for translation.
public
# setKey( string $value )

Set the key for message lookup.

Set the key for message lookup.

Parameters

$value
string
key
public string
# getKey( )

Get the key for message lookup.

Get the key for message lookup.

Returns

string
key
public string
# getCatalogue( )

Get the message catalogue.

Get the message catalogue.

Returns

string
catalogue.
public
# setCatalogue( string $value )

Set the message catalogue.

Set the message catalogue.

Parameters

$value
string
catalogue.
public
# setTrim( boolean $value )

Set the option to trim the contents.

Set the option to trim the contents.

Parameters

$value
boolean
trim or not.
public boolean
# getTrim( )

Trim the content or not.

Trim the content or not.

Returns

boolean
trim or not.
public TAttributeCollection
# getParameters( )

Returns the list of custom parameters. Custom parameters are name-value pairs that may subsititute translation place holders during rendering.

Returns the list of custom parameters. Custom parameters are name-value pairs that may subsititute translation place holders during rendering.

Returns

TAttributeCollection
the list of custom parameters
public boolean
# hasParameter( mixed $name )

Returns

boolean
whether the named parameter exists
public string
# getParameter( mixed $name )

Returns

string
parameter value, null if parameter does not exist
public
# setParameter( string $name, string $value )

Parameters

$name
string
parameter name
$value
string
value of the parameter
public string
# removeParameter( string $name )

Removes the named parameter.

Removes the named parameter.

Parameters

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

Returns

string
parameter value removed, null if parameter does not exist.
public
# render( THtmlWriter $writer )

renders the translated string.

renders the translated string.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose

Overrides

TControl::render()
protected string
# translateText( string $text, array $subs )

Translates the text with subsititution.

Translates the text with subsititution.

Parameters

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

Returns

string
translated text
Methods inherited from TI18NControl
getCharset(), getCulture(), setCharset(), setCulture()
Methods inherited from TControl
__construct(), __get(), addParsedObject(), addToPostDataLoader(), addedControl(), applyStyleSheetSkin(), autoBindProperty(), autoDataBindProperties(), bindProperty(), broadcastEvent(), bubbleEvent(), clearChildState(), clearControlState(), clearNamingContainer(), clearViewState(), convertUniqueIdToClientId(), createChildControls(), createControlCollection(), dataBind(), dataBindChildren(), dataBindProperties(), ensureChildControls(), findControl(), findControlsByID(), findControlsByType(), focus(), getAdapter(), getAllowChildControls(), getAttribute(), getAttributes(), getChildControlsCreated(), getClientID(), getControlStage(), getControlState(), getControls(), getCustomData(), getEnableTheming(), getEnableViewState(), getEnabled(), getHasAdapter(), getHasAttributes(), getHasChildInitialized(), getHasControls(), getHasInitialized(), getHasLoaded(), getHasLoadedPostData(), getHasPreRendered(), getID(), getIsSkinApplied(), getNamingContainer(), getPage(), getParent(), getRegisteredObject(), getSkinID(), getSourceTemplateControl(), getTemplateControl(), getUniqueID(), getViewState(), getVisible(), hasAttribute(), initRecursive(), isDescendentOf(), isObjectRegistered(), loadRecursive(), loadState(), loadStateRecursive(), onDataBinding(), onInit(), onLoad(), onPreRender(), onUnload(), preRenderRecursive(), raiseBubbleEvent(), registerObject(), removeAttribute(), removedControl(), renderChildren(), renderControl(), saveState(), saveStateRecursive(), setAdapter(), setAttribute(), setChildControlsCreated(), setControlStage(), setControlState(), setCustomData(), setEnableTheming(), setEnableViewState(), setEnabled(), setID(), setPage(), setSkinID(), setTemplateControl(), setViewState(), setVisible(), trackViewState(), traverseChildControls(), unbindProperty(), unloadRecursive(), unregisterObject()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __isset(), __set(), __sleep(), __unset(), __wakeup(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TControl
AUTOMATIC_ID_PREFIX, CLIENT_ID_SEPARATOR, CS_CHILD_INITIALIZED, CS_CONSTRUCTED, CS_INITIALIZED, CS_LOADED, CS_PRERENDERED, CS_STATE_LOADED, ID_FORMAT, ID_SEPARATOR, IS_CHILD_CREATED, IS_CREATING_CHILD, IS_DISABLE_THEMING, IS_DISABLE_VIEWSTATE, IS_ID_SET, IS_SKIN_APPLIED, IS_STYLESHEET_APPLIED, RF_ADAPTER, RF_AUTO_BINDINGS, RF_CHILD_STATE, RF_CONTROLS, RF_CONTROLSTATE, RF_DATA_BINDINGS, RF_EVENTS, RF_NAMED_CONTROLS, RF_NAMED_CONTROLS_ID, RF_NAMED_OBJECTS, RF_SKIN_ID
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO