diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml
index 4968087..c3f9fd1 100644
--- a/core/config/schema/core.data_types.schema.yml
+++ b/core/config/schema/core.data_types.schema.yml
@@ -56,6 +56,12 @@ label:
label: 'Label'
translatable: true
+# Translatable plural string
+plural_string:
+ type: string
+ label: 'Plural string'
+ translatable: true
+
# Internal Drupal path
path:
type: string
diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module
index ea4e532..02da186 100644
--- a/core/modules/config_translation/config_translation.module
+++ b/core/modules/config_translation/config_translation.module
@@ -188,6 +188,7 @@ function config_translation_config_schema_info_alter(&$definitions) {
'text_format' => '\Drupal\config_translation\FormElement\TextFormat',
'mapping' => '\Drupal\config_translation\FormElement\ListElement',
'sequence' => '\Drupal\config_translation\FormElement\ListElement',
+ 'plural_string' => '\Drupal\config_translation\FormElement\PluralString',
);
// Enhance the text and date type definitions with classes to generate proper
diff --git a/core/modules/config_translation/src/FormElement/PluralString.php b/core/modules/config_translation/src/FormElement/PluralString.php
new file mode 100644
index 0000000..da216ee
--- /dev/null
+++ b/core/modules/config_translation/src/FormElement/PluralString.php
@@ -0,0 +1,75 @@
+ 'fieldset',
+ '#title' => $this->t($this->definition->getLabel()),
+ '#tree' => TRUE,
+ );
+ for ($i = 0; $i < 2; $i++) {
+ $element[] = array(
+ '#type' => 'item',
+ '#title' => $this->t('!label (!source_language)', array(
+ '!label' => ($i == 0 ? 'Singular form' : 'Plural form'),
+ '!source_language' => $source_language->getName(),
+ )),
+ '#markup' => '' . nl2br($values[$i]) . '',
+ );
+ }
+ return $element;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
+ $plurals = $this->getNumberOfPlurals($translation_language->getId());
+ $values = explode(LOCALE_PLURAL_DELIMITER, $translation_config);
+ $element = array(
+ '#type' => 'fieldset',
+ '#title' => $this->t($this->definition->getLabel()),
+ '#tree' => TRUE,
+ );
+ for ($i = 0; $i < $plurals; $i++) {
+ $element[$i] = 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')),
+ '!source_language' => $translation_language->getName(),
+ )),
+ '#default_value' => $values[$i],
+ '#attributes' => array('lang' => $translation_language->getId()),
+ );
+ }
+ return $element;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setConfig(Config $base_config, LanguageConfigOverride $config_translation, $config_values, $base_key = NULL) {
+ $config_values = implode(LOCALE_PLURAL_DELIMITER, $config_values);
+ parent::setConfig($base_config, $config_translation, $config_values, $base_key);
+ }
+
+}
diff --git a/core/modules/views/config/schema/views.field.schema.yml b/core/modules/views/config/schema/views.field.schema.yml
index 1c884fb..39a21d8 100644
--- a/core/modules/views/config/schema/views.field.schema.yml
+++ b/core/modules/views/config/schema/views.field.schema.yml
@@ -117,7 +117,7 @@ views.field.numeric:
type: boolean
label: 'Format plural'
format_plural_string:
- type: label
+ type: plural_string
label: 'Singular and one or more plurals'
prefix:
type: label