Dictionary extends Repository implements DictionaryInterface
Locale Dictionary.
Load all locale all "Key => translation" data matrix
Tags
Table of Contents
$uri | string | |
---|---|---|
$locale | LocaleInterface | |
$locator | ResourceLocatorInterface | |
$fileLoader | FileRepositoryLoader | |
$items | (string|array)[] | |
__construct() | mixed | |
getDictionary() | Returns all loaded locale Key => Translation data dictionary. | (string|array)[] |
getFlattenDictionary() | Return the dictionnary as a flatten array, using dot notation. | string[] |
setUri() | Set the locator base URI (default 'locale://'). | void |
getLocale() | Return the associate locale. | LocaleInterface |
getFileLoader() | Return the file repository loader used to load. | FileRepositoryLoader |
loadDictionary() | Load the dictionary from file. | (string|array)[] |
filterDictionaryFiles() | Remove config files from locator results and convert ResourceInterface to path/string. | string[] |
getFiles() | List all files for a given locale using the locator. | \UserFrosting\UniformResourceLocator\ResourceInterface[] |
mergeItems() | Recursively merge values (scalar or array) into this repository. | self |
getDefined() | Get the specified configuration value, recursively removing all null values. | mixed |
Properties
$uri
protected
string
$uri
= 'locale://'
$locale
protected
LocaleInterface
$locale
$locator
protected
ResourceLocatorInterface
$locator
$fileLoader
protected
FileRepositoryLoader
$fileLoader
$items
protected
(string|array)[]
$items
= []
Methods
__construct()
public
__construct(
$locale :
LocaleInterface
, $locator :
ResourceLocatorInterface
[, $fileLoader :
FileRepositoryLoader
= null ]
)
: mixed
Parameters
- $locale : LocaleInterface
- $locator : ResourceLocatorInterface
- $fileLoader : FileRepositoryLoader = null
File loader used to load each dictionnay files (default to Array Loader)
Return values
mixedgetDictionary()
Returns all loaded locale Key => Translation data dictionary.
public
getDictionary(
)
: (string|array)[]
Return values
(string|array)[] —The locale dictionary
getFlattenDictionary()
Return the dictionnary as a flatten array, using dot notation.
public
getFlattenDictionary(
)
: string[]
Return values
string[]setUri()
Set the locator base URI (default 'locale://').
public
setUri(
$uri :
string
)
: void
Parameters
- $uri : string
getLocale()
Return the associate locale.
public
getLocale(
)
: LocaleInterface
Return values
LocaleInterfacegetFileLoader()
Return the file repository loader used to load.
public
getFileLoader(
)
: FileRepositoryLoader
Return values
FileRepositoryLoaderloadDictionary()
Load the dictionary from file.
protected
loadDictionary(
)
: (string|array)[]
Return values
(string|array)[] —The locale dictionary
filterDictionaryFiles()
Remove config files from locator results and convert ResourceInterface to path/string.
protected
filterDictionaryFiles(
$files :
\UserFrosting\UniformResourceLocator\ResourceInterface[]
)
: string[]
Parameters
- $files : \UserFrosting\UniformResourceLocator\ResourceInterface[]
Return values
string[]getFiles()
List all files for a given locale using the locator.
protected
getFiles(
)
: \UserFrosting\UniformResourceLocator\ResourceInterface[]
Return values
\UserFrosting\UniformResourceLocator\ResourceInterface[]mergeItems()
Recursively merge values (scalar or array) into this repository.
public
mergeItems(
$key :
string|null
, $items :
mixed
)
: self
If no key is specified, the items will be merged in starting from the top level of the array. If a key IS specified, items will be merged into that key. Nested keys may be specified using dot syntax.
Parameters
- $key : string|null
- $items : mixed
Return values
selfgetDefined()
Get the specified configuration value, recursively removing all null values.
public
getDefined(
[ $key :
string|array|null
= null ]
)
: mixed
Parameters
- $key : string|array|null = null