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

Class: Translation2_Admin_Container_dataobjectsimple

Source Location: /Translation2-2.0.0beta2/Admin/Container/dataobjectsimple.php

Class Overview

Translation2_Container
   |
   --Translation2_Container_dataobjectsimple
      |
      --Translation2_Admin_Container_dataobjectsimple

Storage driver for storing/fetching data to/from a database


Author(s):

Version:

  • $Revision: 1.1 $

Methods


Inherited Variables

Inherited Methods

Class: Translation2_Container_dataobjectsimple

Translation2_Container_dataobjectsimple::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container_dataobjectsimple::getOne()
Get a single item from the container, without caching the whole page
Translation2_Container_dataobjectsimple::getPage()
Returns an array of the strings in the selected page
Translation2_Container_dataobjectsimple::getStringID()
Get the stringID for the given string
Translation2_Container_dataobjectsimple::init()
Initialize the container

Class: Translation2_Container

Translation2_Container::Translation2_Container()
Constructor
Translation2_Container::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container::getLang()
Gets the current lang
Translation2_Container::getLangData()
Gets the array data for the lang
Translation2_Container::getLangs()
Gets the available languages
Translation2_Container::getOne()
Get a single item from the container, without caching the whole page Containers should implement this method.
Translation2_Container::getPage()
Returns an array of the strings in the selected page Containers should implement this method.
Translation2_Container::getStringID()
Get the stringID for the given string
Translation2_Container::raiseError()
Trigger a PEAR error
Translation2_Container::setLang()
Sets the current lang

Class Details

[line 52]
Storage driver for storing/fetching data to/from a database

Database Structure:

// meta data etc. not supported

table : translations id // not null primary key autoincrement.. string_id // translation id page // indexed varchar eg. (mytemplate.html) lang // index varchar (eg. en|fr|.....) translation // the translated value in language lang.

This storage driver can use all databases which are supported by the PEAR DB abstraction layer to fetch data.

  • Version: $Revision: 1.1 $


[ Top ]


Method Detail

add   [line 108]

mixed add( $string, $page, array $stringArray, string $stringID, string $pageID)

Add a new entry in the strings table.
  • Return: true on success, PEAR_Error on failure

Parameters:

string   $stringID   — 
string   $pageID   — 
array   $stringArray   —  Associative array with string translations. Sample format: array('en' => 'sample', 'it' => 'esempio')
   $string   — 
   $page   — 

[ Top ]

addLangToAvailList   [line 91]

mixed addLangToAvailList( array $langData)

Creates a new entry in the langsAvail table.

If the table doesn't exist yet, it is created.

  • Return: true on success, PEAR_Error on failure

Parameters:

array   $langData   —  array('lang_id' => 'en', 'table_name' => 'i18n', 'name' => 'english', 'meta' => 'some meta info', 'error_text' => 'not available');

[ Top ]

createNewLang   [line 68]

mixed createNewLang( string $langID)

Creates a new table to store the strings in this language.

If the table is shared with other langs, it is ALTERed to hold strings in this lang too.

  • Return: true on success, PEAR_Error on failure

Parameters:

string   $langID   — 

[ Top ]

remove   [line 170]

mixed remove( string $stringID, string $pageID)

Remove an entry from the strings table.
  • Return: true on success, PEAR_Error on failure

Parameters:

string   $stringID   — 
string   $pageID   — 

[ Top ]

update   [line 154]

mixed update( string $stringID, string $pageID, array $stringArray)

Update an existing entry in the strings table.
  • Return: true on success, PEAR_Error on failure

Parameters:

string   $stringID   — 
string   $pageID   — 
array   $stringArray   —  Associative array with string translations. Sample format: array('en' => 'sample', 'it' => 'esempio')

[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:56:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.