[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/I18N/ -> TTranslate.php (sommaire)

TTranslate, I18N translation component.

Author: Wei Zhuo
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TTranslate.php 1397 2006-09-07 07:55:53Z wei $
Poids: 256 lignes (7 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

TTranslate:: (15 méthodes):
  getText()
  setText()
  setKey()
  getKey()
  getCatalogue()
  setCatalogue()
  setTrim()
  getTrim()
  getParameters()
  hasParameter()
  getParameter()
  setParameter()
  removeParameter()
  render()
  translateText()


Classe: TTranslate  - X-Ref

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.
<code>
<com:TTranslate Text="Goodbye" />
</code>

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.
<code>
<com:TTranslate Parameters.time=<%= time() %> >
The unix-time is "{time}".
</com:TTranslate>
</code>

More complex string substitution can be applied using the
TTranslateParameter component.

Namespace: System.I18N

Properties
- <b>Text</b>, string,
<br>Gets or sets the string to translate.
- <b>Catalogue</b>, string,
<br>Gets or sets the catalogue for message translation. The
default catalogue can be set by the @Page directive.
- <b>Key</b>, string,
<br>Gets or sets the key used to message look up.
- <b>Trim</b>, boolean,
<br>Gets or sets an option to trim the contents.
Default is to trim the contents.

getText()   X-Ref

return: string the text to be localized/translated.

setText($value)   X-Ref
Sets the text for localization.

param: string the text for translation.

setKey($value)   X-Ref
Set the key for message lookup.

param: string key

getKey()   X-Ref
Get the key for message lookup.

return: string key

getCatalogue()   X-Ref
Get the message catalogue.

return: string catalogue.

setCatalogue($value)   X-Ref
Set the message catalogue.

param: string catalogue.

setTrim($value)   X-Ref
Set the option to trim the contents.

param: boolean trim or not.

getTrim()   X-Ref
Trim the content or not.

return: boolean trim or not.

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

return: TAttributeCollection the list of custom parameters

hasParameter($name)   X-Ref

return: boolean whether the named parameter exists

getParameter($name)   X-Ref

return: string parameter value, null if parameter does not exist

setParameter($name,$value)   X-Ref

param: string parameter name
param: string value of the parameter

removeParameter($name)   X-Ref
Removes the named parameter.

param: string the name of the parameter to be removed.
return: string parameter value removed, null if parameter does not exist.

render($writer)   X-Ref
renders the translated string.


translateText($text, $subs)   X-Ref
Translates the text with subsititution.

param: string text for translation
param: array list of substitutions
return: string translated text



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7