/** * {@inheritdoc} */ public function write(Phrase $phrase) { $fields = [$phrase->getCompiledPhrase(), $phrase->getCompiledTranslation()]; if (($contextType = $phrase->getContextType()) && ($contextValue = $phrase->getContextValueAsString())) { $fields[] = $contextType; $fields[] = $contextValue; } fputcsv($this->_fileHandler, $fields, ',', '"'); }
/** * {@inheritdoc} */ public function write(Phrase $phrase) { $fields = [$phrase->getPhrase(), $phrase->getTranslation()]; $encloseQuote = $phrase->getQuote() == Phrase::QUOTE_DOUBLE ? Phrase::QUOTE_DOUBLE : Phrase::QUOTE_SINGLE; $fields[0] = $this->compileString($fields[0], $encloseQuote); $fields[1] = $this->compileString($fields[1], $encloseQuote); if (($contextType = $phrase->getContextType()) && ($contextValue = $phrase->getContextValueAsString())) { $fields[] = $contextType; $fields[] = $contextValue; } fputcsv($this->_fileHandler, $fields, ',', '"'); }
/** * @param \Magento\Setup\Module\I18n\Dictionary\Phrase $phrase * @param array $context * @return string */ protected function buildFilePath($phrase, $context) { $path = $this->getContext()->buildPathToLocaleDirectoryByContext($phrase->getContextType(), $context); return $path . Locale::DEFAULT_SYSTEM_LOCALE . '.' . Csv::FILE_EXTENSION; }
/** * @param \Magento\Setup\Module\I18n\Dictionary\Phrase $phrase * @param array $context * @return string */ protected function buildFilePath($phrase, $context) { $path = $this->getContext()->buildPathToLocaleDirectoryByContext($phrase->getContextType(), $context); return \Magento\Framework\App\Utility\Files::init()->getPathToSource() . '/' . $path . \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE . '.' . \Magento\Setup\Module\I18n\Pack\Writer\File\Csv::FILE_EXTENSION; }