public static function loadMo($filename)
{
$translations = false;
// @codingStandardsIgnoreStart
// Binary files extracted makes non-standard local variables
if ($data = file_get_contents($filename)) {
$translations = array();
$header = substr($data, 0, 20);
$header = unpack('L1magic/L1version/L1count/L1o_msg/L1o_trn', $header);
extract($header);
if ((dechex($magic) === '950412de' || dechex($magic) === 'ffffffff950412de') && !$version) {
for ($n = 0; $n < $count; $n++) {
$r = unpack("L1len/L1offs", substr($data, $o_msg + $n * 8, 8));
$msgid = substr($data, $r["offs"], $r["len"]);
unset($msgid_plural);
$context = null;
if (strpos($msgid, "") !== false) {
list($context, $msgid) = explode("", $msgid);
}
if (strpos($msgid, "")) {
list($msgid, $msgid_plural) = explode("", $msgid);
}
$r = unpack("L1len/L1offs", substr($data, $o_trn + $n * 8, 8));
$msgstr = substr($data, $r["offs"], $r["len"]);
if (strpos($msgstr, "")) {
$msgstr = explode("", $msgstr);
}
if ($msgid != '') {
$translations[$msgid][$context] = $msgstr;
} else {
$translations[$msgid] = $msgstr;
}
if (isset($msgid_plural)) {
$translations[$msgid_plural] =& $translations[$msgid];
}
}
}
}
// @codingStandardsIgnoreEnd
return $translations;
}