This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Translation/Dumper/IniFileDumper.php

46 lines
1006 B
PHP
Raw Normal View History

2011-09-19 16:00:58 +01:00
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Dumper;
use Symfony\Component\Translation\MessageCatalogue;
/**
2013-04-21 14:23:54 +01:00
* IniFileDumper generates an ini formatted string representation of a message catalogue.
2011-09-19 16:00:58 +01:00
*
* @author Stealth35
*/
class IniFileDumper extends FileDumper
{
/**
* {@inheritdoc}
*/
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
2011-09-19 16:00:58 +01:00
{
$output = '';
foreach ($messages->all($domain) as $source => $target) {
$escapeTarget = str_replace('"', '\"', $target);
$output .= $source.'="'.$escapeTarget."\"\n";
}
return $output;
}
/**
* {@inheritdoc}
2011-09-19 16:00:58 +01:00
*/
protected function getExtension()
{
return 'ini';
}
}