diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index b3fd356..8b17713 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -56,7 +56,7 @@ label: label: 'Label' translatable: true -# Translatable plural string +# String containing singular and plural forms, separated by EXT. plural_string: type: string label: 'Plural string' diff --git a/core/modules/config_translation/src/FormElement/PluralString.php b/core/modules/config_translation/src/FormElement/PluralString.php index 15d88dc..c86626d 100644 --- a/core/modules/config_translation/src/FormElement/PluralString.php +++ b/core/modules/config_translation/src/FormElement/PluralString.php @@ -31,11 +31,14 @@ protected function getSourceElement(LanguageInterface $source_language, $source_ for ($i = 0; $i < 2; $i++) { $element[] = array( '#type' => 'item', - '#title' => $this->t('@label (@source_language)', array( - '@label' => ($i == 0 ? 'Singular form' : 'Plural form'), + '#title' => SafeMarkup::format('@label (@source_language)', array( + '@label' => $i == 0 ? $this->t('Singular form') : $this->t('Plural form'), '@source_language' => $source_language->getName(), )), - '#markup' => '' . SafeMarkup::format($values[$i]) . '', + '#markup' => SafeMarkup::format('@value', array( + '@langcode' => $source_language->getId(), + '@value' => $values[$i] + )), ); } return $element; @@ -55,8 +58,8 @@ protected function getTranslationElement(LanguageInterface $translation_language for ($i = 0; $i < $plurals; $i++) { $element[] = array( '#type' => 'textfield', - '#title' => $this->t('@label (@source_language)', array( - '@label' => ($i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form')), + '#title' => SafeMarkup::format('@label (@source_language)', array( + '@label' => $i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form'), '@source_language' => $translation_language->getName(), )), '#default_value' => isset($values[$i]) ? $values[$i] : '', diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php index c236d67..172bc8e 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php @@ -624,7 +624,6 @@ public function testPluralConfigStrings() { 'langcode' => 'sl', 'files[file]' => $name, ), t('Import')); - drupal_unlink($name); // Translate the files view, as this one uses numeric formatters. $description = 'Singular form';