interface StructuredBundleReaderInterface implements BundleReaderInterface

Reads individual entries of a resource file.

Methods

mixed
read(string $path, string $locale)

Reads a resource bundle.

string[]
getLocales(string $path)

Reads the available locales of a resource bundle.

mixed
readEntry(string $path, string $locale, array $indices, Boolean $fallback = true)

Reads an entry from a resource bundle.

Details

in BundleReaderInterface at line line 30
mixed read(string $path, string $locale)

Reads a resource bundle.

Parameters

string $path The path to the resource bundle.
string $locale The locale to read.

Return Value

mixed Returns an array or {@link \ArrayAccess} instance for complex data, a scalar value otherwise.

in BundleReaderInterface at line line 39
string[] getLocales(string $path)

Reads the available locales of a resource bundle.

Parameters

string $path The path to the resource bundle.

Return Value

string[] A list of supported locale codes.

at line line 49
mixed readEntry(string $path, string $locale, array $indices, Boolean $fallback = true)

Reads an entry from a resource bundle.

An entry can be selected from the resource bundle by passing the path to that entry in the bundle. For example, if the bundle is structured like this:

TopLevel
    NestedLevel
        Entry: Value

Then the value can be read by calling:

$reader->readEntry('...', 'en', array('TopLevel', 'NestedLevel', 'Entry'));

Parameters

string $path The path to the resource bundle.
string $locale The locale to read.
array $indices The indices to read from the bundle.
Boolean $fallback Whether to merge the value with the value from the fallback locale (e.g. "en" for "en_GB"). Only applicable if the result is multivalued (i.e. array or \ArrayAccess) or cannot be found in the requested locale.

Return Value

mixed Returns an array or {@link \ArrayAccess} instance for complex data, a scalar value for simple data and NULL if the given path could not be accessed.