PHP Class Neos\Flow\I18n\Service

Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
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".

Method Details

findBestMatchingLocale() public méthode

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
Résultat mixed Existing Locale instance on success, NULL on failure

generateAvailableLocalesCollectionByScanningFilesystem() protected méthode

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 méthode

public getConfiguration ( ) : Configuration
Résultat Configuration

getLocaleChain() public méthode

Build a chain of locale objects according to the fallback rule and the available locales.
public getLocaleChain ( Locale $locale ) : array
$locale Locale
Résultat array

getLocalizedFilename() public méthode

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.
See also: 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)
Résultat array Path to the localized file (or $filename when no localized file was found) and the matched locale

getParentLocaleOf() public méthode

Returns a parent Locale object of the locale provided.
public getParentLocaleOf ( Locale $locale ) : Locale
$locale Locale The Locale to search parent for
Résultat Locale Existing Locale instance or NULL on failure

getScanBlacklistPattern() protected méthode

Returns a regex pattern including enclosing characters, that matches any of the configured blacklist paths inside "Neos.Flow.i18n.scan.excludePatterns".
protected getScanBlacklistPattern ( ) : string
Résultat string The regex pattern matching the configured blacklist

getXliffFilenameAndPath() public méthode

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.
See also: 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
Résultat array Path to the localized file (or $filename when no localized file was found) and the matched locale

initializeObject() public méthode

Initializes the locale service
public initializeObject ( ) : void
Résultat void

injectSettings() public méthode

public injectSettings ( array $settings ) : void
$settings array
Résultat void

Property Details

$cache protected_oe property

protected VariableFrontend,Neos\Cache\Frontend $cache
Résultat Neos\Cache\Frontend\VariableFrontend

$configuration protected_oe property

protected Configuration,Neos\Flow\I18n $configuration
Résultat Configuration

$localeBasePath protected_oe property

The base path to use in filesystem operations. It is changed only in tests.
protected string $localeBasePath
Résultat string

$localeCollection protected_oe property

A collection of Locale objects representing currently installed locales, in a hierarchical manner.
protected LocaleCollection,Neos\Flow\I18n $localeCollection
Résultat LocaleCollection

$packageManager protected_oe property

protected PackageManagerInterface,Neos\Flow\Package $packageManager
Résultat Neos\Flow\Package\PackageManagerInterface

$settings protected_oe property

protected array $settings
Résultat array