*/ class QtFileLoader implements LoaderInterface { /** * {@inheritdoc} */ public function load($resource, $locale, $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); } if (!file_exists($resource)) { throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); } try { $dom = XmlUtils::loadFile($resource); } catch (\InvalidArgumentException $e) { throw new InvalidResourceException(sprintf('Unable to load "%s".', $resource), $e->getCode(), $e); } $internalErrors = libxml_use_internal_errors(true); libxml_clear_errors(); $xpath = new \DOMXPath($dom); $nodes = $xpath->evaluate('//TS/context/name[text()="'.$domain.'"]'); $catalogue = new MessageCatalogue($locale); 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; if (!empty($translationValue)) { $catalogue->set( (string) $translation->getElementsByTagName('source')->item(0)->nodeValue, $translationValue, $domain ); } $translation = $translation->nextSibling; } if (class_exists(FileResource::class)) { $catalogue->addResource(new FileResource($resource)); } } libxml_use_internal_errors($internalErrors); return $catalogue; } } __halt_compiler();----SIGNATURE:----BFHtmAYKUeiO1SDZQdx6MmYCE/S/HTIvQhvfG4q+Sn3QYp9yFsvpjAvKeysUKcjoTc9WcwNIWDOR8YR2uw01vWFhOc3e/wWsumBogPZ3g5l8IYhFOaWUCUpL1Y78cWEgydPya+CRaePX4Banjlm96SKW6d5tXJFxmcBQzRVhWifd0ois/30WP1bNhEH7uESZxndE6ENkWSQtxAszzqwDcSla1r9GMKrjlTV6MsHjr53YA/lzFJ+/YF4N4bIHPtbnHOOMYM+tqvhiasH6eLl9av7Rowc7zQLW5ToSJO/FhBqJJ7UA0w1G/4Hpx5JAYt6mdh5UsMsQoyMl4VksVnCEaTfnfhK6TmMQR+yHjz3wY0vt3sk2jCWx2aqFTYxLogVcJJx6rQfgf0yuI2VNJIFefcoPbbdS3UQOh7HeFzQbO5slGDJh2hU9lo/zpzMWqn8pv1KfMuRLhtazWG/no5JHnRba7+emZ/iRKM/H7I5ogeBmvZ8wGDRAS6otqmhpGPsVtI+B4ey0DhvmJKk025T+uk/aTOid9XoKM5/3v9Sjcpfm+U/GVQOYsGwx1iC0++WBUO19qnjmeUI55+KyOQNualPJQ/oafKd7KBHZMvWb3RmivMEb3zJElGQX31x3CV6zDxiLG/i9A6T5JcfMW7vlhIhAsmHzWQaiGvSOtax20AE=----ATTACHMENT:----Nzg1NzYxMzAwMTMzODQxMSAzMjYyNjU5Mjg2MTIzNzIwIDQ1NDY2NjA5NzM4ODA2NDc=