WP_Locale_Switcher::change_locale() private WP 4.7.0
Changes the site's locale to the given one.
Loads the translations, changes the global $wp_locale object and updates all post type labels.
{} Это метод класса: WP_Locale_Switcher{}
Хуки из метода
Возвращает
Null. Ничего.
Использование
// private - только в коде основоного (родительского) класса $result = $this->change_locale( $locale );
- $locale(строка) (обязательный)
- The locale to change to.
Заметки
- Global. WP_Locale. $wp_locale WordPress date and time locale object.
Список изменений
С версии 4.7.0 | Введена. |
Код WP_Locale_Switcher::change_locale() WP Locale Switcher::change locale WP 5.6.2
private function change_locale( $locale ) {
// Reset translation availability information.
_get_path_to_translation( null, true );
$this->load_translations( $locale );
$GLOBALS['wp_locale'] = new WP_Locale();
/**
* Fires when the locale is switched to or restored.
*
* @since 4.7.0
*
* @param string $locale The new locale.
*/
do_action( 'change_locale', $locale );
}