From 5830c2fc8dffebf7a90498358bd2fda54752d243 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 15 Mar 2016 11:52:13 +0000
Subject: [PATCH] Issue #2609874 by tstoeckler, Kristen Pol, tassilogroeper:
 Boolean field "On label" and "Off label" are not translatable

(cherry picked from commit 96dc18e81424eedd8b6dbf7967c0fdc49ad46c63)
(cherry picked from commit b96fc994dfd7c4952596a3b988900f52ce01dfaa)
---
 core/config/schema/core.data_types.schema.yml |  4 +-
 .../src/Tests/ConfigTranslationUiTest.php     | 37 +++++++++++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml
index 4ab0fd769c3d..c6aca3615b23 100644
--- a/core/config/schema/core.data_types.schema.yml
+++ b/core/config/schema/core.data_types.schema.yml
@@ -605,10 +605,10 @@ field.field_settings.boolean:
   type: mapping
   mapping:
     on_label:
-      type: string
+      type: label
       label: 'On label'
     off_label:
-      type: string
+      type: label
       label: 'Off label'
 
 field.value.boolean:
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
index a718808f02e2..d2964745ca3f 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\config_translation\Tests;
 
 use Drupal\Component\Serialization\Json;
+use Drupal\Component\Utility\Html;
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\Language;
@@ -733,6 +734,42 @@ public function testFieldConfigTranslation() {
     $this->assertEscaped($translatable_storage_setting);
   }
 
+  /**
+   * Tests the translation of a boolean field settings.
+   */
+  public function testBooleanFieldConfigTranslation() {
+    // Add a test boolean field.
+    $field_name = strtolower($this->randomMachineName());
+    FieldStorageConfig::create([
+      'field_name' => $field_name,
+      'entity_type' => 'entity_test',
+      'type' => 'boolean',
+    ])->save();
+
+    $bundle = strtolower($this->randomMachineName());
+    entity_test_create_bundle($bundle);
+    $field = FieldConfig::create([
+      'field_name' => $field_name,
+      'entity_type' => 'entity_test',
+      'bundle' => $bundle,
+    ]);
+
+    $on_label = $this->randomString();
+    $field->setSetting('on_label', $on_label);
+    $off_label = $this->randomString();
+    $field->setSetting('off_label', $off_label);
+    $field->save();
+
+    $this->drupalLogin($this->translatorUser);
+
+    $this->drupalGet("/entity_test/structure/$bundle/fields/entity_test.$bundle.$field_name/translate");
+    $this->clickLink('Add');
+
+    $this->assertText(Html::escape($on_label) . ' Boolean settings');
+    $this->assertEscaped($on_label);
+    $this->assertEscaped($off_label);
+  }
+
   /**
    * Test translation storage in locale storage.
    */
-- 
GitLab