函数原型
get_translations_for_domain( string $domain ): Translations|NOOP_Translations
函数描述
Returns the Translations instance for a text domain.
是否弃用
未弃用
函数参数
-
$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 | Description |
|---|---|
| 2.8.0 | Introduced. |

