get_translations_for_domain

Return the Translations instance for a text domain.

Description

(NOOP_Translations) get_translations_for_domain( (string) $domain ); 

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

Returns (NOOP_Translations)

A Translations instance.

Parameters (1)

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

Usage

  1. if ( !function_exists( 'get_translations_for_domain' ) ) { 
  2. require_once ABSPATH . WPINC . '/l10n.php'; 
  3.  
  4. // Text domain. Unique identifier for retrieving translated strings. 
  5. $domain = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_translations_for_domain($domain); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/l10n.php  
  1. function get_translations_for_domain( $domain ) { 
  2. global $l10n; 
  3. if ( isset( $l10n[ $domain ] ) || ( _load_textdomain_just_in_time( $domain ) && isset( $l10n[ $domain ] ) ) ) { 
  4. return $l10n[ $domain ]; 
  5.  
  6. static $noop_translations = null; 
  7. if ( null === $noop_translations ) { 
  8. $noop_translations = new NOOP_Translations; 
  9.  
  10. return $noop_translations;