class FileLoader implements Loader

Properties

protected array $paths

The default paths for the loader.

protected array $jsonPaths

All of the registered paths to JSON translation files.

protected array $hints

All of the namespace hints.

Methods

__construct(Filesystem $files, array|string $path)

Create a new file loader instance.

array
load(string $locale, string $group, string|null $namespace = null)

Load the messages for the given locale.

array
loadNamespaced(string $locale, string $group, string $namespace)

Load a namespaced translation group.

array
loadNamespaceOverrides(array $lines, string $locale, string $group, string $namespace)

Load a local namespaced translation group for overrides.

array
loadPaths(array $paths, string $locale, string $group)

Load a locale from a given path.

array
loadJsonPaths(string $locale)

Load a locale from the given JSON file path.

void
addNamespace(string $namespace, string $hint)

Add a new namespace to the loader.

array
namespaces()

Get an array of all the registered namespaces.

void
addPath(string $path)

Add a new path to the loader.

void
addJsonPath(string $path)

Add a new JSON path to the loader.

array
paths()

Get an array of all the registered paths to translation files.

array
jsonPaths()

Get an array of all the registered paths to JSON translation files.

Details

at line 34
__construct(Filesystem $files, array|string $path)

Create a new file loader instance.

Parameters

Filesystem $files

the filesystem instance

array|string $path

at line 46
array load(string $locale, string $group, string|null $namespace = null)

Load the messages for the given locale.

Parameters

string $locale
string $group
string|null $namespace

Return Value

array

at line 62
protected array loadNamespaced(string $locale, string $group, string $namespace)

Load a namespaced translation group.

Parameters

string $locale
string $group
string $namespace

Return Value

array

at line 76
protected array loadNamespaceOverrides(array $lines, string $locale, string $group, string $namespace)

Load a local namespaced translation group for overrides.

Parameters

array $lines
string $locale
string $group
string $namespace

Return Value

array

at line 93
protected array loadPaths(array $paths, string $locale, string $group)

Load a locale from a given path.

Parameters

array $paths
string $locale
string $group

Return Value

array

at line 110
protected array loadJsonPaths(string $locale)

Load a locale from the given JSON file path.

Parameters

string $locale

Return Value

array

Exceptions

RuntimeException

at line 131
void addNamespace(string $namespace, string $hint)

Add a new namespace to the loader.

Parameters

string $namespace
string $hint

Return Value

void

at line 139
array namespaces()

Get an array of all the registered namespaces.

Return Value

array

at line 147
void addPath(string $path)

Add a new path to the loader.

Parameters

string $path

Return Value

void

at line 155
void addJsonPath(string $path)

Add a new JSON path to the loader.

Parameters

string $path

Return Value

void

at line 163
array paths()

Get an array of all the registered paths to translation files.

Return Value

array

at line 171
array jsonPaths()

Get an array of all the registered paths to JSON translation files.

Return Value

array