public function getAllDomains() { $domains = [$this->domain]; // add the default domain foreach ($this->sourcePaths as $domain => $paths) { if (is_array($paths)) { array_push($domains, $domain); } } return array_unique($domains); }
/** * Adds a new locale directory + .po file * * @param String $localePath * @param String $locale * @throws FileCreationException */ public function addLocale($localePath, $locale) { $data = array($localePath, "LC_MESSAGES"); if (!file_exists($localePath)) { $this->createDirectory($localePath); } if ($this->configuration->getCustomLocale()) { $data[1] = 'C'; $gettextPath = implode($data, DIRECTORY_SEPARATOR); if (!file_exists($gettextPath)) { $this->createDirectory($gettextPath); } $data[2] = 'LC_MESSAGES'; } $gettextPath = implode($data, DIRECTORY_SEPARATOR); if (!file_exists($gettextPath)) { $this->createDirectory($gettextPath); } // File generation for each domain foreach ($this->configuration->getAllDomains() as $domain) { $data[3] = $domain . ".po"; $localePOPath = implode($data, DIRECTORY_SEPARATOR); if (!$this->createPOFile($localePOPath, $locale, $domain)) { throw new FileCreationException(sprintf('Can\'t create the file: %s', $localePOPath)); } } }