update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
0
pfosten/vendor/symfony/translation/.gitignore
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/.gitignore
vendored
Executable file → Normal file
15
pfosten/vendor/symfony/translation/CHANGELOG.md
vendored
Executable file → Normal file
15
pfosten/vendor/symfony/translation/CHANGELOG.md
vendored
Executable file → Normal file
|
|
@ -1,6 +1,21 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
||||
* Added `TranslationDumperPass`
|
||||
* Added `TranslationExtractorPass`
|
||||
* Added `TranslatorPass`
|
||||
* Added `TranslationReader` and `TranslationReaderInterface`
|
||||
* Added `<notes>` section to the Xliff 2.0 dumper.
|
||||
* Improved Xliff 2.0 loader to load `<notes>` section.
|
||||
* Added `TranslationWriterInterface`
|
||||
* Deprecated `TranslationWriter::writeTranslations` in favor of `TranslationWriter::write`
|
||||
* added support for adding custom message formatter and decoupling the default one.
|
||||
* Added `PhpExtractor`
|
||||
* Added `PhpStringTokenParser`
|
||||
|
||||
3.2.0
|
||||
-----
|
||||
|
||||
|
|
|
|||
24
pfosten/vendor/symfony/translation/Catalogue/AbstractOperation.php
vendored
Executable file → Normal file
24
pfosten/vendor/symfony/translation/Catalogue/AbstractOperation.php
vendored
Executable file → Normal file
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Catalogue;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
|
||||
/**
|
||||
* Base catalogues binary operation class.
|
||||
|
|
@ -26,19 +26,8 @@ use Symfony\Component\Translation\Exception\LogicException;
|
|||
*/
|
||||
abstract class AbstractOperation implements OperationInterface
|
||||
{
|
||||
/**
|
||||
* @var MessageCatalogueInterface The source catalogue
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* @var MessageCatalogueInterface The target catalogue
|
||||
*/
|
||||
protected $target;
|
||||
|
||||
/**
|
||||
* @var MessageCatalogue The result catalogue
|
||||
*/
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
|
|
@ -71,9 +60,6 @@ abstract class AbstractOperation implements OperationInterface
|
|||
protected $messages;
|
||||
|
||||
/**
|
||||
* @param MessageCatalogueInterface $source The source catalogue
|
||||
* @param MessageCatalogueInterface $target The target catalogue
|
||||
*
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function __construct(MessageCatalogueInterface $source, MessageCatalogueInterface $target)
|
||||
|
|
@ -105,7 +91,7 @@ abstract class AbstractOperation implements OperationInterface
|
|||
*/
|
||||
public function getMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +107,7 @@ abstract class AbstractOperation implements OperationInterface
|
|||
*/
|
||||
public function getNewMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +123,7 @@ abstract class AbstractOperation implements OperationInterface
|
|||
*/
|
||||
public function getObsoleteMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Catalogue/MergeOperation.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Catalogue/MergeOperation.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Catalogue/OperationInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Catalogue/OperationInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Catalogue/TargetOperation.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Catalogue/TargetOperation.php
vendored
Executable file → Normal file
18
pfosten/vendor/symfony/translation/Command/XliffLintCommand.php
vendored
Executable file → Normal file
18
pfosten/vendor/symfony/translation/Command/XliffLintCommand.php
vendored
Executable file → Normal file
|
|
@ -12,6 +12,7 @@
|
|||
namespace Symfony\Component\Translation\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
|
@ -26,6 +27,8 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
|||
*/
|
||||
class XliffLintCommand extends Command
|
||||
{
|
||||
protected static $defaultName = 'lint:xliff';
|
||||
|
||||
private $format;
|
||||
private $displayCorrectFiles;
|
||||
private $directoryIteratorProvider;
|
||||
|
|
@ -45,7 +48,6 @@ class XliffLintCommand extends Command
|
|||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('lint:xliff')
|
||||
->setDescription('Lints a XLIFF file and outputs encountered errors')
|
||||
->addArgument('filename', null, 'A file or a directory or STDIN')
|
||||
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
|
||||
|
|
@ -80,14 +82,14 @@ EOF
|
|||
|
||||
if (!$filename) {
|
||||
if (!$stdin = $this->getStdin()) {
|
||||
throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.');
|
||||
throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
|
||||
}
|
||||
|
||||
return $this->display($io, array($this->validate($stdin)));
|
||||
}
|
||||
|
||||
if (!$this->isReadable($filename)) {
|
||||
throw new \RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
|
||||
throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
|
||||
}
|
||||
|
||||
$filesInfo = array();
|
||||
|
|
@ -135,13 +137,13 @@ EOF
|
|||
case 'json':
|
||||
return $this->displayJson($io, $files);
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
|
||||
throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
|
||||
}
|
||||
}
|
||||
|
||||
private function displayTxt(SymfonyStyle $io, array $filesInfo)
|
||||
{
|
||||
$countFiles = count($filesInfo);
|
||||
$countFiles = \count($filesInfo);
|
||||
$erroredFiles = 0;
|
||||
|
||||
foreach ($filesInfo as $info) {
|
||||
|
|
@ -191,7 +193,7 @@ EOF
|
|||
}
|
||||
|
||||
foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
|
||||
if (!in_array($file->getExtension(), array('xlf', 'xliff'))) {
|
||||
if (!\in_array($file->getExtension(), array('xlf', 'xliff'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +225,7 @@ EOF
|
|||
};
|
||||
|
||||
if (null !== $this->directoryIteratorProvider) {
|
||||
return call_user_func($this->directoryIteratorProvider, $directory, $default);
|
||||
return \call_user_func($this->directoryIteratorProvider, $directory, $default);
|
||||
}
|
||||
|
||||
return $default($directory);
|
||||
|
|
@ -236,7 +238,7 @@ EOF
|
|||
};
|
||||
|
||||
if (null !== $this->isReadableProvider) {
|
||||
return call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
|
||||
return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
|
||||
}
|
||||
|
||||
return $default($fileOrDirectory);
|
||||
|
|
|
|||
29
pfosten/vendor/symfony/translation/DataCollector/TranslationDataCollector.php
vendored
Executable file → Normal file
29
pfosten/vendor/symfony/translation/DataCollector/TranslationDataCollector.php
vendored
Executable file → Normal file
|
|
@ -22,14 +22,8 @@ use Symfony\Component\Translation\DataCollectorTranslator;
|
|||
*/
|
||||
class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
/**
|
||||
* @var DataCollectorTranslator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @param DataCollectorTranslator $translator
|
||||
*/
|
||||
public function __construct(DataCollectorTranslator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
|
|
@ -45,6 +39,9 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
|||
$this->data = $this->computeCount($messages);
|
||||
$this->data['messages'] = $messages;
|
||||
|
||||
$this->data['locale'] = $this->translator->getLocale();
|
||||
$this->data['fallback_locales'] = $this->translator->getFallbackLocales();
|
||||
|
||||
$this->data = $this->cloneVar($this->data);
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +52,14 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->data = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -87,6 +92,16 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
|||
return isset($this->data[DataCollectorTranslator::MESSAGE_DEFINED]) ? $this->data[DataCollectorTranslator::MESSAGE_DEFINED] : 0;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return !empty($this->data['locale']) ? $this->data['locale'] : null;
|
||||
}
|
||||
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -143,7 +158,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
|||
if (mb_strlen($string, $encoding) > $length) {
|
||||
return mb_substr($string, 0, $length - 3, $encoding).'...';
|
||||
}
|
||||
} elseif (strlen($string) > $length) {
|
||||
} elseif (\strlen($string) > $length) {
|
||||
return substr($string, 0, $length - 3).'...';
|
||||
}
|
||||
|
||||
|
|
|
|||
9
pfosten/vendor/symfony/translation/DataCollectorTranslator.php
vendored
Executable file → Normal file
9
pfosten/vendor/symfony/translation/DataCollectorTranslator.php
vendored
Executable file → Normal file
|
|
@ -27,9 +27,6 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
|||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $messages = array();
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +35,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
|||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
if (!$translator instanceof TranslatorBagInterface) {
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator)));
|
||||
}
|
||||
|
||||
$this->translator = $translator;
|
||||
|
|
@ -97,7 +94,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
|||
*/
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
if ($this->translator instanceof Translator) {
|
||||
if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
|
||||
return $this->translator->getFallbackLocales();
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +106,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
|||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
return call_user_func_array(array($this->translator, $method), $args);
|
||||
return \call_user_func_array(array($this->translator, $method), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Exception/ExceptionInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/ExceptionInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/InvalidArgumentException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/InvalidArgumentException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/InvalidResourceException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/InvalidResourceException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/LogicException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/LogicException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/NotFoundResourceException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/NotFoundResourceException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/RuntimeException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Exception/RuntimeException.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/translation/Extractor/AbstractFileExtractor.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/translation/Extractor/AbstractFileExtractor.php
vendored
Executable file → Normal file
|
|
@ -21,13 +21,13 @@ use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
|||
abstract class AbstractFileExtractor
|
||||
{
|
||||
/**
|
||||
* @param string|array $resource files, a file or a directory
|
||||
* @param string|array $resource Files, a file or a directory
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function extractFiles($resource)
|
||||
{
|
||||
if (is_array($resource) || $resource instanceof \Traversable) {
|
||||
if (\is_array($resource) || $resource instanceof \Traversable) {
|
||||
$files = array();
|
||||
foreach ($resource as $file) {
|
||||
if ($this->canBeExtracted($file)) {
|
||||
|
|
@ -77,7 +77,7 @@ abstract class AbstractFileExtractor
|
|||
abstract protected function canBeExtracted($file);
|
||||
|
||||
/**
|
||||
* @param string|array $resource files, a file or a directory
|
||||
* @param string|array $resource Files, a file or a directory
|
||||
*
|
||||
* @return array files to be extracted
|
||||
*/
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Extractor/ChainExtractor.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Extractor/ChainExtractor.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Extractor/ExtractorInterface.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Extractor/ExtractorInterface.php
vendored
Executable file → Normal file
|
|
@ -24,7 +24,7 @@ interface ExtractorInterface
|
|||
/**
|
||||
* Extracts translation messages from files, a file or a directory to the catalogue.
|
||||
*
|
||||
* @param string|array $resource files, a file or a directory
|
||||
* @param string|array $resource Files, a file or a directory
|
||||
* @param MessageCatalogue $catalogue The catalogue
|
||||
*/
|
||||
public function extract($resource, MessageCatalogue $catalogue);
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/IdentityTranslator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/IdentityTranslator.php
vendored
Executable file → Normal file
|
|
@ -22,8 +22,6 @@ class IdentityTranslator implements TranslatorInterface
|
|||
private $locale;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param MessageSelector|null $selector The message selector for pluralization
|
||||
*/
|
||||
public function __construct(MessageSelector $selector = null)
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Interval.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Interval.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/LICENSE
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/LICENSE
vendored
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2017 Fabien Potencier
|
||||
Copyright (c) 2004-2018 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Loader/ArrayLoader.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Loader/ArrayLoader.php
vendored
Executable file → Normal file
|
|
@ -52,7 +52,7 @@ class ArrayLoader implements LoaderInterface
|
|||
$subnode = &$messages;
|
||||
}
|
||||
foreach ($subnode as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
$nodePath = $path ? $path.'.'.$key : $key;
|
||||
$this->flatten($messages, $value, $nodePath);
|
||||
if (null === $path) {
|
||||
|
|
|
|||
8
pfosten/vendor/symfony/translation/Loader/CsvFileLoader.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/translation/Loader/CsvFileLoader.php
vendored
Executable file → Normal file
|
|
@ -41,7 +41,7 @@ class CsvFileLoader extends FileLoader
|
|||
$file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
|
||||
|
||||
foreach ($file as $data) {
|
||||
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === count($data)) {
|
||||
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) {
|
||||
$messages[$data[0]] = $data[1];
|
||||
}
|
||||
}
|
||||
|
|
@ -52,9 +52,9 @@ class CsvFileLoader extends FileLoader
|
|||
/**
|
||||
* Sets the delimiter, enclosure, and escape character for CSV.
|
||||
*
|
||||
* @param string $delimiter delimiter character
|
||||
* @param string $enclosure enclosure character
|
||||
* @param string $escape escape character
|
||||
* @param string $delimiter Delimiter character
|
||||
* @param string $enclosure Enclosure character
|
||||
* @param string $escape Escape character
|
||||
*/
|
||||
public function setCsvControl($delimiter = ';', $enclosure = '"', $escape = '\\')
|
||||
{
|
||||
|
|
|
|||
8
pfosten/vendor/symfony/translation/Loader/FileLoader.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/translation/Loader/FileLoader.php
vendored
Executable file → Normal file
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
|
|
@ -41,7 +41,7 @@ abstract class FileLoader extends ArrayLoader
|
|||
}
|
||||
|
||||
// not an array
|
||||
if (!is_array($messages)) {
|
||||
if (!\is_array($messages)) {
|
||||
throw new InvalidResourceException(sprintf('Unable to load file "%s".', $resource));
|
||||
}
|
||||
|
||||
|
|
@ -54,12 +54,12 @@ abstract class FileLoader extends ArrayLoader
|
|||
return $catalogue;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* @param string $resource
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws InvalidResourceException If stream content has an invalid format.
|
||||
* @throws InvalidResourceException if stream content has an invalid format
|
||||
*/
|
||||
abstract protected function loadResource($resource);
|
||||
}
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/translation/Loader/IcuDatFileLoader.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/Loader/IcuDatFileLoader.php
vendored
Executable file → Normal file
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* IcuResFileLoader loads translations from a resource bundle.
|
||||
|
|
|
|||
10
pfosten/vendor/symfony/translation/Loader/IcuResFileLoader.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/translation/Loader/IcuResFileLoader.php
vendored
Executable file → Normal file
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* IcuResFileLoader loads translations from a resource bundle.
|
||||
|
|
@ -70,9 +70,9 @@ class IcuResFileLoader implements LoaderInterface
|
|||
*
|
||||
* This function takes an array by reference and will modify it
|
||||
*
|
||||
* @param \ResourceBundle $rb the ResourceBundle that will be flattened
|
||||
* @param array $messages used internally for recursive calls
|
||||
* @param string $path current path being parsed, used internally for recursive calls
|
||||
* @param \ResourceBundle $rb The ResourceBundle that will be flattened
|
||||
* @param array $messages Used internally for recursive calls
|
||||
* @param string $path Current path being parsed, used internally for recursive calls
|
||||
*
|
||||
* @return array the flattened ResourceBundle
|
||||
*/
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Loader/IniFileLoader.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/IniFileLoader.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/JsonFileLoader.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/JsonFileLoader.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Loader/LoaderInterface.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Loader/LoaderInterface.php
vendored
Executable file → Normal file
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* LoaderInterface is the interface implemented by all translation loaders.
|
||||
|
|
|
|||
16
pfosten/vendor/symfony/translation/Loader/MoFileLoader.php
vendored
Executable file → Normal file
16
pfosten/vendor/symfony/translation/Loader/MoFileLoader.php
vendored
Executable file → Normal file
|
|
@ -21,23 +21,17 @@ class MoFileLoader extends FileLoader
|
|||
/**
|
||||
* Magic used for validating the format of a MO file as well as
|
||||
* detecting if the machine used to create that file was little endian.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
const MO_LITTLE_ENDIAN_MAGIC = 0x950412de;
|
||||
|
||||
/**
|
||||
* Magic used for validating the format of a MO file as well as
|
||||
* detecting if the machine used to create that file was big endian.
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
const MO_BIG_ENDIAN_MAGIC = 0xde120495;
|
||||
|
||||
/**
|
||||
* The size of the header of a MO file in bytes.
|
||||
*
|
||||
* @var int Number of bytes
|
||||
*/
|
||||
const MO_HEADER_SIZE = 28;
|
||||
|
||||
|
|
@ -59,9 +53,9 @@ class MoFileLoader extends FileLoader
|
|||
$magic = unpack('V1', fread($stream, 4));
|
||||
$magic = hexdec(substr(dechex(current($magic)), -8));
|
||||
|
||||
if ($magic == self::MO_LITTLE_ENDIAN_MAGIC) {
|
||||
if (self::MO_LITTLE_ENDIAN_MAGIC == $magic) {
|
||||
$isBigEndian = false;
|
||||
} elseif ($magic == self::MO_BIG_ENDIAN_MAGIC) {
|
||||
} elseif (self::MO_BIG_ENDIAN_MAGIC == $magic) {
|
||||
$isBigEndian = true;
|
||||
} else {
|
||||
throw new InvalidResourceException('MO stream content has an invalid format.');
|
||||
|
|
@ -95,7 +89,7 @@ class MoFileLoader extends FileLoader
|
|||
fseek($stream, $offset);
|
||||
$singularId = fread($stream, $length);
|
||||
|
||||
if (strpos($singularId, "\000") !== false) {
|
||||
if (false !== strpos($singularId, "\000")) {
|
||||
list($singularId, $pluralId) = explode("\000", $singularId);
|
||||
}
|
||||
|
||||
|
|
@ -110,14 +104,14 @@ class MoFileLoader extends FileLoader
|
|||
fseek($stream, $offset);
|
||||
$translated = fread($stream, $length);
|
||||
|
||||
if (strpos($translated, "\000") !== false) {
|
||||
if (false !== strpos($translated, "\000")) {
|
||||
$translated = explode("\000", $translated);
|
||||
}
|
||||
|
||||
$ids = array('singular' => $singularId, 'plural' => $pluralId);
|
||||
$item = compact('ids', 'translated');
|
||||
|
||||
if (is_array($item['translated'])) {
|
||||
if (\is_array($item['translated'])) {
|
||||
$messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]);
|
||||
if (isset($item['ids']['plural'])) {
|
||||
$plurals = array();
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Loader/PhpFileLoader.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/PhpFileLoader.php
vendored
Executable file → Normal file
25
pfosten/vendor/symfony/translation/Loader/PoFileLoader.php
vendored
Executable file → Normal file
25
pfosten/vendor/symfony/translation/Loader/PoFileLoader.php
vendored
Executable file → Normal file
|
|
@ -76,41 +76,41 @@ class PoFileLoader extends FileLoader
|
|||
while ($line = fgets($stream)) {
|
||||
$line = trim($line);
|
||||
|
||||
if ($line === '') {
|
||||
if ('' === $line) {
|
||||
// Whitespace indicated current item is done
|
||||
if (!in_array('fuzzy', $flags)) {
|
||||
if (!\in_array('fuzzy', $flags)) {
|
||||
$this->addMessage($messages, $item);
|
||||
}
|
||||
$item = $defaults;
|
||||
$flags = array();
|
||||
} elseif (substr($line, 0, 2) === '#,') {
|
||||
} elseif ('#,' === substr($line, 0, 2)) {
|
||||
$flags = array_map('trim', explode(',', substr($line, 2)));
|
||||
} elseif (substr($line, 0, 7) === 'msgid "') {
|
||||
} elseif ('msgid "' === substr($line, 0, 7)) {
|
||||
// We start a new msg so save previous
|
||||
// TODO: this fails when comments or contexts are added
|
||||
$this->addMessage($messages, $item);
|
||||
$item = $defaults;
|
||||
$item['ids']['singular'] = substr($line, 7, -1);
|
||||
} elseif (substr($line, 0, 8) === 'msgstr "') {
|
||||
} elseif ('msgstr "' === substr($line, 0, 8)) {
|
||||
$item['translated'] = substr($line, 8, -1);
|
||||
} elseif ($line[0] === '"') {
|
||||
} elseif ('"' === $line[0]) {
|
||||
$continues = isset($item['translated']) ? 'translated' : 'ids';
|
||||
|
||||
if (is_array($item[$continues])) {
|
||||
if (\is_array($item[$continues])) {
|
||||
end($item[$continues]);
|
||||
$item[$continues][key($item[$continues])] .= substr($line, 1, -1);
|
||||
} else {
|
||||
$item[$continues] .= substr($line, 1, -1);
|
||||
}
|
||||
} elseif (substr($line, 0, 14) === 'msgid_plural "') {
|
||||
} elseif ('msgid_plural "' === substr($line, 0, 14)) {
|
||||
$item['ids']['plural'] = substr($line, 14, -1);
|
||||
} elseif (substr($line, 0, 7) === 'msgstr[') {
|
||||
} elseif ('msgstr[' === substr($line, 0, 7)) {
|
||||
$size = strpos($line, ']');
|
||||
$item['translated'][(int) substr($line, 7, 1)] = substr($line, $size + 3, -1);
|
||||
}
|
||||
}
|
||||
// save last item
|
||||
if (!in_array('fuzzy', $flags)) {
|
||||
if (!\in_array('fuzzy', $flags)) {
|
||||
$this->addMessage($messages, $item);
|
||||
}
|
||||
fclose($stream);
|
||||
|
|
@ -123,13 +123,10 @@ class PoFileLoader extends FileLoader
|
|||
*
|
||||
* A .po file could contain by error missing plural indexes. We need to
|
||||
* fix these before saving them.
|
||||
*
|
||||
* @param array $messages
|
||||
* @param array $item
|
||||
*/
|
||||
private function addMessage(array &$messages, array $item)
|
||||
{
|
||||
if (is_array($item['translated'])) {
|
||||
if (\is_array($item['translated'])) {
|
||||
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]);
|
||||
if (isset($item['ids']['plural'])) {
|
||||
$plurals = $item['translated'];
|
||||
|
|
|
|||
6
pfosten/vendor/symfony/translation/Loader/QtFileLoader.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/translation/Loader/QtFileLoader.php
vendored
Executable file → Normal file
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Config\Util\XmlUtils;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* QtFileLoader loads translations from QT Translations XML files.
|
||||
|
|
@ -50,7 +50,7 @@ class QtFileLoader implements LoaderInterface
|
|||
$nodes = $xpath->evaluate('//TS/context/name[text()="'.$domain.'"]');
|
||||
|
||||
$catalogue = new MessageCatalogue($locale);
|
||||
if ($nodes->length == 1) {
|
||||
if (1 == $nodes->length) {
|
||||
$translations = $nodes->item(0)->nextSibling->parentNode->parentNode->getElementsByTagName('message');
|
||||
foreach ($translations as $translation) {
|
||||
$translationValue = (string) $translation->getElementsByTagName('translation')->item(0)->nodeValue;
|
||||
|
|
|
|||
58
pfosten/vendor/symfony/translation/Loader/XliffFileLoader.php
vendored
Executable file → Normal file
58
pfosten/vendor/symfony/translation/Loader/XliffFileLoader.php
vendored
Executable file → Normal file
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Config\Util\XmlUtils;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* XliffFileLoader loads translations from XLIFF files.
|
||||
|
|
@ -127,24 +127,38 @@ class XliffFileLoader implements LoaderInterface
|
|||
|
||||
$xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0');
|
||||
|
||||
foreach ($xml->xpath('//xliff:unit/xliff:segment') as $segment) {
|
||||
$source = $segment->source;
|
||||
foreach ($xml->xpath('//xliff:unit') as $unit) {
|
||||
foreach ($unit->segment as $segment) {
|
||||
$source = $segment->source;
|
||||
|
||||
// If the xlf file has another encoding specified, try to convert it because
|
||||
// simple_xml will always return utf-8 encoded values
|
||||
$target = $this->utf8ToCharset((string) (isset($segment->target) ? $segment->target : $source), $encoding);
|
||||
// If the xlf file has another encoding specified, try to convert it because
|
||||
// simple_xml will always return utf-8 encoded values
|
||||
$target = $this->utf8ToCharset((string) (isset($segment->target) ? $segment->target : $source), $encoding);
|
||||
|
||||
$catalogue->set((string) $source, $target, $domain);
|
||||
$catalogue->set((string) $source, $target, $domain);
|
||||
|
||||
$metadata = array();
|
||||
if (isset($segment->target) && $segment->target->attributes()) {
|
||||
$metadata['target-attributes'] = array();
|
||||
foreach ($segment->target->attributes() as $key => $value) {
|
||||
$metadata['target-attributes'][$key] = (string) $value;
|
||||
$metadata = array();
|
||||
if (isset($segment->target) && $segment->target->attributes()) {
|
||||
$metadata['target-attributes'] = array();
|
||||
foreach ($segment->target->attributes() as $key => $value) {
|
||||
$metadata['target-attributes'][$key] = (string) $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$catalogue->setMetadata((string) $source, $metadata, $domain);
|
||||
if (isset($unit->notes)) {
|
||||
$metadata['notes'] = array();
|
||||
foreach ($unit->notes->note as $noteNode) {
|
||||
$note = array();
|
||||
foreach ($noteNode->attributes() as $key => $value) {
|
||||
$note[$key] = (string) $value;
|
||||
}
|
||||
$note['content'] = (string) $noteNode;
|
||||
$metadata['notes'][] = $note;
|
||||
}
|
||||
}
|
||||
|
||||
$catalogue->setMetadata((string) $source, $metadata, $domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,16 +235,20 @@ class XliffFileLoader implements LoaderInterface
|
|||
{
|
||||
$newPath = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd';
|
||||
$parts = explode('/', $newPath);
|
||||
$locationstart = 'file:///';
|
||||
if (0 === stripos($newPath, 'phar://')) {
|
||||
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
|
||||
$tmpfile = tempnam(sys_get_temp_dir(), 'symfony');
|
||||
if ($tmpfile) {
|
||||
copy($newPath, $tmpfile);
|
||||
$parts = explode('/', str_replace('\\', '/', $tmpfile));
|
||||
} else {
|
||||
array_shift($parts);
|
||||
$locationstart = 'phar:///';
|
||||
}
|
||||
}
|
||||
|
||||
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$newPath = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||
$drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$newPath = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||
|
||||
return str_replace($xmlUri, $newPath, $schemaSource);
|
||||
}
|
||||
|
|
@ -283,7 +301,7 @@ class XliffFileLoader implements LoaderInterface
|
|||
|
||||
$namespace = $xliff->attributes->getNamedItem('xmlns');
|
||||
if ($namespace) {
|
||||
if (substr_compare('urn:oasis:names:tc:xliff:document:', $namespace->nodeValue, 0, 34) !== 0) {
|
||||
if (0 !== substr_compare('urn:oasis:names:tc:xliff:document:', $namespace->nodeValue, 0, 34)) {
|
||||
throw new InvalidArgumentException(sprintf('Not a valid XLIFF namespace "%s"', $namespace));
|
||||
}
|
||||
|
||||
|
|
|
|||
13
pfosten/vendor/symfony/translation/Loader/YamlFileLoader.php
vendored
Executable file → Normal file
13
pfosten/vendor/symfony/translation/Loader/YamlFileLoader.php
vendored
Executable file → Normal file
|
|
@ -13,9 +13,8 @@ namespace Symfony\Component\Translation\Loader;
|
|||
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Yaml\Parser as YamlParser;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symfony\Component\Yaml\Parser as YamlParser;
|
||||
|
||||
/**
|
||||
* YamlFileLoader loads translations from Yaml files.
|
||||
|
|
@ -39,10 +38,18 @@ class YamlFileLoader extends FileLoader
|
|||
$this->yamlParser = new YamlParser();
|
||||
}
|
||||
|
||||
$prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($resource, &$prevErrorHandler) {
|
||||
$message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$resource.'"$0', $message) : $message;
|
||||
|
||||
return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false;
|
||||
});
|
||||
|
||||
try {
|
||||
$messages = $this->yamlParser->parse(file_get_contents($resource), Yaml::PARSE_KEYS_AS_STRINGS);
|
||||
$messages = $this->yamlParser->parseFile($resource);
|
||||
} catch (ParseException $e) {
|
||||
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
return $messages;
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-1.2-strict.xsd
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-2.0.xsd
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/schema/dic/xliff-core/xliff-core-2.0.xsd
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Loader/schema/dic/xliff-core/xml.xsd
vendored
Executable file → Normal file
9
pfosten/vendor/symfony/translation/LoggingTranslator.php
vendored
Executable file → Normal file
9
pfosten/vendor/symfony/translation/LoggingTranslator.php
vendored
Executable file → Normal file
|
|
@ -24,9 +24,6 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
|||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
|
|
@ -36,7 +33,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
|||
public function __construct(TranslatorInterface $translator, LoggerInterface $logger)
|
||||
{
|
||||
if (!$translator instanceof TranslatorBagInterface) {
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator)));
|
||||
}
|
||||
|
||||
$this->translator = $translator;
|
||||
|
|
@ -96,7 +93,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
|||
*/
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
if ($this->translator instanceof Translator) {
|
||||
if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
|
||||
return $this->translator->getFallbackLocales();
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +105,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
|||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
return call_user_func_array(array($this->translator, $method), $args);
|
||||
return \call_user_func_array(array($this->translator, $method), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/translation/MessageCatalogue.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/MessageCatalogue.php
vendored
Executable file → Normal file
|
|
@ -15,8 +15,6 @@ use Symfony\Component\Config\Resource\ResourceInterface;
|
|||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
|
||||
/**
|
||||
* MessageCatalogue.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterface
|
||||
|
|
@ -29,8 +27,6 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf
|
|||
private $parent;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $locale The locale
|
||||
* @param array $messages An array of messages classified by domain
|
||||
*/
|
||||
|
|
|
|||
10
pfosten/vendor/symfony/translation/MessageCatalogueInterface.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/translation/MessageCatalogueInterface.php
vendored
Executable file → Normal file
|
|
@ -104,20 +104,16 @@ interface MessageCatalogueInterface
|
|||
* Merges translations from the given Catalogue into the current one.
|
||||
*
|
||||
* The two catalogues must have the same locale.
|
||||
*
|
||||
* @param self $catalogue
|
||||
*/
|
||||
public function addCatalogue(MessageCatalogueInterface $catalogue);
|
||||
public function addCatalogue(self $catalogue);
|
||||
|
||||
/**
|
||||
* Merges translations from the given Catalogue into the current one
|
||||
* only when the translation does not exist.
|
||||
*
|
||||
* This is used to provide default translations when they do not exist for the current locale.
|
||||
*
|
||||
* @param self $catalogue
|
||||
*/
|
||||
public function addFallbackCatalogue(MessageCatalogueInterface $catalogue);
|
||||
public function addFallbackCatalogue(self $catalogue);
|
||||
|
||||
/**
|
||||
* Gets the fallback catalogue.
|
||||
|
|
@ -135,8 +131,6 @@ interface MessageCatalogueInterface
|
|||
|
||||
/**
|
||||
* Adds a resource for this collection.
|
||||
*
|
||||
* @param ResourceInterface $resource A resource instance
|
||||
*/
|
||||
public function addResource(ResourceInterface $resource);
|
||||
}
|
||||
|
|
|
|||
12
pfosten/vendor/symfony/translation/MessageSelector.php
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/translation/MessageSelector.php
vendored
Executable file → Normal file
|
|
@ -49,10 +49,16 @@ class MessageSelector
|
|||
*/
|
||||
public function choose($message, $number, $locale)
|
||||
{
|
||||
preg_match_all('/(?:\|\||[^\|])++/', $message, $parts);
|
||||
$parts = array();
|
||||
if (preg_match('/^\|++$/', $message)) {
|
||||
$parts = explode('|', $message);
|
||||
} elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) {
|
||||
$parts = $matches[0];
|
||||
}
|
||||
|
||||
$explicitRules = array();
|
||||
$standardRules = array();
|
||||
foreach ($parts[0] as $part) {
|
||||
foreach ($parts as $part) {
|
||||
$part = trim(str_replace('||', '|', $part));
|
||||
|
||||
if (preg_match('/^(?P<interval>'.Interval::getIntervalRegexp().')\s*(?P<message>.*?)$/xs', $part, $matches)) {
|
||||
|
|
@ -76,7 +82,7 @@ class MessageSelector
|
|||
if (!isset($standardRules[$position])) {
|
||||
// when there's exactly one rule given, and that rule is a standard
|
||||
// rule, use this rule
|
||||
if (1 === count($parts[0]) && isset($standardRules[0])) {
|
||||
if (1 === \count($parts) && isset($standardRules[0])) {
|
||||
return $standardRules[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/MetadataAwareInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/MetadataAwareInterface.php
vendored
Executable file → Normal file
43
pfosten/vendor/symfony/translation/PluralizationRules.php
vendored
Executable file → Normal file
43
pfosten/vendor/symfony/translation/PluralizationRules.php
vendored
Executable file → Normal file
|
|
@ -35,14 +35,14 @@ class PluralizationRules
|
|||
$locale = 'xbr';
|
||||
}
|
||||
|
||||
if (strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
|
||||
if (\strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -\strlen(strrchr($locale, '_')));
|
||||
}
|
||||
|
||||
if (isset(self::$rules[$locale])) {
|
||||
$return = call_user_func(self::$rules[$locale], $number);
|
||||
$return = \call_user_func(self::$rules[$locale], $number);
|
||||
|
||||
if (!is_int($return) || $return < 0) {
|
||||
if (!\is_int($return) || $return < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,6 @@ class PluralizationRules
|
|||
case 'vi':
|
||||
case 'zh':
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 'af':
|
||||
case 'bn':
|
||||
|
|
@ -108,6 +107,7 @@ class PluralizationRules
|
|||
case 'nl':
|
||||
case 'nn':
|
||||
case 'no':
|
||||
case 'oc':
|
||||
case 'om':
|
||||
case 'or':
|
||||
case 'pa':
|
||||
|
|
@ -123,7 +123,7 @@ class PluralizationRules
|
|||
case 'tk':
|
||||
case 'ur':
|
||||
case 'zu':
|
||||
return ($number == 1) ? 0 : 1;
|
||||
return (1 == $number) ? 0 : 1;
|
||||
|
||||
case 'am':
|
||||
case 'bh':
|
||||
|
|
@ -138,49 +138,50 @@ class PluralizationRules
|
|||
case 'xbr':
|
||||
case 'ti':
|
||||
case 'wa':
|
||||
return (($number == 0) || ($number == 1)) ? 0 : 1;
|
||||
return ((0 == $number) || (1 == $number)) ? 0 : 1;
|
||||
|
||||
case 'be':
|
||||
case 'bs':
|
||||
case 'hr':
|
||||
case 'ru':
|
||||
case 'sh':
|
||||
case 'sr':
|
||||
case 'uk':
|
||||
return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
|
||||
return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
|
||||
|
||||
case 'cs':
|
||||
case 'sk':
|
||||
return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2);
|
||||
return (1 == $number) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2);
|
||||
|
||||
case 'ga':
|
||||
return ($number == 1) ? 0 : (($number == 2) ? 1 : 2);
|
||||
return (1 == $number) ? 0 : ((2 == $number) ? 1 : 2);
|
||||
|
||||
case 'lt':
|
||||
return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
|
||||
return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
|
||||
|
||||
case 'sl':
|
||||
return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3));
|
||||
return (1 == $number % 100) ? 0 : ((2 == $number % 100) ? 1 : (((3 == $number % 100) || (4 == $number % 100)) ? 2 : 3));
|
||||
|
||||
case 'mk':
|
||||
return ($number % 10 == 1) ? 0 : 1;
|
||||
return (1 == $number % 10) ? 0 : 1;
|
||||
|
||||
case 'mt':
|
||||
return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3));
|
||||
return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3));
|
||||
|
||||
case 'lv':
|
||||
return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2);
|
||||
return (0 == $number) ? 0 : (((1 == $number % 10) && (11 != $number % 100)) ? 1 : 2);
|
||||
|
||||
case 'pl':
|
||||
return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2);
|
||||
return (1 == $number) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2);
|
||||
|
||||
case 'cy':
|
||||
return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3));
|
||||
return (1 == $number) ? 0 : ((2 == $number) ? 1 : (((8 == $number) || (11 == $number)) ? 2 : 3));
|
||||
|
||||
case 'ro':
|
||||
return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2);
|
||||
return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2);
|
||||
|
||||
case 'ar':
|
||||
return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5))));
|
||||
return (0 == $number) ? 0 : ((1 == $number) ? 1 : ((2 == $number) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5))));
|
||||
|
||||
default:
|
||||
return 0;
|
||||
|
|
@ -200,8 +201,8 @@ class PluralizationRules
|
|||
$locale = 'xbr';
|
||||
}
|
||||
|
||||
if (strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
|
||||
if (\strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -\strlen(strrchr($locale, '_')));
|
||||
}
|
||||
|
||||
self::$rules[$locale] = $rule;
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/README.md
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/README.md
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd
vendored
Executable file → Normal file
|
|
@ -3,16 +3,16 @@
|
|||
<!--
|
||||
|
||||
May-19-2004:
|
||||
- Changed the <choice> for ElemType_header, moving minOccurs="0" maxOccurs="unbounded" from its elements
|
||||
- Changed the <choice> for ElemType_header, moving minOccurs="0" maxOccurs="unbounded" from its elements
|
||||
to <choice> itself.
|
||||
- Added <choice> for ElemType_trans-unit to allow "any order" for <context-group>, <count-group>, <prop-group>, <note>, and
|
||||
<alt-trans>.
|
||||
|
||||
Oct-2005
|
||||
- updated version info to 1.2
|
||||
- equiv-trans attribute to <trans-unit> element
|
||||
- equiv-trans attribute to <trans-unit> element
|
||||
- merged-trans attribute for <group> element
|
||||
- Add the <seg-source> element as optional in the <trans-unit> and <alt-trans> content models, at the same level as <source>
|
||||
- Add the <seg-source> element as optional in the <trans-unit> and <alt-trans> content models, at the same level as <source>
|
||||
- Create a new value "seg" for the mtype attribute of the <mrk> element
|
||||
- Add mid as an optional attribute for the <alt-trans> element
|
||||
|
||||
|
|
@ -2220,4 +2220,4 @@ Jan-10-2006
|
|||
<xsd:anyAttribute namespace="##other" processContents="strict"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
</xsd:schema>
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\DataCollector;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||
use Symfony\Component\Translation\DataCollector\TranslationDataCollector;
|
||||
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||
|
||||
class TranslationDataCollectorTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php
vendored
Executable file → Normal file
|
|
@ -12,9 +12,9 @@
|
|||
namespace Symfony\Component\Translation\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class DataCollectorTranslatorTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\CsvFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class CsvFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\FileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class FileDumperTest extends TestCase
|
||||
{
|
||||
|
|
@ -28,6 +28,8 @@ class FileDumperTest extends TestCase
|
|||
$dumper->dump($catalogue, array('path' => $tempDir));
|
||||
|
||||
$this->assertFileExists($tempDir.'/messages.en.concrete');
|
||||
|
||||
@unlink($tempDir.'/messages.en.concrete');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\IcuResFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class IcuResFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\IniFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class IniFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\JsonFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class JsonFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\MoFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class MoFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\PhpFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class PhpFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\PoFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class PoFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\QtFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class QtFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
27
pfosten/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php
vendored
Executable file → Normal file
27
pfosten/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\XliffFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class XliffFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
@ -87,4 +87,29 @@ class XliffFileDumperTest extends TestCase
|
|||
$dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR'))
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormatCatalogueWithNotesMetadata()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en_US');
|
||||
$catalogue->add(array(
|
||||
'foo' => 'bar',
|
||||
'baz' => 'biz',
|
||||
));
|
||||
$catalogue->setMetadata('foo', array('notes' => array(
|
||||
array('category' => 'state', 'content' => 'new'),
|
||||
array('category' => 'approved', 'content' => 'true'),
|
||||
array('category' => 'section', 'content' => 'user login', 'priority' => '1'),
|
||||
)));
|
||||
$catalogue->setMetadata('baz', array('notes' => array(
|
||||
array('id' => 'x', 'content' => 'x_content'),
|
||||
array('appliesTo' => 'target', 'category' => 'quality', 'content' => 'Fuzzy'),
|
||||
)));
|
||||
|
||||
$dumper = new XliffFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(
|
||||
__DIR__.'/../fixtures/resources-notes-meta.xlf',
|
||||
$dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR', 'xliff_version' => '2.0'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\YamlFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class YamlFileDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Tests/IdentityTranslatorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/IdentityTranslatorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/IntervalTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/IntervalTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\CsvFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\CsvFileLoader;
|
||||
|
||||
class CsvFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use Symfony\Component\Translation\Loader\IcuDatFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\IcuDatFileLoader;
|
||||
|
||||
/**
|
||||
* @requires extension intl
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use Symfony\Component\Translation\Loader\IcuResFileLoader;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
use Symfony\Component\Translation\Loader\IcuResFileLoader;
|
||||
|
||||
/**
|
||||
* @requires extension intl
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\IniFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\IniFileLoader;
|
||||
|
||||
class IniFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\JsonFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\JsonFileLoader;
|
||||
|
||||
class JsonFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php
vendored
Executable file → Normal file
|
|
@ -17,7 +17,7 @@ abstract class LocalizedTestCase extends TestCase
|
|||
{
|
||||
protected function setUp()
|
||||
{
|
||||
if (!extension_loaded('intl')) {
|
||||
if (!\extension_loaded('intl')) {
|
||||
$this->markTestSkipped('Extension intl is required.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\MoFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\MoFileLoader;
|
||||
|
||||
class MoFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\PhpFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\PhpFileLoader;
|
||||
|
||||
class PhpFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\PoFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\PoFileLoader;
|
||||
|
||||
class PoFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\QtFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\QtFileLoader;
|
||||
|
||||
class QtFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
71
pfosten/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php
vendored
Executable file → Normal file
71
pfosten/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\XliffFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\XliffFileLoader;
|
||||
|
||||
class XliffFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
@ -188,4 +188,73 @@ class XliffFileLoaderTest extends TestCase
|
|||
// target attributes
|
||||
$this->assertEquals(array('target-attributes' => array('order' => 1)), $catalogue->getMetadata('bar', 'domain1'));
|
||||
}
|
||||
|
||||
public function testLoadVersion2WithNoteMeta()
|
||||
{
|
||||
$loader = new XliffFileLoader();
|
||||
$resource = __DIR__.'/../fixtures/resources-notes-meta.xlf';
|
||||
$catalogue = $loader->load($resource, 'en', 'domain1');
|
||||
|
||||
$this->assertEquals('en', $catalogue->getLocale());
|
||||
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
|
||||
$this->assertSame(array(), libxml_get_errors());
|
||||
|
||||
// test for "foo" metadata
|
||||
$this->assertTrue($catalogue->defines('foo', 'domain1'));
|
||||
$metadata = $catalogue->getMetadata('foo', 'domain1');
|
||||
$this->assertNotEmpty($metadata);
|
||||
$this->assertCount(3, $metadata['notes']);
|
||||
|
||||
$this->assertEquals('state', $metadata['notes'][0]['category']);
|
||||
$this->assertEquals('new', $metadata['notes'][0]['content']);
|
||||
|
||||
$this->assertEquals('approved', $metadata['notes'][1]['category']);
|
||||
$this->assertEquals('true', $metadata['notes'][1]['content']);
|
||||
|
||||
$this->assertEquals('section', $metadata['notes'][2]['category']);
|
||||
$this->assertEquals('1', $metadata['notes'][2]['priority']);
|
||||
$this->assertEquals('user login', $metadata['notes'][2]['content']);
|
||||
|
||||
// test for "baz" metadata
|
||||
$this->assertTrue($catalogue->defines('baz', 'domain1'));
|
||||
$metadata = $catalogue->getMetadata('baz', 'domain1');
|
||||
$this->assertNotEmpty($metadata);
|
||||
$this->assertCount(2, $metadata['notes']);
|
||||
|
||||
$this->assertEquals('x', $metadata['notes'][0]['id']);
|
||||
$this->assertEquals('x_content', $metadata['notes'][0]['content']);
|
||||
|
||||
$this->assertEquals('target', $metadata['notes'][1]['appliesTo']);
|
||||
$this->assertEquals('quality', $metadata['notes'][1]['category']);
|
||||
$this->assertEquals('Fuzzy', $metadata['notes'][1]['content']);
|
||||
}
|
||||
|
||||
public function testLoadVersion2WithMultiSegmentUnit()
|
||||
{
|
||||
$loader = new XliffFileLoader();
|
||||
$resource = __DIR__.'/../fixtures/resources-2.0-multi-segment-unit.xlf';
|
||||
$catalog = $loader->load($resource, 'en', 'domain1');
|
||||
|
||||
$this->assertSame('en', $catalog->getLocale());
|
||||
$this->assertEquals(array(new FileResource($resource)), $catalog->getResources());
|
||||
$this->assertFalse(libxml_get_last_error());
|
||||
|
||||
// test for "foo" metadata
|
||||
$this->assertTrue($catalog->defines('foo', 'domain1'));
|
||||
$metadata = $catalog->getMetadata('foo', 'domain1');
|
||||
$this->assertNotEmpty($metadata);
|
||||
$this->assertCount(1, $metadata['notes']);
|
||||
|
||||
$this->assertSame('processed', $metadata['notes'][0]['category']);
|
||||
$this->assertSame('true', $metadata['notes'][0]['content']);
|
||||
|
||||
// test for "bar" metadata
|
||||
$this->assertTrue($catalog->defines('bar', 'domain1'));
|
||||
$metadata = $catalog->getMetadata('bar', 'domain1');
|
||||
$this->assertNotEmpty($metadata);
|
||||
$this->assertCount(1, $metadata['notes']);
|
||||
|
||||
$this->assertSame('processed', $metadata['notes'][0]['category']);
|
||||
$this->assertSame('true', $metadata['notes'][0]['content']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php
vendored
Executable file → Normal file
|
|
@ -12,8 +12,8 @@
|
|||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\YamlFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\YamlFileLoader;
|
||||
|
||||
class YamlFileLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/translation/Tests/LoggingTranslatorTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/Tests/LoggingTranslatorTest.php
vendored
Executable file → Normal file
|
|
@ -12,9 +12,9 @@
|
|||
namespace Symfony\Component\Translation\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\LoggingTranslator;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\LoggingTranslator;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class LoggingTranslatorTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Tests/MessageCatalogueTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/MessageCatalogueTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/Tests/MessageSelectorTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/translation/Tests/MessageSelectorTest.php
vendored
Executable file → Normal file
|
|
@ -128,6 +128,10 @@ class MessageSelectorTest extends TestCase
|
|||
array("This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1),
|
||||
// esacape pipe
|
||||
array('This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0),
|
||||
// Empty plural set (2 plural forms) from a .PO file
|
||||
array('', '|', 1),
|
||||
// Empty plural set (3 plural forms) from a .PO file
|
||||
array('', '||', 1),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
pfosten/vendor/symfony/translation/Tests/PluralizationRulesTest.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/translation/Tests/PluralizationRulesTest.php
vendored
Executable file → Normal file
|
|
@ -91,8 +91,8 @@ class PluralizationRulesTest extends TestCase
|
|||
/**
|
||||
* We validate only on the plural coverage. Thus the real rules is not tested.
|
||||
*
|
||||
* @param string $nplural plural expected
|
||||
* @param array $matrix containing langcodes and their plural index values
|
||||
* @param string $nplural Plural expected
|
||||
* @param array $matrix Containing langcodes and their plural index values
|
||||
* @param bool $expectSuccess
|
||||
*/
|
||||
protected function validateMatrix($nplural, $matrix, $expectSuccess = true)
|
||||
|
|
@ -100,9 +100,9 @@ class PluralizationRulesTest extends TestCase
|
|||
foreach ($matrix as $langCode => $data) {
|
||||
$indexes = array_flip($data);
|
||||
if ($expectSuccess) {
|
||||
$this->assertEquals($nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
$this->assertEquals($nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
} else {
|
||||
$this->assertNotEquals((int) $nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
$this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/translation/Tests/TranslatorCacheTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/translation/Tests/TranslatorCacheTest.php
vendored
Executable file → Normal file
|
|
@ -15,8 +15,8 @@ use PHPUnit\Framework\TestCase;
|
|||
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\Loader\LoaderInterface;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class TranslatorCacheTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
37
pfosten/vendor/symfony/translation/Tests/TranslatorTest.php
vendored
Executable file → Normal file
37
pfosten/vendor/symfony/translation/Tests/TranslatorTest.php
vendored
Executable file → Normal file
|
|
@ -12,10 +12,9 @@
|
|||
namespace Symfony\Component\Translation\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\MessageSelector;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class TranslatorTest extends TestCase
|
||||
{
|
||||
|
|
@ -25,7 +24,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testConstructorInvalidLocale($locale)
|
||||
{
|
||||
$translator = new Translator($locale, new MessageSelector());
|
||||
new Translator($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -33,14 +32,14 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testConstructorValidLocale($locale)
|
||||
{
|
||||
$translator = new Translator($locale, new MessageSelector());
|
||||
$translator = new Translator($locale);
|
||||
|
||||
$this->assertEquals($locale, $translator->getLocale());
|
||||
}
|
||||
|
||||
public function testConstructorWithoutLocale()
|
||||
{
|
||||
$translator = new Translator(null, new MessageSelector());
|
||||
$translator = new Translator(null);
|
||||
|
||||
$this->assertNull($translator->getLocale());
|
||||
}
|
||||
|
|
@ -61,7 +60,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testSetInvalidLocale($locale)
|
||||
{
|
||||
$translator = new Translator('fr', new MessageSelector());
|
||||
$translator = new Translator('fr');
|
||||
$translator->setLocale($locale);
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +69,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testSetValidLocale($locale)
|
||||
{
|
||||
$translator = new Translator($locale, new MessageSelector());
|
||||
$translator = new Translator($locale);
|
||||
$translator->setLocale($locale);
|
||||
|
||||
$this->assertEquals($locale, $translator->getLocale());
|
||||
|
|
@ -144,7 +143,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testSetFallbackInvalidLocales($locale)
|
||||
{
|
||||
$translator = new Translator('fr', new MessageSelector());
|
||||
$translator = new Translator('fr');
|
||||
$translator->setFallbackLocales(array('fr', $locale));
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +152,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testSetFallbackValidLocales($locale)
|
||||
{
|
||||
$translator = new Translator($locale, new MessageSelector());
|
||||
$translator = new Translator($locale);
|
||||
$translator->setFallbackLocales(array('fr', $locale));
|
||||
// no assertion. this method just asserts that no exception is thrown
|
||||
$this->addToAssertionCount(1);
|
||||
|
|
@ -176,7 +175,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testAddResourceInvalidLocales($locale)
|
||||
{
|
||||
$translator = new Translator('fr', new MessageSelector());
|
||||
$translator = new Translator('fr');
|
||||
$translator->addResource('array', array('foo' => 'foofoo'), $locale);
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +184,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testAddResourceValidLocales($locale)
|
||||
{
|
||||
$translator = new Translator('fr', new MessageSelector());
|
||||
$translator = new Translator('fr');
|
||||
$translator->addResource('array', array('foo' => 'foofoo'), $locale);
|
||||
// no assertion. this method just asserts that no exception is thrown
|
||||
$this->addToAssertionCount(1);
|
||||
|
|
@ -288,7 +287,7 @@ class TranslatorTest extends TestCase
|
|||
|
||||
public function testFallbackCatalogueResources()
|
||||
{
|
||||
$translator = new Translator('en_GB', new MessageSelector());
|
||||
$translator = new Translator('en_GB');
|
||||
$translator->addLoader('yml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
|
||||
$translator->addResource('yml', __DIR__.'/fixtures/empty.yml', 'en_GB');
|
||||
$translator->addResource('yml', __DIR__.'/fixtures/resources.yml', 'en');
|
||||
|
|
@ -298,12 +297,12 @@ class TranslatorTest extends TestCase
|
|||
|
||||
$resources = $translator->getCatalogue('en')->getResources();
|
||||
$this->assertCount(1, $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
|
||||
$resources = $translator->getCatalogue('en_GB')->getResources();
|
||||
$this->assertCount(2, $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'empty.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -324,7 +323,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testTransInvalidLocale($locale)
|
||||
{
|
||||
$translator = new Translator('en', new MessageSelector());
|
||||
$translator = new Translator('en');
|
||||
$translator->addLoader('array', new ArrayLoader());
|
||||
$translator->addResource('array', array('foo' => 'foofoo'), 'en');
|
||||
|
||||
|
|
@ -336,7 +335,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testTransValidLocale($locale)
|
||||
{
|
||||
$translator = new Translator($locale, new MessageSelector());
|
||||
$translator = new Translator($locale);
|
||||
$translator->addLoader('array', new ArrayLoader());
|
||||
$translator->addResource('array', array('test' => 'OK'), $locale);
|
||||
|
||||
|
|
@ -374,7 +373,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testTransChoiceInvalidLocale($locale)
|
||||
{
|
||||
$translator = new Translator('en', new MessageSelector());
|
||||
$translator = new Translator('en');
|
||||
$translator->addLoader('array', new ArrayLoader());
|
||||
$translator->addResource('array', array('foo' => 'foofoo'), 'en');
|
||||
|
||||
|
|
@ -386,7 +385,7 @@ class TranslatorTest extends TestCase
|
|||
*/
|
||||
public function testTransChoiceValidLocale($locale)
|
||||
{
|
||||
$translator = new Translator('en', new MessageSelector());
|
||||
$translator = new Translator('en');
|
||||
$translator->addLoader('array', new ArrayLoader());
|
||||
$translator->addResource('array', array('foo' => 'foofoo'), 'en');
|
||||
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php
vendored
Executable file → Normal file
18
pfosten/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php
vendored
Executable file → Normal file
18
pfosten/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php
vendored
Executable file → Normal file
|
|
@ -18,6 +18,10 @@ use Symfony\Component\Translation\Writer\TranslationWriter;
|
|||
|
||||
class TranslationWriterTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The "Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.
|
||||
*/
|
||||
public function testWriteTranslations()
|
||||
{
|
||||
$dumper = $this->getMockBuilder('Symfony\Component\Translation\Dumper\DumperInterface')->getMock();
|
||||
|
|
@ -27,7 +31,19 @@ class TranslationWriterTest extends TestCase
|
|||
|
||||
$writer = new TranslationWriter();
|
||||
$writer->addDumper('test', $dumper);
|
||||
$writer->writeTranslations(new MessageCatalogue(array()), 'test');
|
||||
$writer->writeTranslations(new MessageCatalogue('en'), 'test');
|
||||
}
|
||||
|
||||
public function testWrite()
|
||||
{
|
||||
$dumper = $this->getMockBuilder('Symfony\Component\Translation\Dumper\DumperInterface')->getMock();
|
||||
$dumper
|
||||
->expects($this->once())
|
||||
->method('dump');
|
||||
|
||||
$writer = new TranslationWriter();
|
||||
$writer->addDumper('test', $dumper);
|
||||
$writer->write(new MessageCatalogue(array()), 'test');
|
||||
}
|
||||
|
||||
public function testDisableBackup()
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty-translation.mo
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty-translation.mo
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty-translation.po
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty-translation.po
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty.csv
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty.csv
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty.ini
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/translation/Tests/fixtures/empty.ini
vendored
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue