get_translations_for_domain

The timeline below displays how wordpress function get_translations_for_domain has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Returns the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global MO[] $l10n An array of all currently loaded text domains.
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return Translations|NOOP_Translations A Translations instance.
 */
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();
    }
    $l10n[$domain] =& $noop_translations;
    return $noop_translations;
}

WordPress Version: 6.1

/**
 * Returns the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global MO[] $l10n An array of all currently loaded text domains.
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return Translations|NOOP_Translations A Translations instance.
 */
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;
}

WordPress Version: 5.5

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global MO[] $l10n
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return Translations|NOOP_Translations A Translations instance.
 */
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;
}

WordPress Version: 5.1

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global MO[] $l10n
 * @staticvar NOOP_Translations $noop_translations
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return Translations|NOOP_Translations A Translations instance.
 */
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;
}

WordPress Version: 4.7

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global array $l10n
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return Translations|NOOP_Translations A Translations instance.
 */
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;
}

WordPress Version: 4.6

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global array $l10n
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return NOOP_Translations A Translations instance.
 */
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;
}

WordPress Version: 4.5

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global array $l10n
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return NOOP_Translations A Translations instance.
 */
function get_translations_for_domain($domain)
{
    global $l10n;
    if (isset($l10n[$domain])) {
        return $l10n[$domain];
    }
    static $noop_translations = null;
    if (null === $noop_translations) {
        $noop_translations = new NOOP_Translations();
    }
    return $noop_translations;
}

WordPress Version: 4.3

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @global array $l10n
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return NOOP_Translations A Translations instance.
 */
function get_translations_for_domain($domain)
{
    global $l10n;
    if (!isset($l10n[$domain])) {
        $l10n[$domain] = new NOOP_Translations();
    }
    return $l10n[$domain];
}

WordPress Version: 4.1

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return NOOP_Translations A Translations instance.
 */
function get_translations_for_domain($domain)
{
    global $l10n;
    if (!isset($l10n[$domain])) {
        $l10n[$domain] = new NOOP_Translations();
    }
    return $l10n[$domain];
}

WordPress Version: 4.0

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @since 2.8.0
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return Translations A Translations instance.
 */
function get_translations_for_domain($domain)
{
    global $l10n;
    if (!isset($l10n[$domain])) {
        $l10n[$domain] = new NOOP_Translations();
    }
    return $l10n[$domain];
}

WordPress Version: 3.7

/**
 * Return the Translations instance for a text domain.
 *
 * If there isn't one, returns empty Translations instance.
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return Translations A Translations instance.
 */
function get_translations_for_domain($domain)
{
    global $l10n;
    if (!isset($l10n[$domain])) {
        $l10n[$domain] = new NOOP_Translations();
    }
    return $l10n[$domain];
}