diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml
index 8b17713..93743e4 100644
--- a/core/config/schema/core.data_types.schema.yml
+++ b/core/config/schema/core.data_types.schema.yml
@@ -56,11 +56,10 @@ label:
label: 'Label'
translatable: true
-# String containing singular and plural forms, separated by EXT.
-plural_string:
- type: string
- label: 'Plural string'
- translatable: true
+# String containing plural variants, separated by EXT.
+plural_label:
+ type: label
+ label: 'Plural variants'
# Internal Drupal path
path:
diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module
index 91350c7..3c81f78 100644
--- a/core/modules/config_translation/config_translation.module
+++ b/core/modules/config_translation/config_translation.module
@@ -188,7 +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',
+ 'plural_label' => '\Drupal\config_translation\FormElement\PluralVariants',
);
// 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
deleted file mode 100644
index 99e4cbf..0000000
--- a/core/modules/config_translation/src/FormElement/PluralString.php
+++ /dev/null
@@ -1,81 +0,0 @@
-getNumberOfPlurals($source_language->getId());
- $values = explode(LOCALE_PLURAL_DELIMITER, $source_config);
- $element = array(
- '#type' => 'fieldset',
- '#title' => $this->t($this->definition->getLabel()),
- '#tree' => TRUE,
- );
- for ($i = 0; $i < $plurals; $i++) {
- $element[] = array(
- '#type' => 'item',
- '#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' => $source_language->getName(),
- )),
- '#markup' => SafeMarkup::format('@value', array(
- '@langcode' => $source_language->getId(),
- '@value' => $values[$i] ?: $this->t('(Empty)'),
- )),
- );
- }
- 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[] = array(
- '#type' => 'textfield',
- '#title' => SafeMarkup::format('@label (@translation_language)', array(
- '@label' => $i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form'),
- '@translation_language' => $translation_language->getName(),
- )),
- '#default_value' => isset($values[$i]) ? $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/config_translation/src/FormElement/PluralVariants.php b/core/modules/config_translation/src/FormElement/PluralVariants.php
new file mode 100644
index 0000000..c7c6a88
--- /dev/null
+++ b/core/modules/config_translation/src/FormElement/PluralVariants.php
@@ -0,0 +1,82 @@
+getNumberOfPlurals($source_language->getId());
+ $values = explode(LOCALE_PLURAL_DELIMITER, $source_config);
+ $element = array(
+ '#type' => 'fieldset',
+ '#title' => $this->t($this->definition->getLabel()),
+ '#tree' => TRUE,
+ );
+ for ($i = 0; $i < $plurals; $i++) {
+ $element[] = 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(
+ '@langcode' => $source_language->getId(),
+ '@value' => $values[$i] ?: $this->t('(Empty)'),
+ )),
+ );
+ }
+ 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[] = 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(),
+ )),
+ '#default_value' => isset($values[$i]) ? $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/locale/src/Form/TranslateEditForm.php b/core/modules/locale/src/Form/TranslateEditForm.php
index 44e86e7..bac65c7 100644
--- a/core/modules/locale/src/Form/TranslateEditForm.php
+++ b/core/modules/locale/src/Form/TranslateEditForm.php
@@ -123,6 +123,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
for ($i = 0; $i < $plurals; $i++) {
$form['strings'][$string->lid]['translations'][$i] = array(
'#type' => 'textarea',
+ // @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')),
'#rows' => $rows,
'#default_value' => isset($translation_array[$i]) ? $translation_array[$i] : '',
diff --git a/core/modules/views/config/schema/views.field.schema.yml b/core/modules/views/config/schema/views.field.schema.yml
index 39a21d8..58d4c0d 100644
--- a/core/modules/views/config/schema/views.field.schema.yml
+++ b/core/modules/views/config/schema/views.field.schema.yml
@@ -117,8 +117,8 @@ views.field.numeric:
type: boolean
label: 'Format plural'
format_plural_string:
- type: plural_string
- label: 'Singular and one or more plurals'
+ type: plural_label
+ label: 'Plural variants'
prefix:
type: label
label: 'Prefix'
diff --git a/core/modules/views/src/Plugin/views/field/NumericField.php b/core/modules/views/src/Plugin/views/field/NumericField.php
index 70622d1..999a648 100644
--- a/core/modules/views/src/Plugin/views/field/NumericField.php
+++ b/core/modules/views/src/Plugin/views/field/NumericField.php
@@ -102,6 +102,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
for ($i = 0; $i < $plurals; $i++) {
$form['format_plural_values'][$i] = array(
'#type' => 'textfield',
+ // @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($plural_array[$i]) ? $plural_array[$i] : '',
'#description' => $this->t('Text to use for this variant, @count will be replaced with the value.'),