TranslationParameterToken
class TranslationParameterToken implements ProtectedContextAwareInterface (View source)
Provides a chainable interface to collect all arguments needed to translate messages using source message or key ID
It also translates labels according to the configuration it stores
Properties
protected Translator | $translator | ||
protected array | $parameters | Key/Value store to keep the collected parameters |
Methods
No description
Set the id.
Set the original translation value (the untranslated source string).
Set the arguments.
Set the source.
Set the package.
Set the quantity.
Set the locale.
Translate according to currently collected parameters
Runs translate to avoid the need of calling translate as a finishing method
All methods are considered safe
Details
__construct(string $id = null, string $value = null)
No description
injectTranslator(Translator $translator)
Inject the translator into the token.
Used for testing.
TranslationParameterToken
id(string $id)
Set the id.
TranslationParameterToken
value(string $value)
Set the original translation value (the untranslated source string).
TranslationParameterToken
arguments(array $arguments)
Set the arguments.
TranslationParameterToken
source(string $source)
Set the source.
TranslationParameterToken
package(string $package)
Set the package.
TranslationParameterToken
quantity(mixed $quantity)
Set the quantity.
TranslationParameterToken
locale(string $locale)
Set the locale.
The locale Identifier will be converted into a Locale
string|null
translate(array $overrides = [])
Translate according to currently collected parameters
string
__toString()
Runs translate to avoid the need of calling translate as a finishing method
bool
allowsCallOfMethod(string $methodName)
All methods are considered safe