public function PoFileLoader::load in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/Loader/PoFileLoader.php \Symfony\Component\Translation\Loader\PoFileLoader::load()
Loads a locale.
Parameters
mixed $resource A resource:
string $locale A locale:
string $domain The domain:
Return value
MessageCatalogue A MessageCatalogue instance
Throws
NotFoundResourceException when the resource cannot be found
InvalidResourceException when the resource cannot be loaded
Overrides ArrayLoader::load
File
- vendor/
symfony/ translation/ Loader/ PoFileLoader.php, line 24
Class
- PoFileLoader
- @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) @copyright Copyright (c) 2012, Clemens Tolboom
Namespace
Symfony\Component\Translation\LoaderCode
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));
}
$messages = $this
->parse($resource);
// empty file
if (null === $messages) {
$messages = array();
}
// not an array
if (!is_array($messages)) {
throw new InvalidResourceException(sprintf('The file "%s" must contain a valid po file.', $resource));
}
$catalogue = parent::load($messages, $locale, $domain);
if (class_exists('Symfony\\Component\\Config\\Resource\\FileResource')) {
$catalogue
->addResource(new FileResource($resource));
}
return $catalogue;
}