WordPress at a glance

get_translations_for_domain() WP 1.0

Return the Translations instance for a text domain.

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

  • Global. MO[]. $l10n
  • Static. NOOP_Translations. $noop_translations
Is the basis for: translate()
✈ 1 time = 0.000001s = speed of light | 50000 times = 0.43s = very fast | PHP 7.2.16, WP 5.1.1

No Hooks.

Return

Translations/NOOP_Translations. A Translations instance.

Usage

get_translations_for_domain( $domain );
$domain(string) (required)
Text domain. Unique identifier for retrieving translated strings.

Code of get translations for domain: wp-includes/l10n.php WP 5.2.2

<?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;
}

Related Functions

From tag: textdomain (mo po files)

More from category: Localization

No comments
    Hello, !     Log In . Register