SymfonyComponentTranslationLoaderYamlFileLoader

YamlFileLoader loads translations from Yaml files.

Defined (1)

The class is defined in the following location(s).

/vendor/symfony/translation/Loader/YamlFileLoader.php  
  1. class YamlFileLoader extends FileLoader 
  2. private $yamlParser; 
  3.  
  4. /** 
  5. * {@inheritdoc} 
  6. */ 
  7. protected function loadResource($resource) 
  8. if (null === $this->yamlParser) { 
  9. if (!class_exists('Symfony\Component\Yaml\Parser')) { 
  10. throw new LogicException('Loading translations from the YAML format requires the Symfony Yaml component.'); 
  11.  
  12. $this->yamlParser = new YamlParser(); 
  13.  
  14. try { 
  15. $messages = $this->yamlParser->parse(file_get_contents($resource)); 
  16. } catch (ParseException $e) { 
  17. throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e); 
  18.  
  19. return $messages;