lithium\g11n\catalog\adapter\Gettext::read()
Overrides
lithium\g11n\catalog\Adapter::read()
Reads data.
MO files are preferred over PO files when existent.
Parameters
-
string
$category
A category.
-
string
$locale
A locale identifier.
-
string
$scope
The scope for the current operation.
Returns
arraySource
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->{$method}($stream);
fclose($stream);
if ($data) {
$data['pluralRule'] = [
'id' => 'pluralRule',
'translated' => function($count) {
return $count !== 1;
}
];
return $data;
}
}
}