You are here

public function TranslationWriter::writeTranslations in Plug 7

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

lib/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);
}