Find a translation path

@param array  $info  The path information
@return array
519872
public function find(array $info)
    {
        $result = array();

        if($info['path'] && $info['locale'])
        {
            $pattern = $info['path'].'/'.$info['locale'].'.*';
            $results = glob($pattern);

            if ($results)
            {
                foreach($results as $file)
                {
                    if($path = $this->realPath($file))
                    {
                        $result[] = $path;
                        break;
                    }
                }
            }
        }

        return $result;
    }
635606
public function getPath($toArray = false)
    {
        $result = $toArray ? $this->_path : $this->_pathEncode($this->_path);
        return $result;
    }
1154243
public function readTranslation($module) {
		
		// get the right translation folder
		$file = APPLICATION_PATH . (is_a($module,'Pair\Module') ? '/modules/' . $module->name : '') . '/translations/' . $this->getRepresentation() . '.ini';
		
		// checks that folder exists
		if (file_exists($file)) {
			
			// scans file and gets translation strings
			$strings = parse_ini_file($file);
			return (is_array($strings) ? $strings : array());
			
		} else {
			
			return array();
			
		}
		
	}
888810
public function find(array $info)
    {
        $path = str_replace(parse_url($info['url'], PHP_URL_SCHEME).'://', '', $info['url']);

        $file   = pathinfo($path, PATHINFO_FILENAME);
        $format = pathinfo($path, PATHINFO_EXTENSION);
        $path   = ltrim(pathinfo($path, PATHINFO_DIRNAME), '.');

        $parts = array();

        //Add the base path
        if($base = $this->getBasePath()) {
            $parts[] = $base;
        }

        //Add the file path
        if($path) {
            $parts[] = $path;
        }

        //Add the file
        $parts[] = $file;

        //Create the path
        $path = implode('/', $parts);

        //Append the format
        if($format) {
            $path = $path.'.'.$format;
        }

        if(!$result = $this->realPath($path))
        {
            $pattern = $path.'.*';
            $results = glob($pattern);

            //Try to find the file
            if ($results)
            {
                foreach($results as $file)
                {
                    if($result = $this->realPath($file)) {
                        break;
                    }
                }
            }
        }

        return $result;
    }
563830
protected function getMessageFilePath($language)
    {
        $messageFile = $this->aliases->get($this->basePath) . '/' . $language . '/' . $this->catalog;
        if ($this->useMoFile) {
            $messageFile .= self::MO_FILE_EXT;
        } else {
            $messageFile .= self::PO_FILE_EXT;
        }

        return $messageFile;
    }
661396
public function getPaths($extension = null)
	{
		if (isset($extension)) {

            if (isset($this->_paths[$extension])) {
				return $this->_paths[$extension];
            }

			return array();
		}
		else
		{
			return $this->_paths;
		}
	}
139845
public function getTranslations( $category = null ) : array
   {

      $translations = [];

      // If no category is defined (must be NULL) return all translations without a
      if ( \is_null( $category ) )
      {

         foreach ( $this->_translations as $identifier => $transData )
         {
            if ( is_string( $transData ) )
            {
               $translations[ $identifier ] = $transData;
               continue;
            }
            if ( ! \is_array( $transData ) || ! isset( $transData[ 'text' ] ) )
            {
               continue;
            }
            $translations[ $identifier ] = $transData[ 'text' ];
         }

         return $translations;

      }

      $category     = \trim( $category );
      $withCategory = \strlen( $category ) > 0;

      $this->getCategories();

      if ( ! \in_array( $category, $this->_categories ) && $category !== '' )
      {
         return $translations;
      }

      foreach ( $this->_translations as $identifier => $transData )
      {

         if ( $withCategory )
         {
            if ( ! \is_array( $transData ) ||
                 ! isset( $transData[ 'category' ] ) ||
                 ! isset( $transData[ 'text' ] ) ||
                 $transData[ 'category' ] !== $category )
            {
               continue;
            }
            $translations[ $identifier ] = $transData[ 'text' ];
         }
         else
         {
            if ( \is_array( $transData ) && isset( $transData[ 'text' ] ) )
            {
               if ( ( isset( $transData[ 'category' ] ) && $transData[ 'category' ] === '' ) ||
                    ! isset( $transData[ 'category' ] ) )
               {
                  $translations[ $identifier ] = $transData[ 'text' ];
               }
            }
            else if ( \is_string( $transData ) )
            {
               $translations[ $identifier ] = $transData;
            }
         }

      }

      return $translations;

   }
1181816
public function getTranslationsForKey($key) {
		$this->getAllTranslationByLanguage();
		$translations = [];
		foreach ($this->messages as $language => $messages) {
			foreach ($messages as $messageKey => $message) {
				if($key == $messageKey) {
					$translations[$language] = $message;
				}
			}
		}
		return $translations;
	}
429492
protected function getTranslations( $domain )
	{
		if( !isset( $this->files[$domain] ) )
		{
			if ( !isset( $this->sources[$domain] ) )
			{
				$msg = sprintf( 'No translation directory for domain "%1$s" available', $domain );
				throw new \Aimeos\MW\Translation\Exception( $msg );
			}

			// Reverse locations so the former gets not overwritten by the later
			$locations = array_reverse( $this->getTranslationFileLocations( $this->sources[$domain], $this->getLocale() ) );

			foreach( $locations as $location ) {
				$this->files[$domain][$location] = new \Aimeos\MW\Translation\File\Mo( $location );
			}
		}

		return ( isset( $this->files[$domain] ) ? $this->files[$domain] : [] );
	}
