update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
4
pfosten/vendor/symfony/translation/Dumper/CsvFileDumper.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/Dumper/CsvFileDumper.php
vendored
Executable file → Normal file
|
|
@ -44,8 +44,8 @@ class CsvFileDumper extends FileDumper
|
|||
/**
|
||||
* Sets the delimiter and escape character for CSV.
|
||||
*
|
||||
* @param string $delimiter delimiter character
|
||||
* @param string $enclosure enclosure character
|
||||
* @param string $delimiter Delimiter character
|
||||
* @param string $enclosure Enclosure character
|
||||
*/
|
||||
public function setCsvControl($delimiter = ';', $enclosure = '"')
|
||||
{
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Dumper/DumperInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Dumper/DumperInterface.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/translation/Dumper/FileDumper.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/translation/Dumper/FileDumper.php
vendored
Executable file → Normal file
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\RuntimeException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s).
|
||||
|
|
@ -75,11 +75,11 @@ abstract class FileDumper implements DumperInterface
|
|||
$fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale());
|
||||
if (file_exists($fullpath)) {
|
||||
if ($this->backup) {
|
||||
@trigger_error('Creating a backup while dumping a message catalogue is deprecated since version 3.1 and will be removed in 4.0. Use TranslationWriter::disableBackup() to disable the backup.', E_USER_DEPRECATED);
|
||||
@trigger_error('Creating a backup while dumping a message catalogue is deprecated since Symfony 3.1 and will be removed in 4.0. Use TranslationWriter::disableBackup() to disable the backup.', E_USER_DEPRECATED);
|
||||
copy($fullpath, $fullpath.'~');
|
||||
}
|
||||
} else {
|
||||
$directory = dirname($fullpath);
|
||||
$directory = \dirname($fullpath);
|
||||
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
|
||||
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
|
||||
}
|
||||
|
|
|
|||
20
pfosten/vendor/symfony/translation/Dumper/IcuResFileDumper.php
vendored
Executable file → Normal file
20
pfosten/vendor/symfony/translation/Dumper/IcuResFileDumper.php
vendored
Executable file → Normal file
|
|
@ -33,7 +33,7 @@ class IcuResFileDumper extends FileDumper
|
|||
$data = $indexes = $resources = '';
|
||||
|
||||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$indexes .= pack('v', strlen($data) + 28);
|
||||
$indexes .= pack('v', \strlen($data) + 28);
|
||||
$data .= $source."\0";
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class IcuResFileDumper extends FileDumper
|
|||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$resources .= pack('V', $this->getPosition($data));
|
||||
|
||||
$data .= pack('V', strlen($target))
|
||||
$data .= pack('V', \strlen($target))
|
||||
.mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8')
|
||||
.$this->writePadding($data)
|
||||
;
|
||||
|
|
@ -52,7 +52,7 @@ class IcuResFileDumper extends FileDumper
|
|||
|
||||
$resOffset = $this->getPosition($data);
|
||||
|
||||
$data .= pack('v', count($messages))
|
||||
$data .= pack('v', \count($messages->all($domain)))
|
||||
.$indexes
|
||||
.$this->writePadding($data)
|
||||
.$resources
|
||||
|
|
@ -63,11 +63,11 @@ class IcuResFileDumper extends FileDumper
|
|||
$root = pack('V7',
|
||||
$resOffset + (2 << 28), // Resource Offset + Resource Type
|
||||
6, // Index length
|
||||
$keyTop, // Index keys top
|
||||
$bundleTop, // Index resources top
|
||||
$bundleTop, // Index bundle top
|
||||
count($messages), // Index max table length
|
||||
0 // Index attributes
|
||||
$keyTop, // Index keys top
|
||||
$bundleTop, // Index resources top
|
||||
$bundleTop, // Index bundle top
|
||||
\count($messages->all($domain)), // Index max table length
|
||||
0 // Index attributes
|
||||
);
|
||||
|
||||
$header = pack('vC2v4C12@32',
|
||||
|
|
@ -84,7 +84,7 @@ class IcuResFileDumper extends FileDumper
|
|||
|
||||
private function writePadding($data)
|
||||
{
|
||||
$padding = strlen($data) % 4;
|
||||
$padding = \strlen($data) % 4;
|
||||
|
||||
if ($padding) {
|
||||
return str_repeat("\xAA", 4 - $padding);
|
||||
|
|
@ -93,7 +93,7 @@ class IcuResFileDumper extends FileDumper
|
|||
|
||||
private function getPosition($data)
|
||||
{
|
||||
return (strlen($data) + 28) / 4;
|
||||
return (\strlen($data) + 28) / 4;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Dumper/IniFileDumper.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Dumper/IniFileDumper.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Dumper/JsonFileDumper.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Dumper/JsonFileDumper.php
vendored
Executable file → Normal file
|
|
@ -28,7 +28,7 @@ class JsonFileDumper extends FileDumper
|
|||
if (isset($options['json_encoding'])) {
|
||||
$flags = $options['json_encoding'];
|
||||
} else {
|
||||
$flags = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
|
||||
$flags = \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
|
||||
}
|
||||
|
||||
return json_encode($messages->all($domain), $flags);
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/translation/Dumper/MoFileDumper.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/Dumper/MoFileDumper.php
vendored
Executable file → Normal file
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Loader\MoFileLoader;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* MoFileDumper generates a gettext formatted string representation of a message catalogue.
|
||||
|
|
@ -47,7 +47,7 @@ class MoFileDumper extends FileDumper
|
|||
'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size),
|
||||
);
|
||||
|
||||
$sourcesSize = strlen($sources);
|
||||
$sourcesSize = \strlen($sources);
|
||||
$sourcesStart = $header['offsetHashes'] + 1;
|
||||
|
||||
foreach ($offsets as $offset) {
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Dumper/PhpFileDumper.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Dumper/PhpFileDumper.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Dumper/PoFileDumper.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Dumper/PoFileDumper.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Dumper/QtFileDumper.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Dumper/QtFileDumper.php
vendored
Executable file → Normal file
26
pfosten/vendor/symfony/translation/Dumper/XliffFileDumper.php
vendored
Executable file → Normal file
26
pfosten/vendor/symfony/translation/Dumper/XliffFileDumper.php
vendored
Executable file → Normal file
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* XliffFileDumper generates xliff files from a message catalogue.
|
||||
|
|
@ -85,7 +85,7 @@ class XliffFileDumper extends FileDumper
|
|||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$translation = $dom->createElement('trans-unit');
|
||||
|
||||
$translation->setAttribute('id', md5($source));
|
||||
$translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._'));
|
||||
$translation->setAttribute('resname', $source);
|
||||
|
||||
$s = $translation->appendChild($dom->createElement('source'));
|
||||
|
|
@ -145,7 +145,24 @@ class XliffFileDumper extends FileDumper
|
|||
|
||||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$translation = $dom->createElement('unit');
|
||||
$translation->setAttribute('id', md5($source));
|
||||
$translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._'));
|
||||
$metadata = $messages->getMetadata($source, $domain);
|
||||
|
||||
// Add notes section
|
||||
if ($this->hasMetadataArrayInfo('notes', $metadata)) {
|
||||
$notesElement = $dom->createElement('notes');
|
||||
foreach ($metadata['notes'] as $note) {
|
||||
$n = $dom->createElement('note');
|
||||
$n->appendChild($dom->createTextNode(isset($note['content']) ? $note['content'] : ''));
|
||||
unset($note['content']);
|
||||
|
||||
foreach ($note as $name => $value) {
|
||||
$n->setAttribute($name, $value);
|
||||
}
|
||||
$notesElement->appendChild($n);
|
||||
}
|
||||
$translation->appendChild($notesElement);
|
||||
}
|
||||
|
||||
$segment = $translation->appendChild($dom->createElement('segment'));
|
||||
|
||||
|
|
@ -156,7 +173,6 @@ class XliffFileDumper extends FileDumper
|
|||
$text = 1 === preg_match('/[&<>]/', $target) ? $dom->createCDATASection($target) : $dom->createTextNode($target);
|
||||
|
||||
$targetElement = $dom->createElement('target');
|
||||
$metadata = $messages->getMetadata($source, $domain);
|
||||
if ($this->hasMetadataArrayInfo('target-attributes', $metadata)) {
|
||||
foreach ($metadata['target-attributes'] as $name => $value) {
|
||||
$targetElement->setAttribute($name, $value);
|
||||
|
|
@ -179,6 +195,6 @@ class XliffFileDumper extends FileDumper
|
|||
*/
|
||||
private function hasMetadataArrayInfo($key, $metadata = null)
|
||||
{
|
||||
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || is_array($metadata[$key]));
|
||||
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
pfosten/vendor/symfony/translation/Dumper/YamlFileDumper.php
vendored
Executable file → Normal file
11
pfosten/vendor/symfony/translation/Dumper/YamlFileDumper.php
vendored
Executable file → Normal file
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Util\ArrayConverter;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
|
||||
/**
|
||||
* YamlFileDumper generates yaml files from a message catalogue.
|
||||
|
|
@ -23,6 +23,13 @@ use Symfony\Component\Translation\Exception\LogicException;
|
|||
*/
|
||||
class YamlFileDumper extends FileDumper
|
||||
{
|
||||
private $extension;
|
||||
|
||||
public function __construct(/**string */$extension = 'yml')
|
||||
{
|
||||
$this->extension = $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -50,6 +57,6 @@ class YamlFileDumper extends FileDumper
|
|||
*/
|
||||
protected function getExtension()
|
||||
{
|
||||
return 'yml';
|
||||
return $this->extension;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue