updated-packages
This commit is contained in:
@@ -19,21 +19,21 @@ use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
class MoFileLoader extends FileLoader
|
||||
{
|
||||
/**
|
||||
* Magic used for validating the format of a MO file as well as
|
||||
* Magic used for validating the format of an MO file as well as
|
||||
* detecting if the machine used to create that file was little endian.
|
||||
*/
|
||||
const MO_LITTLE_ENDIAN_MAGIC = 0x950412de;
|
||||
public const MO_LITTLE_ENDIAN_MAGIC = 0x950412DE;
|
||||
|
||||
/**
|
||||
* Magic used for validating the format of a MO file as well as
|
||||
* Magic used for validating the format of an MO file as well as
|
||||
* detecting if the machine used to create that file was big endian.
|
||||
*/
|
||||
const MO_BIG_ENDIAN_MAGIC = 0xde120495;
|
||||
public const MO_BIG_ENDIAN_MAGIC = 0xDE120495;
|
||||
|
||||
/**
|
||||
* The size of the header of a MO file in bytes.
|
||||
* The size of the header of an MO file in bytes.
|
||||
*/
|
||||
const MO_HEADER_SIZE = 28;
|
||||
public const MO_HEADER_SIZE = 28;
|
||||
|
||||
/**
|
||||
* Parses machine object (MO) format, independent of the machine's endian it
|
||||
@@ -71,7 +71,7 @@ class MoFileLoader extends FileLoader
|
||||
// offsetHashes
|
||||
$this->readLong($stream, $isBigEndian);
|
||||
|
||||
$messages = array();
|
||||
$messages = [];
|
||||
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$pluralId = null;
|
||||
@@ -89,8 +89,8 @@ class MoFileLoader extends FileLoader
|
||||
fseek($stream, $offset);
|
||||
$singularId = fread($stream, $length);
|
||||
|
||||
if (false !== strpos($singularId, "\000")) {
|
||||
list($singularId, $pluralId) = explode("\000", $singularId);
|
||||
if (str_contains($singularId, "\000")) {
|
||||
[$singularId, $pluralId] = explode("\000", $singularId);
|
||||
}
|
||||
|
||||
fseek($stream, $offsetTranslated + $i * 8);
|
||||
@@ -104,24 +104,19 @@ class MoFileLoader extends FileLoader
|
||||
fseek($stream, $offset);
|
||||
$translated = fread($stream, $length);
|
||||
|
||||
if (false !== strpos($translated, "\000")) {
|
||||
if (str_contains($translated, "\000")) {
|
||||
$translated = explode("\000", $translated);
|
||||
}
|
||||
|
||||
$ids = array('singular' => $singularId, 'plural' => $pluralId);
|
||||
$ids = ['singular' => $singularId, 'plural' => $pluralId];
|
||||
$item = compact('ids', 'translated');
|
||||
|
||||
if (\is_array($item['translated'])) {
|
||||
$messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]);
|
||||
if (!empty($item['ids']['singular'])) {
|
||||
$id = $item['ids']['singular'];
|
||||
if (isset($item['ids']['plural'])) {
|
||||
$plurals = array();
|
||||
foreach ($item['translated'] as $plural => $translated) {
|
||||
$plurals[] = sprintf('{%d} %s', $plural, $translated);
|
||||
}
|
||||
$messages[$item['ids']['plural']] = stripcslashes(implode('|', $plurals));
|
||||
$id .= '|'.$item['ids']['plural'];
|
||||
}
|
||||
} elseif (!empty($item['ids']['singular'])) {
|
||||
$messages[$item['ids']['singular']] = stripcslashes($item['translated']);
|
||||
$messages[$id] = stripcslashes(implode('|', (array) $item['translated']));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user