PHP Class Prado\I18N\core\MessageSource_SQLite

Retrive the message translation from a SQLite database. See the MessageSource::factory() method to instantiate this class.
Inheritance: extends MessageSource
ファイルを表示 Open project: pradosoft/prado

Protected Properties

Property Type Description
$source string The SQLite datasource, the filename of the database.

Public Methods

Method Description
__construct ( $source ) Constructor.
catalogues ( ) : array Returns a list of catalogue as key and all it variants as value.
delete ( $message, $catalogue = 'messages' ) : boolean Delete a particular message from the specified catalogue.
save ( $catalogue = 'messages' ) : boolean Save the list of untranslated blocks to the translation source.
update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean Update the translation.

Protected Methods

Method Description
getCatalogueList ( $catalogue ) : array Get all the variants of a particular catalogue.
getLastModified ( $source ) : integer Get the last modified unix-time for this particular catalogue+variant.
isValidSource ( $variant ) : boolean Check if a particular catalogue+variant exists in the database.
loadData ( $variant ) : array Get an array of messages for a particular catalogue and cultural variant.

Private Methods

Method Description
getCatalogueDetails ( $catalogue = 'messages' ) : array Retrive catalogue details, array($cat_id, $variant, $count).
updateCatalogueTime ( $cat_id, $variant, $db ) : boolean Update the catalogue last modified time.

Method Details

__construct() public method

Create a new message source using SQLite.
public __construct ( $source )

catalogues() public method

Returns a list of catalogue as key and all it variants as value.
public catalogues ( ) : array
return array list of catalogues

delete() public method

Delete a particular message from the specified catalogue.
public delete ( $message, $catalogue = 'messages' ) : boolean
return boolean true if deleted, false otherwise.

getCatalogueList() protected method

Get all the variants of a particular catalogue.
protected getCatalogueList ( $catalogue ) : array
return array list of all variants for this catalogue.

getLastModified() protected method

We need to query the database to get the date_modified.
protected getLastModified ( $source ) : integer
return integer last modified in unix-time format.

isValidSource() protected method

Check if a particular catalogue+variant exists in the database.
protected isValidSource ( $variant ) : boolean
return boolean true if the catalogue+variant is in the database, false otherwise.

loadData() protected method

Get an array of messages for a particular catalogue and cultural variant.
protected loadData ( $variant ) : array
return array translation messages.

save() public method

If the translation was not found, you should add those strings to the translation source via the append() method.
public save ( $catalogue = 'messages' ) : boolean
return boolean true if saved successfuly, false otherwise.

update() public method

Update the translation.
public update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean
return boolean true if translation was updated, false otherwise.

Property Details

$source protected_oe property

The SQLite datasource, the filename of the database.
protected string $source
return string