unload_textdomain() - WordPress 函数参考中文文档

返回介绍

unload_textdomain()

发布于 2017-09-11 字数2289 浏览 815 评论 0

unload_textdomain( string $domain )

Unload translations for a text domain.


描述


参数

$domain

(string)
(Required)
Text domain. Unique identifier for retrieving translated strings.


返回值

(bool) Whether textdomain was unloaded.


源代码

File: wp-includes/l10n.php

function unload_textdomain( $domain ) {
	global $l10n, $l10n_unloaded;

	$l10n_unloaded = (array) $l10n_unloaded;

	/**
	 * Filters whether to override the text domain unloading.
	 *
	 * @since 3.0.0
	 *
	 * @param bool   $override Whether to override the text domain unloading. Default false.
	 * @param string $domain   Text domain. Unique identifier for retrieving translated strings.
	 */
	$plugin_override = apply_filters( 'override_unload_textdomain', false, $domain );

	if ( $plugin_override ) {
		$l10n_unloaded[ $domain ] = true;

		return true;
	}

	/**
	 * Fires before the text domain is unloaded.
	 *
	 * @since 3.0.0
	 *
	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
	 */
	do_action( 'unload_textdomain', $domain );

	if ( isset( $l10n[$domain] ) ) {
		unset( $l10n[$domain] );

		$l10n_unloaded[ $domain ] = true;

		return true;
	}

	return false;
}

更新日志

Version 描述
3.0.0 Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    override_unload_textdomain
  • wp-includes/l10n.php:
    unload_textdomain
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/plugin.php:
    do_action()

Used By

  • wp-includes/class-wp-locale-switcher.php:
    WP_Locale_Switcher::load_translations()
  • wp-includes/l10n.php:
    load_default_textdomain()
  • wp-includes/functions.php:
    wp_timezone_choice()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!