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

返回介绍

get_translations_for_domain()

发布于 2017-09-11 字数 1797 浏览 773 评论 0

get_translations_for_domain( string $domain )

Return the Translations instance for a text domain.


描述

If there isn’t one, returns empty Translations instance.


参数

$domain

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


返回值

(Translations|NOOP_Translations) A Translations instance.


源代码

File: wp-includes/l10n.php

function get_translations_for_domain( $domain ) {
	global $l10n;
	if ( isset( $l10n[ $domain ] ) || ( _load_textdomain_just_in_time( $domain ) && isset( $l10n[ $domain ] ) ) ) {
		return $l10n[ $domain ];
	}

	static $noop_translations = null;
	if ( null === $noop_translations ) {
		$noop_translations = new NOOP_Translations;
	}

	return $noop_translations;
}

更新日志

Version 描述
2.8.0 Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    _load_textdomain_just_in_time()

Used By

  • wp-includes/class-wp-locale-switcher.php:
    WP_Locale_Switcher::load_translations()
  • wp-includes/l10n.php:
    translate()
  • wp-includes/l10n.php:
    translate_with_gettext_context()
  • wp-includes/l10n.php:
    _n()
  • wp-includes/l10n.php:
    _nx()

User Contributed Notes

上一篇:get_transient()

下一篇:get_udims()

发布评论

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

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