get_translations_for_domain

函式
get_translations_for_domain ( $domain )
引數
  • (string) $domain Text domain. Unique identifier for retrieving translated strings.
    Required:
返回值
  • (Translations|NOOP_Translations) A Translations instance.
定義位置
相關方法
get_admin_users_for_domaintranslations_api_get_path_to_translation_from_lang_dirwp_get_translation_updateslist_translation_updates
引入
2.8.0
棄用
-

get_translations_for_domain: 這個函式檢索一個特定文字域的翻譯。它接收一個文字域作為引數,並返回一個翻譯陣列,其中鍵是原始字串,值是翻譯後的字串。

返回一個文字域的翻譯例項。

如果沒有,則返回空的翻譯例項。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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;
}

常見問題

FAQs
檢視更多 >