W3cubDocs

/Symfony 4.1

JsonFileLoader

class JsonFileLoader extends FileLoader

JsonFileLoader loads translations from an json file.

Methods

MessageCatalogue load(mixed $resource, string $locale, string $domain = 'messages')

Loads a locale.

from FileLoader
array loadResource(string $resource)

Details

MessageCatalogue load(mixed $resource, string $locale, string $domain = 'messages')

Loads a locale.

Parameters

mixed $resource A resource
string $locale A locale
string $domain The domain

Return Value

MessageCatalogue A MessageCatalogue instance

Exceptions

NotFoundResourceException when the resource cannot be found
InvalidResourceException when the resource cannot be loaded

protected array loadResource(string $resource)

Parameters

string $resource

Return Value

array

Exceptions

InvalidResourceException if stream content has an invalid format

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Translation/Loader/JsonFileLoader.html