PHP Класс Neos\Flow\I18n\Service

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$cache Neos\Cache\Frontend\VariableFrontend
$configuration Configuration
$localeBasePath string The base path to use in filesystem operations. It is changed only in tests.
$localeCollection LocaleCollection A collection of Locale objects representing currently installed locales, in a hierarchical manner.
$packageManager Neos\Flow\Package\PackageManagerInterface
$settings array

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

Метод Описание
findBestMatchingLocale ( Locale $locale ) : mixed Returns Locale object which is the most similar to the "template" Locale object given as parameter, from the collection of locales available in the current Flow installation.
getConfiguration ( ) : Configuration
getLocaleChain ( Locale $locale ) : array Build a chain of locale objects according to the fallback rule and the available locales.
getLocalizedFilename ( string $pathAndFilename, Locale $locale = null, boolean $strict = false ) : array Returns the path to the existing localized version of file given.
getParentLocaleOf ( Locale $locale ) : Locale Returns a parent Locale object of the locale provided.
getXliffFilenameAndPath ( string $path, string $sourceName, Locale $locale = null ) : array Returns the path to the existing localized version of file given.
initializeObject ( ) : void Initializes the locale service
injectSettings ( array $settings ) : void

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

Метод Описание
generateAvailableLocalesCollectionByScanningFilesystem ( ) : void Finds all Locale objects representing locales available in the Flow installation. This is done by scanning all Private and Public resource files of all active packages, in order to find localized files.
getScanBlacklistPattern ( ) : string Returns a regex pattern including enclosing characters, that matches any of the configured blacklist paths inside "Neos.Flow.i18n.scan.excludePatterns".

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

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

Returns Locale object which is the most similar to the "template" Locale object given as parameter, from the collection of locales available in the current Flow installation.
public findBestMatchingLocale ( Locale $locale ) : mixed
$locale Locale The "template" Locale to be matched
Результат mixed Existing Locale instance on success, NULL on failure

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

Localized files have a locale identifier added before their extension (or at the end of filename, if no extension exists). For example, a localized file for foobar.png, can be foobar.en.png, fobar.en_GB.png, etc. Just one localized resource file causes the corresponding locale to be regarded as available (installed, supported). Note: result of this method invocation is cached

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

public getConfiguration ( ) : Configuration
Результат Configuration

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

Build a chain of locale objects according to the fallback rule and the available locales.
public getLocaleChain ( Locale $locale ) : array
$locale Locale
Результат array

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

Searching is done for the current locale if no $locale parameter is provided. The search is done according to the configured fallback rule. If parameter $strict is provided, searching is done only for the provided / current locale (without searching of files localized for more generic locales). If no localized version of file is found, $filepath is returned without any change.
См. также: Configuration::setFallbackRule()
public getLocalizedFilename ( string $pathAndFilename, Locale $locale = null, boolean $strict = false ) : array
$pathAndFilename string Path to the file
$locale Locale Desired locale of localized file
$strict boolean Whether to match only provided locale (TRUE) or search for best-matching locale (FALSE)
Результат array Path to the localized file (or $filename when no localized file was found) and the matched locale

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

Returns a parent Locale object of the locale provided.
public getParentLocaleOf ( Locale $locale ) : Locale
$locale Locale The Locale to search parent for
Результат Locale Existing Locale instance or NULL on failure

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

Returns a regex pattern including enclosing characters, that matches any of the configured blacklist paths inside "Neos.Flow.i18n.scan.excludePatterns".
protected getScanBlacklistPattern ( ) : string
Результат string The regex pattern matching the configured blacklist

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

Searching is done for the current locale if no $locale parameter is provided. The search is done according to the configured fallback rule. If parameter $strict is provided, searching is done only for the provided / current locale (without searching of files localized for more generic locales). If no localized version of file is found, $filepath is returned without any change.
См. также: Configuration::setFallbackRule()
public getXliffFilenameAndPath ( string $path, string $sourceName, Locale $locale = null ) : array
$path string Base directory to the translation files
$sourceName string name of the translation source
$locale Locale Desired locale of XLIFF file
Результат array Path to the localized file (or $filename when no localized file was found) and the matched locale

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

Initializes the locale service
public initializeObject ( ) : void
Результат void

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

public injectSettings ( array $settings ) : void
$settings array
Результат void

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

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

protected VariableFrontend,Neos\Cache\Frontend $cache
Результат Neos\Cache\Frontend\VariableFrontend

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

protected Configuration,Neos\Flow\I18n $configuration
Результат Configuration

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

The base path to use in filesystem operations. It is changed only in tests.
protected string $localeBasePath
Результат string

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

A collection of Locale objects representing currently installed locales, in a hierarchical manner.
protected LocaleCollection,Neos\Flow\I18n $localeCollection
Результат LocaleCollection

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

protected PackageManagerInterface,Neos\Flow\Package $packageManager
Результат Neos\Flow\Package\PackageManagerInterface

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

protected array $settings
Результат array