CldrRepository
class CldrRepository (View source)
The CldrRepository class
CldrRepository manages CldrModel instances across the framework, so there is only one instance of CldrModel for every unique CLDR data file or file group.
Properties
protected string | $cldrBasePath | An absolute path to the directory where CLDR resides. It is changed only in tests. |
|
protected Service | $localizationService | ||
protected CldrModel[] | $models | An array of models requested at least once in current request. |
Methods
Returns an instance of CldrModel which represents CLDR file found under specified path.
Returns an instance of CldrModel which represents group of CLDR files which are related in hierarchy.
Returns absolute paths to CLDR files connected in hierarchy
Details
void
injectLocalizationService(Service $localizationService)
No description
CldrModel|bool
getModel(string $filename)
Returns an instance of CldrModel which represents CLDR file found under specified path.
Will return existing instance if a model for given $filename was already requested before. Returns false when $filename doesn't point to existing file.
CldrModel
getModelForLocale(Locale $locale, string $directoryPath = 'main')
Returns an instance of CldrModel which represents group of CLDR files which are related in hierarchy.
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.
protected string[]
findLocaleChain(Locale $locale, string $directoryPath)
Returns absolute paths to CLDR files connected in hierarchy
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.