PHP Class Neos\Flow\I18n\EelHelper\TranslationHelper

Inheritance: implements Neos\Eel\ProtectedContextAwareInterface
Exibir arquivo Open project: neos/flow-development-collection Class Usage Examples

Public Methods

Method Description
allowsCallOfMethod ( string $methodName ) : boolean All methods are considered safe
id ( string $id ) : TranslationParameterToken Start collection of parameters for translation by id
translate ( string $id, string $originalLabel = null, array $arguments = [], string $source = 'Main', string $package = null, mixed $quantity = null, string $locale = null ) : string Get the translated value for an id or original label
value ( string $value ) : TranslationParameterToken Start collection of parameters for translation by original label

Protected Methods

Method Description
createTranslationParameterToken ( string $id = null, string $originalLabel = null ) : TranslationParameterToken Create and return a TranslationParameterToken.
translateByExplicitlyPassedOrderedArguments ( string $id, string $originalLabel = null, array $arguments = [], string $source = 'Main', string $package = null, mixed $quantity = null, string $locale = null ) : string Get the translated value for an id or original label
translateByShortHandString ( string $shortHandString ) : string Translate by shorthand string

Method Details

allowsCallOfMethod() public method

All methods are considered safe
public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
return boolean

createTranslationParameterToken() protected method

Create and return a TranslationParameterToken.
protected createTranslationParameterToken ( string $id = null, string $originalLabel = null ) : TranslationParameterToken
$id string
$originalLabel string
return TranslationParameterToken

id() public method

Start collection of parameters for translation by id
public id ( string $id ) : TranslationParameterToken
$id string Id to use for finding translation (trans-unit id in XLIFF)
return TranslationParameterToken

translate() public method

If only id is set and contains a translation shorthand string, translate according to that shorthand In all other cases: Replace all placeholders with corresponding values if they exist in the translated label.
public translate ( string $id, string $originalLabel = null, array $arguments = [], string $source = 'Main', string $package = null, mixed $quantity = null, string $locale = null ) : string
$id string Id to use for finding translation (trans-unit id in XLIFF)
$originalLabel string The original translation value (the untranslated source string).
$arguments array Numerically indexed array of values to be inserted into placeholders
$source string Name of file with translations
$package string Target package key. If not set, the current package key will be used
$quantity mixed A number to find plural form for (float or int), NULL to not use plural forms
$locale string An identifier of locale to use (NULL for use the default locale)
return string Translated label or source label / ID key

translateByExplicitlyPassedOrderedArguments() protected method

Replace all placeholders with corresponding values if they exist in the translated label.
protected translateByExplicitlyPassedOrderedArguments ( string $id, string $originalLabel = null, array $arguments = [], string $source = 'Main', string $package = null, mixed $quantity = null, string $locale = null ) : string
$id string Id to use for finding translation (trans-unit id in XLIFF)
$originalLabel string The original translation value (the untranslated source string).
$arguments array Numerically indexed array of values to be inserted into placeholders
$source string Name of file with translations
$package string Target package key. If not set, the current package key will be used
$quantity mixed A number to find plural form for (float or int), NULL to not use plural forms
$locale string An identifier of locale to use (NULL for use the default locale)
return string Translated label or source label / ID key

translateByShortHandString() protected method

Translate by shorthand string
protected translateByShortHandString ( string $shortHandString ) : string
$shortHandString string (PackageKey:Source:trans-unit-id)
return string Translated label or source label / ID key

value() public method

Start collection of parameters for translation by original label
public value ( string $value ) : TranslationParameterToken
$value string
return TranslationParameterToken