switch_to_locale() WP 1.0
Switches the translations according to the given locale.
Works based on: WP_Locale_Switcher::switch_to_locale()
No Hooks.
Return
true/false. True on success, false on failure.
Usage
switch_to_locale( $locale );
- $locale(string) (required)
- The locale.
Notes
- Global. WP_Locale_Switcher. $wp_locale_switcher WordPress locale switcher object.
Changelog
Since 4.7.0 | Introduced. |
Code of switch_to_locale() switch to locale WP 5.6
function switch_to_locale( $locale ) {
/* @var WP_Locale_Switcher $wp_locale_switcher */
global $wp_locale_switcher;
return $wp_locale_switcher->switch_to_locale( $locale );
}