lithium\g11n\catalog\adapter\Gettext::_files PHP Method

_files() protected method

Returns absolute paths to files according to configuration.
protected _files ( string $category, string $locale, string $scope ) : array
$category string
$locale string
$scope string
return array
    protected function _files($category, $locale, $scope)
    {
        $path = $this->_config['path'];
        $scope = $scope ?: 'default';
        if (($pos = strpos($category, 'Template')) !== false) {
            $category = substr($category, 0, $pos);
            return array("{$path}/{$category}_{$scope}.pot");
        }
        if ($category === 'message') {
            $category = 'messages';
        }
        $category = strtoupper($category);
        return array("{$path}/{$locale}/LC_{$category}/{$scope}.mo", "{$path}/{$locale}/LC_{$category}/{$scope}.po");
    }

Usage Example

Beispiel #1
0
 protected function _files($category, $locale, $scope)
 {
     $files = parent::_files($category, $locale, $scope);
     foreach ($files as $key => $file) {
         $extension = pathinfo($file, PATHINFO_EXTENSION);
         if (!$this->mo && $extension == 'mo' || !$this->po && $extension == 'po') {
             unset($files[$key]);
         }
     }
     return $files;
 }