Index: src/wp-includes/comment-template.php
===================================================================
--- src/wp-includes/comment-template.php	(revision 52069)
+++ src/wp-includes/comment-template.php	(working copy)
@@ -2357,9 +2357,6 @@
 	$required_attribute = ( $html5 ? ' required' : ' required="required"' );
 	$checked_attribute  = ( $html5 ? ' checked' : ' checked="checked"' );
 
-	// Identify required fields visually.
-	$required_indicator = ' <span class="required" aria-hidden="true">*</span>';
-
 	$fields = array(
 		'author' => sprintf(
 			'<p class="comment-form-author">%s %s</p>',
@@ -2366,7 +2363,7 @@
 			sprintf(
 				'<label for="author">%s%s</label>',
 				__( 'Name' ),
-				( $req ? $required_indicator : '' )
+				( $req ? wp_required_field_indicator() : '' )
 			),
 			sprintf(
 				'<input id="author" name="author" type="text" value="%s" size="30" maxlength="245"%s />',
@@ -2379,7 +2376,7 @@
 			sprintf(
 				'<label for="email">%s%s</label>',
 				__( 'Email' ),
-				( $req ? $required_indicator : '' )
+				( $req ? wp_required_field_indicator() : '' )
 			),
 			sprintf(
 				'<input id="email" name="email" %s value="%s" size="30" maxlength="100" aria-describedby="email-notes"%s />',
@@ -2423,12 +2420,6 @@
 		}
 	}
 
-	$required_text = sprintf(
-		/* translators: %s: Asterisk symbol (*). */
-		' <span class="comment-required-message" aria-hidden="true">' . __( 'Required fields are marked %s' ) . '</span>',
-		trim( $required_indicator )
-	);
-
 	/**
 	 * Filters the default comment form fields.
 	 *
@@ -2445,7 +2436,7 @@
 			sprintf(
 				'<label for="comment">%s%s</label>',
 				_x( 'Comment', 'noun' ),
-				$required_indicator
+				wp_required_field_indicator()
 			),
 			'<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525"' . $required_attribute . '></textarea>'
 		),
@@ -2470,7 +2461,7 @@
 				/** This filter is documented in wp-includes/link-template.php */
 				wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
 			),
-			$required_text
+			wp_required_field_message()
 		),
 		'comment_notes_before' => sprintf(
 			'<p class="comment-notes">%s%s</p>',
@@ -2478,7 +2469,7 @@
 				'<span id="email-notes">%s</span>',
 				__( 'Your email address will not be published.' )
 			),
-			$required_text
+			wp_required_field_message()
 		),
 		'comment_notes_after'  => '',
 		'action'               => site_url( '/wp-comments-post.php' ),
Index: src/wp-includes/functions.php
===================================================================
--- src/wp-includes/functions.php	(revision 52069)
+++ src/wp-includes/functions.php	(working copy)
@@ -8328,3 +8328,50 @@
 function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
 	return abs( (float) $expected - (float) $actual ) <= $precision;
 }
+
+/**
+ * Assign a visual indicator for required form fields.
+ *
+ * @since 6.0.0
+ *
+ * @param string $space_before Space character, entity or empty string to add before glyph. Default ' '.
+ * @param bool   $echo         Whether to output the result or instead return it. Default false.
+ * @return string Indicator glyph wrapped in a `span` tag.
+ */
+function wp_required_field_indicator( $space_before = ' ', $echo = false ) {
+	/* translators: Character to identify required form fields. */
+	$glyph     = __( '*' ); // Can be filtered, too (see #23870).
+	$indicator = sprintf(
+		'%1$s<span class="required" aria-hidden="true">%2$s</span>',
+		esc_html( $space_before ),
+		esc_html( $glyph ),
+	);
+
+	if ( ! $echo ) {
+		return $indicator;
+	}
+	echo $indicator;
+}
+
+/**
+ * Create a message to explain required form fields.
+ *
+ * @since 6.0.0
+ *
+ * @param string $space_before Space character, entity or empty string to add before glyph. Default ' '.
+ * @param bool   $echo         Whether to output the result or instead return it. Default false.
+ * @return string Message text and glyph wrapped in a `span` tag.
+ */
+function wp_required_field_message( $space_before = ' ', $echo = false ) {
+	$message = sprintf(
+		'%1$s<span class="required-field-message" aria-hidden="true">%2$s</span>',
+		esc_html( $space_before ),
+		/* translators: %s: Asterisk symbol (*). */
+		sprintf( __( 'Required fields are marked %s' ), wp_required_field_indicator( '' ) ),
+	);
+
+	if ( ! $echo ) {
+		return $message;
+	}
+	echo $message;
+}
