Translation2
[ class tree: Translation2 ] [ index: Translation2 ] [ all elements ]

Class: Translation2_Container

Source Location: /Translation2-2.0.0RC1/Container.php

Class Overview


Base class for Translation2 drivers/containers


Author(s):

Copyright:

  • 2004-2005 Lorenzo Alberton

Variables

Methods


Child classes:

Translation2_Container_dataobjectsimple
Simple storage driver for fetching data from a db with DB_DataObject
Translation2_Container_db
Storage driver for fetching data from a database
Translation2_Container_gettext
Storage driver for fetching data with gettext
Translation2_Container_mdb
Storage driver for fetching data from a database
Translation2_Container_mdb2
Storage driver for fetching data from a database
Translation2_Container_xml
Storage driver for fetching data from a XML file

Inherited Variables

Inherited Methods


Class Details

[line 52]
Base class for Translation2 drivers/containers

Extend this class to provide custom containers. Some containers are already bundled with the package.



[ Top ]


Class Variables

$options = array()

[line 60]

Additional options for the storage container

Type:   array


[ Top ]



Method Detail

Translation2_Container (Constructor)   [line 82]

Translation2_Container Translation2_Container( )

Constructor

Has to be overwritten by each storage class

  • Access: public

[ Top ]

fetchLangs   [line 241]

void fetchLangs( )

Fetch the available langs if they're not cached yet.

Containers should implement this method.


Overridden in child classes as:

Translation2_Container_dataobjectsimple::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container_db::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container_gettext::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container_mdb::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container_mdb2::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container_xml::fetchLangs()
Fetch the available langs

[ Top ]

getLang   [line 174]

mixed getLang( [string $format = 'id'])

Gets the current lang
  • Return: array with current lang data or null if not set yet

Parameters:

string   $format     

[ Top ]

getLangData   [line 188]

mixed getLangData( string $langID, [string $format = 'id'])

Gets the array data for the lang
  • Return: array with lang data or null if not available

Parameters:

string   $langID     
string   $format     

[ Top ]

getLangs   [line 201]

void getLangs( [string $format = 'array'])

Gets the available languages

Parameters:

string   $format     ['array' | 'ids' | 'names' | 'encodings']

[ Top ]

getOne   [line 269]

void getOne( $stringID, [ $pageID = null], [ $langID = null])

Get a single item from the container, without caching the whole page Containers should implement this method.

Overridden in child classes as:

Translation2_Container_dataobjectsimple::getOne()
Get a single item from the container, without caching the whole page
Translation2_Container_db::getOne()
Get a single item from the container
Translation2_Container_gettext::getOne()
Get a single item from the container, without caching the whole page
Translation2_Container_mdb::getOne()
Get a single item from the container
Translation2_Container_mdb2::getOne()
Get a single item from the container
Translation2_Container_xml::getOne()
Get a single item from the container

Parameters:

   $stringID     
   $pageID     
   $langID     

[ Top ]

getPage   [line 256]

array getPage( string $pageID, $langID)

Returns an array of the strings in the selected page Containers should implement this method.

Overridden in child classes as:

Translation2_Container_dataobjectsimple::getPage()
Returns an array of the strings in the selected page
Translation2_Container_db::getPage()
Returns an array of the strings in the selected page
Translation2_Container_gettext::getPage()
Get all the strings from a domain (parsing the .mo file)
Translation2_Container_mdb::getPage()
Returns an array of the strings in the selected page
Translation2_Container_mdb2::getPage()
Returns an array of the strings in the selected page
Translation2_Container_xml::getPage()
Returns an array of the strings in the selected page

Parameters:

string   $pageID     
   $langID     

[ Top ]

getStringID   [line 284]

string getStringID( $string, string $pageID, string $stringID)

Get the stringID for the given string

Overridden in child classes as:

Translation2_Container_dataobjectsimple::getStringID()
Get the stringID for the given string
Translation2_Container_db::getStringID()
Get the stringID for the given string
Translation2_Container_gettext::getStringID()
Get the stringID for the given string
Translation2_Container_mdb::getStringID()
Get the stringID for the given string
Translation2_Container_mdb2::getStringID()
Get the stringID for the given string
Translation2_Container_xml::getStringID()
Get the stringID for the given string

Parameters:

string   $stringID     
string   $pageID     
   $string     

[ Top ]

raiseError   [line 300]

void raiseError( string $msg, int $code, [ $mode = PEAR_ERROR_TRIGGER], [ $option = E_USER_WARNING])

Trigger a PEAR error
  • Access: public

Parameters:

string   $msg     error message
int   $code     error code
   $mode     
   $option     

[ Top ]

setCharset   [line 136]

void setCharset( string $charset)

Set charset used to read/store the translations

Overridden in child classes as:

Translation2_Container_mdb2::setCharset()
Set charset used to read/store the translations

Parameters:

string   $charset     

[ Top ]

setLang   [line 153]

void setLang( string $langID)

Sets the current lang

Overridden in child classes as:

Translation2_Container_gettext::setLang()
Sets the current lang

Parameters:

string   $langID     

[ Top ]

_parseOptions   [line 95]

void _parseOptions( array $array)

Parse options passed to the container class
  • Access: protected

Parameters:

array   $array     

[ Top ]


Documentation generated on Sun, 29 Jul 2007 12:00:17 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.