PHP Class lithium\g11n\Catalog

The class is able to aggregate data from different sources which allows to complement sparse data. Not all categories must be supported by an individual adapter.
Inheritance: extends lithium\core\Adaptable
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Свойство Type Description
$_adapters Libraries::locate() compatible path to adapters for this class.
$_configurations Collection A Collection of the configurations you add through Catalog::config().

Méthodes publiques

Méthode Description
config ( array $config = null ) : array Sets configurations for this Adaptable implementation.
read ( mixed $name, string $category, string $locale, array $options = [] ) : array Reads data.
write ( string $name, string $category, string $locale, mixed $data, array $options = [] ) : boolean Writes data.

Method Details

config() public static méthode

Sets configurations for this Adaptable implementation.
public static config ( array $config = null ) : array
$config array Configurations, indexed by name.
Résultat array `Collection` of configurations or void if setting configurations.

read() public static méthode

Results are aggregated by querying all requested configurations for the requested locale then repeating this process for all locales down the locale cascade. This allows for sparse data which is complemented by data from other sources or for more generic locales. Aggregation can be controlled by either specifying the configurations or a scope to use. Usage: Catalog::read(true, 'message', 'zh'); Catalog::read('default', 'message', 'zh'); Catalog::read('default', 'validation.postalCode', 'en_US');
public static read ( mixed $name, string $category, string $locale, array $options = [] ) : array
$name mixed Provide a single configuration name as a string or multiple ones as an array which will be used to read from. Pass `true` to use all configurations.
$category string A (dot-delimeted) category.
$locale string A locale identifier.
$options array Valid options are: - `'scope'`: The scope to use. - `'lossy'`: Whether or not to use the compact and lossy format, defaults to `true`.
Résultat array If available the requested data, else `null`.

write() public static méthode

Usage: $data = array( 'color' => '色' ); Catalog::write('runtime', 'message', 'ja', $data);
public static write ( string $name, string $category, string $locale, mixed $data, array $options = [] ) : boolean
$name string Provide a configuration name to use for writing.
$category string A (dot-delimited) category.
$locale string A locale identifier.
$data mixed If method is used without specifying an id must be an array.
$options array Valid options are: - `'scope'`: The scope to use.
Résultat boolean Success.

Property Details

$_adapters protected_oe static_oe property

Libraries::locate() compatible path to adapters for this class.
See also: lithium\core\Libraries::locate()
protected static $_adapters

$_configurations protected_oe static_oe property

A Collection of the configurations you add through Catalog::config().
protected static Collection $_configurations
Résultat Collection