lithium\g11n\catalog\adapter\Gettext::read()

public method

Reads data.

Parameters

  • string $category

    A category.

  • string $locale

    A locale identifier.

  • string $scope

    The scope for the current operation.

Returns

array

Source

	public function read($category, $locale, $scope) {
		$files = $this->_files($category, $locale, $scope);

		foreach ($files as $file) {
			$method = '_parse' . ucfirst(pathinfo($file, PATHINFO_EXTENSION));

			if (!file_exists($file) || !is_readable($file)) {
				continue;
			}
			$stream = fopen($file, 'rb');
			$data = $this->invokeMethod($method, array($stream));
			fclose($stream);

			if ($data) {
				$data['pluralRule'] = array(
					'id' => 'pluralRule',
					'translated' => function($count) {
						return $count !== 1;
					}
				);
				return $data;
			}
		}
	}