/** * Write translations to storage. */ public function writeToStorage() { try { $this->storage->write($this->translations); } catch (BadRequest400Exception $e) { // Empty bulk commit exception. } }
/** * Exports translations from ES to files. * * @param array $domains To export. */ public function export($domains = []) { foreach ($this->readStorage($domains) as $file => $translations) { if (!file_exists($file)) { $this->getFilesystem()->touch($file); } list($domain, $locale, $extension) = explode('.', $file); if ($this->loadersContainer && $this->loadersContainer->has($extension)) { $messageCatalogue = $this->loadersContainer->get($extension)->load($file, $locale, $domain); $translations = array_merge($messageCatalogue->all($domain), $translations); } $this->exporter->export($file, $translations); } if (!empty($this->refresh)) { $this->storage->write($this->refresh); $this->refresh = []; } }