Translations
TranslationHelper
The TranslationHelper helps to resolve typical configurable translation use cases. In these cases you normally want to
- pass a
stringto use as-is - pass a
TranslatableInterfaceto automatically translate the value
This can be done with the translation helper:
function example (TranslationHelper $helper)
{
// resolve the value as described above
$helper->resolve($value, $locale);
// same method as TranslatorInterface
$helper->trans($key, $parameter, $domain, $locale);
}