WordPress at a glance

switch_to_locale() WP 1.0

Switches the translations according to the given locale.

  • Global. WP_Locale_Switcher. $wp_locale_switcher

No Hooks.


true/false. True on success, false on failure.


switch_to_locale( $locale );
$locale(string) (required)
The locale.

Code of switch to locale: wp-includes/l10n.php WP 5.2.1

function switch_to_locale( $locale ) {
	/* @var WP_Locale_Switcher $wp_locale_switcher */
	global $wp_locale_switcher;

	return $wp_locale_switcher->switch_to_locale( $locale );

Related Functions

From tag: locale (site language)

More from tag: localize (l10n i18n Internationalization localization)

More from category: Localization

No comments
    Hello, !     Log In . Register