pclib  2.3.2
Lightweight PHP framework
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Translator Class Reference

Translate strings to another language. More...

Inheritance diagram for Translator:
BaseObject

Public Member Functions

 __construct ($name=null)
 
 usePage ($pageName)
 Load translation texts for page $pageName. More...
 
 useFile ($fileName)
 Load translation texts from $messages array in php-file $fileName. More...
 
 translate ($s, array $params=null)
 Translate string $s to selected language. More...
 
 ntranslate ($s, $n, array $params=null)
 Translate plural form of string $s ($n is number of items). More...
 
 translateTags ($s)
 Translate each text in $s wrapped in <M></M> tags. More...
 
- Public Member Functions inherited from BaseObject
 loadDefaults ($className=null)
 Load default parameters of class $className into object instance.
 
 setProperties (array $defaults)
 Set public properties of object from the array. More...
 
 addEvent ($name, $callback)
 Add event handler to $object->$name property. More...
 
 toArray ()
 Convert object to array. More...
 

Data Fields

 $language
 string Current language
 
 $autoUpdate = false
 bool If enabled, add new texts into db-table automatically. More...
 
 $name
 Translator name. More...
 
 $storage
 var TranslatorDbStorage
 
- Data Fields inherited from BaseObject
 $onNewInstance
 Occurs when new instance of the class is created. More...
 
 $onMissingMethod
 Occurs when called method does not exist. More...
 
 $serviceLocator
 var function() Return service object when requested with service(). More...
 

Protected Member Functions

 getStorage ()
 Return storage object - if not exists, create one. More...
 
- Protected Member Functions inherited from BaseObject
 fireEvent ($name, array $args=array())
 Run all event handlers in $object->$name property. More...
 
 service ($service, $default=null)
 Try acquire $service and load it into property $this->$service. More...
 

Protected Attributes

 $pageName
 Current page in use. More...
 
 $cache = array()
 array message buffer
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseObject
static defaults ()
 Set or retireve default parameters of the object. More...
 

Detailed Description

Translate strings to another language.

Features:

Constructor & Destructor Documentation

__construct (   $name = null)
Parameters
string$nameTranslator name

Member Function Documentation

getStorage ( )
protected

Return storage object - if not exists, create one.

ntranslate (   $s,
  $n,
array  $params = null 
)

Translate plural form of string $s ($n is number of items).

translate (   $s,
array  $params = null 
)

Translate string $s to selected language.

translateTags (   $s)

Translate each text in $s wrapped in <M></M> tags.

useFile (   $fileName)

Load translation texts from $messages array in php-file $fileName.

usePage (   $pageName)

Load translation texts for page $pageName.

Field Documentation

$autoUpdate = false

bool If enabled, add new texts into db-table automatically.

$name

Translator name.

Table can contains texts for different translators/applications.

$pageName
protected

Current page in use.


The documentation for this class was generated from the following file: