函数原型
switch_to_locale( string $locale ): bool
函数描述
Switches the translations according to the given locale.
是否弃用
未弃用
函数参数
-
$locale
string
Required - The locale.
函数返回值
bool True on success, false on failure.
函数位置
File: wp-includes/l10n.php.
函数源码
function switch_to_locale( $locale ) {
/* @var WP_Locale_Switcher $wp_locale_switcher */
global $wp_locale_switcher;
return $wp_locale_switcher->switch_to_locale( $locale );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |

