PHP Класс Neos\Flow\I18n\Cldr\CldrRepository

CldrRepository manages CldrModel instances across the framework, so there is only one instance of CldrModel for every unique CLDR data file or file group.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cldrBasePath string An absolute path to the directory where CLDR resides. It is changed only in tests.
$localizationService Neos\Flow\I18n\Service
$models array This is an associative array with pairs as follow: ['path']['locale'] => $model, where 'path' is a file or directory path and 'locale' is a Locale object. For models representing one CLDR file, the 'path' points to a file and 'locale' is not used. For models representing few CLDR files connected with hierarchical relation, 'path' points to a directory where files reside and 'locale' is used to define which files are included in the relation (e.g. for locale 'en_GB' files would be: root + en + en_GB).

Открытые методы

Метод Описание
getModel ( string $filename ) : CldrModel | boolean Returns an instance of CldrModel which represents CLDR file found under specified path.
getModelForLocale ( Locale $locale, string $directoryPath = 'main' ) : CldrModel Returns an instance of CldrModel which represents group of CLDR files which are related in hierarchy.
injectLocalizationService ( Service $localizationService ) : void

Защищенные методы

Метод Описание
findLocaleChain ( Locale $locale, string $directoryPath ) : array Returns absolute paths to CLDR files connected in hierarchy

Описание методов

findLocaleChain() защищенный Метод

For given locale, many CLDR files have to be merged in order to get full set of CLDR data. For example, for 'en_GB' locale, files 'root', 'en', and 'en_GB' should be merged.
protected findLocaleChain ( Locale $locale, string $directoryPath ) : array
$locale Neos\Flow\I18n\Locale A locale
$directoryPath string Relative path to existing CLDR directory which contains one file per locale (see 'main' directory in CLDR for example)
Результат array

getModel() публичный Метод

Will return existing instance if a model for given $filename was already requested before. Returns FALSE when $filename doesn't point to existing file.
public getModel ( string $filename ) : CldrModel | boolean
$filename string Relative (from CLDR root) path to existing CLDR file
Результат CldrModel | boolean A CldrModel instance or FALSE on failure

getModelForLocale() публичный Метод

This method finds a group of CLDR files within $directoryPath dir, for particular Locale. Returned model represents whole locale-chain. For example, for locale en_GB, returned model could represent 'en_GB', 'en', and 'root' CLDR files. Returns FALSE when $directoryPath doesn't point to existing directory.
public getModelForLocale ( Locale $locale, string $directoryPath = 'main' ) : CldrModel
$locale Neos\Flow\I18n\Locale A locale
$directoryPath string Relative path to existing CLDR directory which contains one file per locale (see 'main' directory in CLDR for example)
Результат CldrModel A CldrModel instance or NULL on failure

injectLocalizationService() публичный Метод

public injectLocalizationService ( Service $localizationService ) : void
$localizationService Neos\Flow\I18n\Service
Результат void

Описание свойств

$cldrBasePath защищенное свойство

An absolute path to the directory where CLDR resides. It is changed only in tests.
protected string $cldrBasePath
Результат string

$localizationService защищенное свойство

protected Service,Neos\Flow\I18n $localizationService
Результат Neos\Flow\I18n\Service

$models защищенное свойство

This is an associative array with pairs as follow: ['path']['locale'] => $model, where 'path' is a file or directory path and 'locale' is a Locale object. For models representing one CLDR file, the 'path' points to a file and 'locale' is not used. For models representing few CLDR files connected with hierarchical relation, 'path' points to a directory where files reside and 'locale' is used to define which files are included in the relation (e.g. for locale 'en_GB' files would be: root + en + en_GB).
protected array $models
Результат array