Index: wp-includes/l10n.php
===================================================================
--- wp-includes/l10n.php	(revision 32509)
+++ wp-includes/l10n.php	(working copy)
@@ -852,6 +852,7 @@
  *
  * @since 4.0.0
  *
+ * @see get_dropdown_languages()
  * @see get_available_languages()
  * @see wp_get_available_translations()
  *
@@ -869,7 +870,32 @@
  * }
  */
 function wp_dropdown_languages( $args = array() ) {
+	echo get_dropdown_languages( $args );
+}
 
+/**
+ * Generates the markup of the language selector.
+ *
+ * @since 4.3
+ *
+ * @see get_available_languages()
+ * @see wp_get_available_translations()
+ *
+ * @param string|array $args {
+ *     Optional. Array or string of arguments for creating the language selector.
+ *
+ *     @type string  $id                           ID attribute of the select element. Default empty.
+ *     @type string  $name                         Name attribute of the select element. Default empty.
+ *     @type array   $languages                    List of installed languages, contain only the locales.
+ *                                                 Default empty array.
+ *     @type array   $translations                 List of available translations. Default result of
+ *                                                 {@see wp_get_available_translations()}.
+ *     @type string  $selected                     Language which should be selected. Default empty.
+ *     @type bool    $show_available_translations  Whether to show available translations. Default true.
+ * }
+ */
+function get_dropdown_languages( $args = array() ) {
+	$markup = '';
 	$args = wp_parse_args( $args, array(
 		'id'           => '',
 		'name'         => '',
@@ -912,7 +938,7 @@
 
 	$translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
 
-	printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
+	$markup .= sprintf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
 
 	// Holds the HTML markup.
 	$structure = array();
@@ -949,8 +975,7 @@
 		}
 		$structure[] = '</optgroup>';
 	}
-
-	echo join( "\n", $structure );
-
-	echo '</select>';
+	$markup .= join( "\n", $structure );
+	$markup .= '</select>';
+	return $markup;
 }
