public function PhpFileLoader::load in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/symfony/routing/Loader/PhpFileLoader.php \Symfony\Component\Routing\Loader\PhpFileLoader::load()
- 8.0 vendor/symfony/translation/Loader/PhpFileLoader.php \Symfony\Component\Translation\Loader\PhpFileLoader::load()
- 8.0 vendor/symfony/dependency-injection/Loader/PhpFileLoader.php \Symfony\Component\DependencyInjection\Loader\PhpFileLoader::load()
Same name and namespace in other branches
- 8 vendor/symfony/translation/Loader/PhpFileLoader.php \Symfony\Component\Translation\Loader\PhpFileLoader::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/ PhpFileLoader.php, line 28
Class
- PhpFileLoader
- PhpFileLoader loads translations from PHP files returning an array of translations.
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 = (require $resource);
$catalogue = parent::load($messages, $locale, $domain);
if (class_exists('Symfony\\Component\\Config\\Resource\\FileResource')) {
$catalogue
->addResource(new FileResource($resource));
}
return $catalogue;
}