Writes data.
Usage: {{{ $data = array( '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

boolean Success.

Source

						public static function write($name, $category, $locale, $data, array $options = array()) {
		$defaults = array('scope' => null);
		$options += $defaults;

		$category = strtok($category, '.');
		$id = strtok('.');

		if ($id) {
			$data = array($id => $data);
		}

		array_walk($data, function(&$value, $key) {
			if (!is_array($value) || !array_key_exists('translated', $value)) {
				$value = array('id' => $key, 'translated' => $value);
			}
		});

		$adapter = static::adapter($name);
		return $adapter->write($category, $locale, $options['scope'], $data);
	}