diff --git a/application/Espo/Core/Htmlizer/Htmlizer.php b/application/Espo/Core/Htmlizer/Htmlizer.php index e5d10e9d37..ea3d89a511 100644 --- a/application/Espo/Core/Htmlizer/Htmlizer.php +++ b/application/Espo/Core/Htmlizer/Htmlizer.php @@ -413,12 +413,12 @@ class Htmlizer ); if ($this->metadata) { - $translation = $this->metadata->get( + $translationPath = $this->metadata->get( ['entityDefs', $entity->getEntityType(), 'fields', $attribute, 'translation'] ); - if ($translation) { - $data[$attribute] = $this->language->get($translation . '.' . $data[$attribute]); + if ($translationPath) { + $data[$attribute] = $this->language->get($translationPath . '.' . $attribute, $data[$attribute]); } } } diff --git a/application/Espo/Tools/EmailTemplate/Formatter.php b/application/Espo/Tools/EmailTemplate/Formatter.php index a3b4c93731..7a296af0f5 100644 --- a/application/Espo/Tools/EmailTemplate/Formatter.php +++ b/application/Espo/Tools/EmailTemplate/Formatter.php @@ -73,7 +73,17 @@ class Formatter return ''; } - return (string) $this->language->translateOption($value, $attribute, $entity->getEntityType()); + $label = $this->language->translateOption($value, $attribute, $entity->getEntityType()); + + $translationPath = $this->metadata->get( + ['entityDefs', $entity->getEntityType(), 'fields', $attribute, 'translation'] + ); + + if ($translationPath) { + $label = $this->language->get($translationPath . '.' . $value, $label); + } + + return $label; } if ($fieldType === 'array' || $fieldType === 'multiEnum' || $fieldType === 'checklist') {