Example #1
0
 /**
  * Returns the path to the existing localized version of file given.
  *
  * Searching is done for the current locale if no $locale parameter is
  * provided. The search is done according to the configured fallback
  * rule.
  *
  * If parameter $strict is provided, searching is done only for the
  * provided / current locale (without searching of files localized for
  * more generic locales).
  *
  * If no localized version of file is found, $filepath is returned without
  * any change.
  *
  * @param string $path Base directory to the translation files
  * @param string $sourceName name of the translation source
  * @param \TYPO3\FLOW3\I18n\Locale $locale Desired locale of XLIFF file
  * @return array Path to the localized file (or $filename when no localized file was found) and the matched locale
  * @see Configuration::setFallbackRule()
  * @api
  */
 public function getXliffFilenameAndPath($path, $sourceName, Locale $locale = NULL)
 {
     if ($locale === NULL) {
         $locale = $this->configuration->getCurrentLocale();
     }
     foreach ($this->getLocaleChain($locale) as $localeIdentifier => $locale) {
         $possibleXliffFilename = Files::concatenatePaths(array($path, $localeIdentifier, $sourceName . '.xlf'));
         if (file_exists($possibleXliffFilename)) {
             return array($possibleXliffFilename, $locale);
         }
     }
     return array(FALSE, $locale);
 }