pclib  3.0.0
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.
 
 useFile ($fileName)
 Load translation texts from $messages array in php-file $fileName.
 
 translate ($s, array $params=null)
 Translate string $s to selected language.
 
 ntranslate ($s, $n, array $params=null)
 Translate plural form of string $s ($n is number of items).
 
 translateTags ($s)
 Translate each text in $s wrapped in <M></M> tags.
 
- 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...
 
 toArray ()
 Convert object to array. More...
 

Data Fields

 $language
 string Current language
 
 $autoUpdate = false
 bool If enabled, add new texts into db-table automatically.
 
 $name
 Translator name. More...
 
 $storage
 var TranslatorDbStorage
 
- Data Fields inherited from BaseObject
 $serviceLocator
 var function() Return service object when requested with service().
 

Protected Member Functions

 getStorage ()
 Return storage object - if not exists, create one.
 
- Protected Member Functions inherited from BaseObject
 service ($service, $default=null)
 Try acquire $service and load it into property $this->$service. More...
 

Protected Attributes

 $pageName
 Current page in use.
 
 $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()

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

Field Documentation

◆ $name

$name

Translator name.

Table can contains texts for different translators/applications.


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