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

Class: Translation2_Container

Source Location: /Translation2-2.0.4/Translation2/Container.php

Class Overview


Base class for Translation2 drivers/containers


Author(s):

Copyright:

  • 2004-2005 Lorenzo Alberton

Variables

Methods


Child classes:

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

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 83]

Translation2_Container Translation2_Container( )

Constructor Has to be overwritten by each storage class
  • Access: public

[ Top ]

fetchLangs   [line 269]

PEAR_Error fetchLangs( )

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

Containers should implement this method.

  • Return: on error

Overridden in child classes as:

Translation2_Container_xml::fetchLangs()
Fetch the available langs
Translation2_Container_mdb2::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_db::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container_dataobjectsimple::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.

[ Top ]

getLang   [line 188]

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

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

Parameters:

string   $format     what must be returned

[ Top ]

getLangData   [line 204]

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     language ID
string   $format     what must be returned

[ Top ]

getLangs   [line 220]

array|PEAR_Error getLangs( [string $format = 'array'])

Gets the available languages

Parameters:

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

[ Top ]

getOne   [line 306]

string getOne( string $stringID, [string $pageID = null], [string $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_xml::getOne()
Get a single item from the container
Translation2_Container_mdb2::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_db::getOne()
Get a single item from the container
Translation2_Container_dataobjectsimple::getOne()
Get a single item from the container, without caching the whole page
Translation2_Container_mdb::getOne()
Get a single item from the container

Parameters:

string   $stringID     string ID
string   $pageID     page/group ID
string   $langID     language ID

[ Top ]

getPage   [line 287]

array getPage( [string $pageID = null], [string $langID = null])

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

Overridden in child classes as:

Translation2_Container_xml::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_gettext::getPage()
Get all the strings from a domain (parsing the .mo file)
Translation2_Container_db::getPage()
Returns an array of the strings in the selected page
Translation2_Container_dataobjectsimple::getPage()
Returns an array of the strings in the selected page
Translation2_Container_mdb::getPage()
Returns an array of the strings in the selected page

Parameters:

string   $pageID     page/group ID
string   $langID     language ID

[ Top ]

getStringID   [line 323]

string getStringID( string $string, [string $pageID = null])

Get the stringID for the given string

Overridden in child classes as:

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

Parameters:

string   $string     string
string   $pageID     page/group ID

[ Top ]

raiseError   [line 343]

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

Trigger a PEAR error
  • Access: public

Parameters:

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

[ Top ]

setCharset   [line 143]

PEAR_Error setCharset( string $charset)

Set charset used to read/store the translations
  • Return: on error

Overridden in child classes as:

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

Parameters:

string   $charset     character set (encoding)

[ Top ]

setLang   [line 162]

array|PEAR_Error setLang( string $langID)

Sets the current language
  • Return: language information

Overridden in child classes as:

Translation2_Container_gettext::setLang()
Sets the current lang

Parameters:

string   $langID     language ID

[ Top ]

_parseOptions   [line 98]

void _parseOptions( array $array)

Parse options passed to the container class
  • Access: protected

Parameters:

array   $array     options

[ Top ]


Documentation generated on Mon, 06 Dec 2010 00:00:20 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.