WordPress at a glance
function is not described

WP_Locale_Switcher::restore_previous_locale() public WP 4.7.0

Restores the translations according to the previous locale.

It's a method of the class: WP_Locale_Switcher{}

Hooks from the method
Return

String/false. Locale on success, false on failure.

Usage

$WP_Locale_Switcher = new WP_Locale_Switcher();
$WP_Locale_Switcher->restore_previous_locale();

Changelog

Since 4.7.0 Introduced.

Code of WP_Locale_Switcher::restore_previous_locale() WP 5.5.1

<?php
public function restore_previous_locale() {
	$previous_locale = array_pop( $this->locales );

	if ( null === $previous_locale ) {
		// The stack is empty, bail.
		return false;
	}

	$locale = end( $this->locales );

	if ( ! $locale ) {
		// There's nothing left in the stack: go back to the original locale.
		$locale = $this->original_locale;
	}

	$this->change_locale( $locale );

	/**
	 * Fires when the locale is restored to the previous one.
	 *
	 * @since 4.7.0
	 *
	 * @param string $locale          The new locale.
	 * @param string $previous_locale The previous locale.
	 */
	do_action( 'restore_previous_locale', $locale, $previous_locale );

	return $locale;
}