W3cubDocs

/Symfony 4.1

IcuResFileLoader

class IcuResFileLoader implements LoaderInterface

IcuResFileLoader loads translations from a resource bundle.

Methods

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

Loads a locale.

array flatten(ResourceBundle $rb, array $messages = array(), string $path = null)

Flattens an ResourceBundle.

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 flatten(ResourceBundle $rb, array $messages = array(), string $path = null)

Flattens an ResourceBundle.

The scheme used is: key { key2 { key3 { "value" } } } Becomes: 'key.key2.key3' => 'value'

This function takes an array by reference and will modify it

Parameters

ResourceBundle $rb The ResourceBundle that will be flattened
array $messages Used internally for recursive calls
string $path Current path being parsed, used internally for recursive calls

Return Value

array the flattened ResourceBundle

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