diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php index 97acbb1..cc833c5 100644 --- a/core/modules/locale/src/LocaleConfigManager.php +++ b/core/modules/locale/src/LocaleConfigManager.php @@ -167,21 +167,16 @@ protected function getTranslatableData(TypedDataInterface $element) { } } else { + // Something is only translatable by Locale if there is a string in the + // first place. + $value = $element->getValue(); $definition = $element->getDataDefinition(); - if (!empty($definition['translatable'])) { + if (!empty($definition['translatable']) && $value !== '' && $value !== NULL) { $options = array(); if (isset($definition['translation context'])) { $options['context'] = $definition['translation context']; } - // Something is only translatable by Locale if there is a string in the - // first place. - $value = $element->getValue(); - if ($value === '' || $value === NULL) { - return NULL; - } - else { - return new TranslatableMarkup($element->getValue(), array(), $options); - } + return new TranslatableMarkup($value, array(), $options); } } return $translatable;