lithium\g11n\Catalog::write()
Writes data.
Usage:
$data = [
'color' => '色'
];
Catalog::write('runtime', 'message', 'ja', $data);
Parameters
-
string
$name
Provide a configuration name to use for writing.
-
string
$category
A (dot-delimited) category.
-
string
$locale
A locale identifier.
-
mixed
$data
If method is used without specifying an id must be an array.
-
array
$options
Valid options are:
'scope'
: The scope to use.
Returns
booleanSuccess.
Source
public static function write($name, $category, $locale, $data, array $options = []) {
$defaults = ['scope' => null];
$options += $defaults;
$category = strtok($category, '.');
$id = strtok('.');
if ($id) {
$data = [$id => $data];
}
array_walk($data, function(&$value, $key) {
if (!is_array($value) || !array_key_exists('translated', $value)) {
$value = ['id' => $key, 'translated' => $value];
}
});
$adapter = static::adapter($name);
return $adapter->write($category, $locale, $options['scope'], $data);
}