[ Index ] |
|
Code source de Symfony 1.0.0 |
[Code source] [Imprimer] [Statistiques]
sfMessageSource class file. This program is free software; you can redistribute it and/or modify it under the terms of the BSD License.
Author: | Wei Zhuo |
Version: | $Id: sfMessageSource.class.php 2834 2006-11-27 14:09:05Z fabien $ |
Poids: | 325 lignes (9 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
__construct() X-Ref |
Private constructor. sfMessageSource must be initialized using the factory method. |
factory($type, $source = '.', $filename = '') X-Ref |
Factory method to instantiate a new sfMessageSource depending on the source type. The built-in source types are 'XLIFF', 'SQLite', 'MySQL', 'gettext' and Creole. The source parameter is dependent on the source type. For 'gettext' and 'XLIFF', it should point to the directory where the messages are stored. For database types, e.g. 'SQLite' and 'MySQL', it should be a PEAR DB style DSN string. Custom message source are possible by supplying the a filename parameter in the factory method. param: string the message source type. param: string the location of the resource. param: string the filename of the custom message source. return: sfMessageSource a new message source of the specified type. |
load($catalogue='messages') X-Ref |
Load a particular message catalogue. Use read() to to get the array of messages. The catalogue loading sequence is as follows # [1] call getCatalogeList($catalogue) to get a list of variants for for the specified $catalogue. # [2] for each of the variants, call getSource($variant) to get the resource, could be a file or catalogue ID. # [3] verify that this resource is valid by calling isValidSource($source) # [4] try to get the messages from the cache # [5] if a cache miss, call load($source) to load the message array # [6] store the messages to cache. # [7] continue with the foreach loop, e.g. goto [2]. param: string a catalogue to load return: boolean true if loaded, false otherwise. |
read() X-Ref |
Get the array of messages. param: parameter return: array translation messages. |
getCache() X-Ref |
Get the cache handler for this source. return: sfMessageCache cache handler |
setCache(sfMessageCache $cache) X-Ref |
Set the cache handler for caching the messages. param: sfMessageCache the cache handler. |
append($message) X-Ref |
Add a untranslated message to the source. Need to call save() to save the messages to source. param: string message to add |
setCulture($culture) X-Ref |
Set the culture for this message source. param: string culture name |
getCulture() X-Ref |
Get the culture identifier for the source. return: string culture identifier. |
getLastModified($source) X-Ref |
Get the last modified unix-time for this particular catalogue+variant. param: string catalogue+variant return: int last modified in unix-time format. |
loadData($variant) X-Ref |
Load the message for a particular catalogue+variant. This methods needs to implemented by subclasses. param: string catalogue+variant. return: array of translation messages. |
getSource($variant) X-Ref |
Get the source, this could be a filename or database ID. param: string catalogue+variant return: string the resource key |
isValidSource($source) X-Ref |
Determine if the source is valid. param: string catalogue+variant return: boolean true if valid, false otherwise. |
getCatalogueList($catalogue) X-Ref |
Get all the variants of a particular catalogue. This method must be implemented by subclasses. param: string catalogue name return: array list of all variants for this catalogue. |
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |