WordPress Version: 6.2
/**
* Switches the translations according to the given locale.
*
* @since 4.7.0
*
* @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object.
*
* @param string $locale The locale.
* @return bool True on success, false on failure.
*/
function switch_to_locale($locale)
{
/* @var WP_Locale_Switcher $wp_locale_switcher */
global $wp_locale_switcher;
if (!$wp_locale_switcher) {
return false;
}
return $wp_locale_switcher->switch_to_locale($locale);
}