From: Vincent Vanwaelscappel Date: Tue, 15 Mar 2022 12:07:37 +0000 (+0100) Subject: wait #5161 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b9842d8e7a0f9470dbc7872f88f12a82396e01ea;p=cubist_locale.git wait #5161 @0.5 --- diff --git a/src/Translate.php b/src/Translate.php index a15d56d..d24ed51 100644 --- a/src/Translate.php +++ b/src/Translate.php @@ -12,6 +12,7 @@ class Translate protected $_paths = []; protected $_extensions = ['php', 'phtml']; protected $_toTranslate = []; + protected static $_parsed = []; public function __construct() { @@ -49,14 +50,18 @@ class Translate $this->_paths = array_unique($this->_paths); foreach ($this->_paths as $sectionLabel => $path) { - start_measure('Parse path for translations '.$path); + if (isset(self::$_parsed[$path])) { + continue; + } + start_measure('Parse path for translations ' . $path); $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($iterator as $p) { if ($p->isFile()) { $this->_parseFile($p, $sectionLabel); } } - stop_measure('Parse path for translations '.$path); + self::$_parsed[$path] = true; + stop_measure('Parse path for translations ' . $path); } }