updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -12,7 +12,7 @@
namespace Symfony\Component\Translation\Loader;
/**
* @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/)
* @copyright Copyright (c) 2010, Union of RAD https://github.com/UnionOfRAD/lithium
* @copyright Copyright (c) 2012, Clemens Tolboom
*/
class PoFileLoader extends FileLoader
@@ -20,7 +20,7 @@ class PoFileLoader extends FileLoader
/**
* Parses portable object (PO) format.
*
* From http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
* From https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
* we should be able to parse files having:
*
* white-space
@@ -64,14 +64,14 @@ class PoFileLoader extends FileLoader
{
$stream = fopen($resource, 'r');
$defaults = array(
'ids' => array(),
$defaults = [
'ids' => [],
'translated' => null,
);
];
$messages = array();
$messages = [];
$item = $defaults;
$flags = array();
$flags = [];
while ($line = fgets($stream)) {
$line = trim($line);
@@ -82,7 +82,7 @@ class PoFileLoader extends FileLoader
$this->addMessage($messages, $item);
}
$item = $defaults;
$flags = array();
$flags = [];
} elseif ('#,' === substr($line, 0, 2)) {
$flags = array_map('trim', explode(',', substr($line, 2)));
} elseif ('msgid "' === substr($line, 0, 7)) {
@@ -126,23 +126,24 @@ class PoFileLoader extends FileLoader
*/
private function addMessage(array &$messages, array $item)
{
if (\is_array($item['translated'])) {
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]);
if (!empty($item['ids']['singular'])) {
$id = stripcslashes($item['ids']['singular']);
if (isset($item['ids']['plural'])) {
$plurals = $item['translated'];
// PO are by definition indexed so sort by index.
ksort($plurals);
// Make sure every index is filled.
end($plurals);
$count = key($plurals);
// Fill missing spots with '-'.
$empties = array_fill(0, $count + 1, '-');
$plurals += $empties;
ksort($plurals);
$messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals));
$id .= '|'.stripcslashes($item['ids']['plural']);
}
} elseif (!empty($item['ids']['singular'])) {
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated']);
$translated = (array) $item['translated'];
// PO are by definition indexed so sort by index.
ksort($translated);
// Make sure every index is filled.
end($translated);
$count = key($translated);
// Fill missing spots with '-'.
$empties = array_fill(0, $count + 1, '-');
$translated += $empties;
ksort($translated);
$messages[$id] = stripcslashes(implode('|', $translated));
}
}
}