You are here

public function TranslationWriter::writeTranslations in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/translation/Writer/TranslationWriter.php \Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations()

Writes translation from the catalogue according to the selected format.

Parameters

MessageCatalogue $catalogue The message catalogue to dump:

string $format The format to use to dump the messages:

array $options Options that are passed to the dumper:

Throws

\InvalidArgumentException

File

vendor/symfony/translation/Writer/TranslationWriter.php, line 71

Class

TranslationWriter
TranslationWriter writes translation messages.

Namespace

Symfony\Component\Translation\Writer

Code

public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) {
  if (!isset($this->dumpers[$format])) {
    throw new \InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format));
  }

  // get the right dumper
  $dumper = $this->dumpers[$format];
  if (isset($options['path']) && !is_dir($options['path'])) {
    mkdir($options['path'], 0777, true);
  }

  // save
  $dumper
    ->dump($catalogue, $options);
}