diff --git a/potx.inc b/potx.inc
index 25c7575..a82f272 100644
--- a/potx.inc
+++ b/potx.inc
@@ -2439,8 +2439,12 @@ function _potx_replace_variable($value, $data) {
       return $value;
     }
     elseif (!$parts) {
+      $value = $data[$name];
+      if (is_bool($value)) {
+        $value = (int) $value;
+      }
       // If no more parts left, this is the final property.
-      return (string)$data[$name];
+      return (string) $value;
     }
     else {
       $data = $data[$name];
diff --git a/tests/drupal8/config/install/test.settings.yml b/tests/drupal8/config/install/test.settings.yml
index bc16848..63cc355 100644
--- a/tests/drupal8/config/install/test.settings.yml
+++ b/tests/drupal8/config/install/test.settings.yml
@@ -58,6 +58,9 @@ complex_variable:
   key1:
     key2: 'text'
   value: 'Complex variable test'
+test_boolean_based_variable:
+  boolean: false
+  value: 'Test boolean based variable'
 
 # tests for plural source strings
 plural_string: "1 place\x03@count places"
diff --git a/tests/drupal8/config/schema/test.schema.yml b/tests/drupal8/config/schema/test.schema.yml
index efdd275..5bc4781 100644
--- a/tests/drupal8/config/schema/test.schema.yml
+++ b/tests/drupal8/config/schema/test.schema.yml
@@ -45,3 +45,5 @@ test.settings:
       type: plural_string
     plural_string_with_context:
       type: plural_string_with_context
+    test_boolean_based_variable:
+      type: test_boolean_based_variable
diff --git a/tests/drupal8/config/schema/test.variables.schema.yml b/tests/drupal8/config/schema/test.variables.schema.yml
index d9fb11f..8e417bb 100644
--- a/tests/drupal8/config/schema/test.variables.schema.yml
+++ b/tests/drupal8/config/schema/test.variables.schema.yml
@@ -46,3 +46,14 @@ complex_variable:
           type: string
     value:
       type: variable.[%parent.key1.key2]
+
+test_boolean_based_variable:
+  type: mapping
+  mapping:
+    boolean:
+      type: boolean
+    value:
+      type: test_boolean_based_variable.[%parent.boolean]
+
+test_boolean_based_variable.0:
+  type: label
diff --git a/tests/potx.test b/tests/potx.test
index 8e14e81..4583733 100644
--- a/tests/potx.test
+++ b/tests/potx.test
@@ -476,6 +476,8 @@ class PotxTestCase extends DrupalWebTestCase {
 
     $this->assertPluralID('1 place', '@count places');
     $this->assertPluralID('1 comment', '@count comments', 'Test context');
+
+    $this->assertMsgID('Test boolean based variable');
   }
 
   /**
