Fixed file list bug

This commit is contained in:
Franck Allimant
2013-11-07 14:57:18 +01:00
parent 086ede3143
commit d2a9de682d

View File

@@ -130,7 +130,7 @@ class TemplateHelper
*/ */
public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) { public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) {
$num_files = 0; $num_texts = 0;
if ($walkMode == self::WALK_MODE_PHP) { if ($walkMode == self::WALK_MODE_PHP) {
$prefix = '\-\>[\s]*trans[\s]*\('; $prefix = '\-\>[\s]*trans[\s]*\(';
@@ -155,7 +155,7 @@ class TemplateHelper
if ($fileInfo->isDot()) continue; if ($fileInfo->isDot()) continue;
if ($fileInfo->isDir()) $num_files += $this->walkDir($fileInfo->getPathName(), $walkMode, $translator, $currentLocale, $strings); if ($fileInfo->isDir()) $num_texts += $this->walkDir($fileInfo->getPathName(), $walkMode, $translator, $currentLocale, $strings);
if ($fileInfo->isFile()) { if ($fileInfo->isFile()) {
@@ -186,18 +186,19 @@ class TemplateHelper
$strings[$hash]['files'][] = $short_path; $strings[$hash]['files'][] = $short_path;
} }
} }
else else {
$num_files++; $num_texts++;
// remove \' // remove \'
$match = str_replace("\\'", "'", $match); $match = str_replace("\\'", "'", $match);
$strings[$hash] = array( $strings[$hash] = array(
'files' => array($short_path), 'files' => array($short_path),
'text' => $match, 'text' => $match,
'translation' => $translator->trans($match, array(), 'messages', $currentLocale, false), 'translation' => $translator->trans($match, array(), 'messages', $currentLocale, false),
'dollar' => strstr($match, '$') !== false 'dollar' => strstr($match, '$') !== false
); );
}
} }
} }
} }
@@ -205,7 +206,7 @@ class TemplateHelper
} }
} }
return $num_files; return $num_texts;
} catch (\UnexpectedValueException $ex) { } catch (\UnexpectedValueException $ex) {
echo $ex; echo $ex;