/** * Find the translation and translate the template if translation is found. * * @param LayoutInterface|MailInterface $template The template * @param string $locale The locale * * @return bool */ public static function find($template, $locale) { $locale = strtolower($locale); foreach ($template->getTranslations() as $translation) { if ($locale === strtolower($translation->getLocale())) { static::injectValue($template, $translation, 'label'); static::injectValue($template, $translation, 'description'); static::injectValue($template, $translation, 'body'); static::injectFile($template, $translation); if ($template instanceof MailInterface) { static::injectValue($template, $translation, 'subject'); static::injectValue($template, $translation, 'htmlBody'); } return true; } } return false; }