768539
public function find(array $info)
    {
        //Get the package
        $package = $info['package'];

        //Get the domain
        $domain = $info['domain'];

        //Check if we are trying to find a template inside an application component
        if($path = $this->getObject('object.bootstrapper')->getApplicationPath($domain)) {
            $path = $path.'/com_'.strtolower($package);
        } else {
            $path = $this->getObject('object.bootstrapper')->getComponentPath($package).'/resources';
        }

        return array('com_' . $package => $path);
    }
852887
private function parseLine( $line, $info ) 
	{
		$handled = false;
		if (preg_match('/^\s*(@[a-z]+)\s(.*)$/i', $line, $matches)) 
		{
			$this->currentTag = substr($matches[1], 1);
			$line = trim( substr($line, strlen($this->currentTag)+2 ) );
			switch( $this->currentTag ) 
			{
				case 'param' :
					if ( preg_match('/^\s*([[:alpha:]|]+)\s([[:alnum:]$_]+)(.*)$/i', $line, $matches) ) 
					{
						if ( !isset($info['arguments']) ) {
							$info['arguments'] = array();
						}
						if ( !isset($info['arguments'][$matches[2]]) ) {
							$info['arguments'][$matches[2]] = array('description' => '');
						}
						$info['arguments'][$matches[2]]['type'] = $matches[1];
						$info['arguments'][$matches[2]]['description'] .= $this->parseDescription($matches[3]);
					}
					$handled = true;
				break;
				case 'return' :
					if ( preg_match('/^\s*([[:alpha:]|]+)\s(.*)$/i', $line, $matches) ) 
					{
						if ( !isset($info['return']) ) {
							$info['return'] = array( 'description' => '' );
						}
						$info['return']['type'] = $matches[1];
						$info['return']['description'] .= $this->parseDescription($matches[2]);
					}
					$handled = true;
				break;
			}
		}
		if (!$handled) {
			switch( $this->currentTag) {
				case 'param' :
				case 'return' :
					if ( !isset( $info[$this->currentTag] ) ) {
						$info[$this->currentTag] = array();
					}
					$info[$this->currentTag]['description'] .= $this->parseDescription($line);
				break;
				default:
					if ( !isset( $info[$this->currentTag] ) ) {
						$info[$this->currentTag] = '';
					}
					$info[$this->currentTag] .= $this->parseDescription($line);
				break;
			}
		}
		return $info;
	}
974991
public function getI18nPaths()
	{
		$paths = array();

		foreach ( $this->_manifests as $basePath => $manifest )
		{
			if ( isset( $manifest['i18n'] ) )
			{
				foreach( $manifest['i18n'] as $domain => $location ) {
					$paths[$domain][] = $basePath . DIRECTORY_SEPARATOR . $location;
				}
			}
		}

		return $paths;
	}
783738
private function _translateLocalResources($environmentInfo)
    {
        $localResourcesMap = [];

        $localResourcesInfo = Utilities::tryGetKeysChainValue(
            $environmentInfo,
            'CurrentInstance',
            'LocalResources',
            'LocalResource'
        );

        if (!is_null($localResourcesInfo)) {
            if (array_key_exists('@attributes', $localResourcesInfo)) {
                $localResourcesInfo = [0 => $localResourcesInfo];
            }

            foreach ($localResourcesInfo as $localResourceInfo) {
                $localResource = new LocalResource(
                    $localResourceInfo['@attributes']['sizeInMB'],
                    $localResourceInfo['@attributes']['name'],
                    $localResourceInfo['@attributes']['path']
                );

                $localResourcesMap[$localResource->getName()] = $localResource;
            }
        }

        return $localResourcesMap;
    }
502944
protected function parseLog($info)
    {
        $requestInfo = [
            'ip'     => $this->app['request']->ip(),
            'method' => $this->app['request']->method(),
            'host'   => $this->app['request']->host(),
            'uri'    => $this->app['request']->url(),
        ];

        if ($this->config['json']) {
            $info = $requestInfo + $info;
            return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n";
        }

        array_unshift($info, "---------------------------------------------------------------\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}");
        unset($info['timestamp']);

        return implode("\r\n", $info) . "\r\n";
    }
6526
protected function getInformationTargetPath()
    {
        if ($path = array_get($this->config, 'path')) {
            return $path;
        }

        return rtrim($this->getInformationTargetBasePath(), DIRECTORY_SEPARATOR)
             . DIRECTORY_SEPARATOR
             . $this->getInformationTargetRelativePath();
    }
780150
protected function getIpFromInfo($info)
    {
        $ip = \Piwik\Network\IP::fromStringIP($info['ip']);

        return $ip->toString();
    }
634119
private function parsePathTranslations($domains)
    {
        $translations = array();
        if (!empty($domains)) {
            foreach ($domains as $domain => $paths) {
                if (strlen($domain) && array_key_exists('template', $paths)) {
                    $this->addPath($paths['template'], $domain);
                    $translations[] = $this->generateTemplate($paths['template'], $domain);
                }
            }
        }

        return $translations;
    }