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
983 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;
/**
2012-04-28 04:51:32 +01:00
* IniFileDumper generates a 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 format(MessageCatalogue $messages, $domain = 'messages')
{
$output = '';
foreach ($messages->all($domain) as $source => $target) {
$escapeTarget = str_replace('"', '\"', $target);
$output .= $source.'="'.$escapeTarget."\"\n";
}
return $output;
}
/**
* {@inheritDoc}
*/
protected function getExtension()
{
return 'ini';
}
}