PHP Class Neos\Flow\I18n\LocaleCollection

This class maintans a hierarchical relation between locales. For example, a locale "en_GB" will be a child of a locale "en".
显示文件 Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$localeCollection array The values are Locale objects, and the keys are these locale's tags.
$localeParentCollection array "Searching" is done by the keys, which are locale tags. The key points to the value which is a parent Locale object. If it's not set, there is no parent for given locale, or no parent was searched before.

Public Methods

Method Description
addLocale ( Locale $locale ) : boolean Adds a locale to the collection.
findBestMatchingLocale ( Locale $locale ) : mixed Returns Locale object which represents one of locales installed and which is most similar to the "template" Locale object given as parameter.
getParentLocaleOf ( Locale $locale ) : mixed Returns a parent Locale object of the locale provided.

Method Details

addLocale() public method

Adds a locale to the collection.
public addLocale ( Locale $locale ) : boolean
$locale Locale The Locale to be inserted
return boolean FALSE when same locale was already inserted before

findBestMatchingLocale() public method

Returns Locale object which represents one of locales installed and which is most similar to the "template" Locale object given as parameter.
public findBestMatchingLocale ( Locale $locale ) : mixed
$locale Locale The "template" locale to be matched
return mixed Existing Locale instance on success, NULL on failure

getParentLocaleOf() public method

The parent is a locale which is more generic than the one given as parameter. For example, the parent for locale en_GB will be locale en, of course if it exists in the locale tree of available locales. This method returns NULL when no parent locale is available, or when Locale object provided is not in the tree (ie it's not in a group of available locales). Note: to find a best-matching locale to one which doesn't exist in the system, please use findBestMatchingLocale() method of this class.
public getParentLocaleOf ( Locale $locale ) : mixed
$locale Locale The Locale to search parent for
return mixed Existing Locale instance or NULL on failure

Property Details

$localeCollection protected_oe property

The values are Locale objects, and the keys are these locale's tags.
protected array $localeCollection
return array

$localeParentCollection protected_oe property

"Searching" is done by the keys, which are locale tags. The key points to the value which is a parent Locale object. If it's not set, there is no parent for given locale, or no parent was searched before.
protected array $localeParentCollection
return array