diff --git a/core/modules/config_translation/src/FormElement/PluralVariants.php b/core/modules/config_translation/src/FormElement/PluralVariants.php index a71d8fc..ec6b977 100644 --- a/core/modules/config_translation/src/FormElement/PluralVariants.php +++ b/core/modules/config_translation/src/FormElement/PluralVariants.php @@ -25,18 +25,18 @@ protected function getSourceElement(LanguageInterface $source_language, $source_ $values = explode(LOCALE_PLURAL_DELIMITER, $source_config); $element = array( '#type' => 'fieldset', - '#title' => $this->t($this->definition->getLabel()), + '#title' => SafeMarkup::format('@label (@source_language)', array( + '@label' => $this->t($this->definition->getLabel()), + '@source_language' => $source_language->getName(), + )), '#tree' => TRUE, ); for ($i = 0; $i < $plurals; $i++) { - $element[] = array( + $element[$i] = array( '#type' => 'item', - '#title' => SafeMarkup::format('@label (@source_language)', array( - // @todo Should use better labels https://www.drupal.org/node/2499639 - '@label' => $i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form'), - '@source_language' => $source_language->getName(), - )), - '#markup' => SafeMarkup::format('@value', array( + // @todo Should use better labels https://www.drupal.org/node/2499639 + '#title' => $i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form'), + '#markup' => SafeMarkup::format('@value', array( '@langcode' => $source_language->getId(), '@value' => isset($values[$i]) ? $values[$i] : $this->t('(Empty)'), )), @@ -53,17 +53,17 @@ protected function getTranslationElement(LanguageInterface $translation_language $values = explode(LOCALE_PLURAL_DELIMITER, $translation_config); $element = array( '#type' => 'fieldset', - '#title' => $this->t($this->definition->getLabel()), + '#title' => SafeMarkup::format('@label (@translation_language)', array( + '@label' => $this->t($this->definition->getLabel()), + '@translation_language' => $translation_language->getName(), + )), '#tree' => TRUE, ); for ($i = 0; $i < $plurals; $i++) { - $element[] = array( + $element[$i] = array( '#type' => 'textfield', - '#title' => SafeMarkup::format('@label (@translation_language)', array( - // @todo Should use better labels https://www.drupal.org/node/2499639 - '@label' => $i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form'), - '@translation_language' => $translation_language->getName(), - )), + // @todo Should use better labels https://www.drupal.org/node/2499639 + '#title' => $i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form'), '#default_value' => isset($values[$i]) ? $values[$i] : '', '#attributes' => array('lang' => $translation_language->getId()), );