wppaste
WordPress

Translation_Entry

Since
2.8.0
Source
wp-includes/pomo/entry.php:16
Translation_Entry class encapsulates a translatable string.

Compatibility

WordPress
since 2.8.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 9

$is_pluralboolpublic
Whether the entry contains a string and its plural form, default is false.
$contextpublic
$singularpublic
$pluralpublic
$translationspublic
$translator_commentspublic
$extracted_commentspublic
$referencespublic
$flagspublic

Methods · 4

Source code

	#[AllowDynamicProperties]	class Translation_Entry { 		/**		 * Whether the entry contains a string and its plural form, default is false.		 *		 * @var bool		 */		public $is_plural = false; 		public $context             = null;		public $singular            = null;		public $plural              = null;		public $translations        = array();		public $translator_comments = '';		public $extracted_comments  = '';		public $references          = array();		public $flags               = array(); 		/**		 * @param array $args {		 *     Arguments array, supports the following keys:		 *		 *     @type string $singular            The string to translate, if omitted an		 *                                       empty entry will be created.		 *     @type string $plural              The plural form of the string, setting		 *                                       this will set `$is_plural` to true.		 *     @type array  $translations        Translations of the string and possibly		 *                                       its plural forms.		 *     @type string $context             A string differentiating two equal strings		 *                                       used in different contexts.		 *     @type string $translator_comments Comments left by translators.		 *     @type string $extracted_comments  Comments left by developers.		 *     @type array  $references          Places in the code this string is used, in		 *                                       relative_to_root_path/file.php:linenum form.		 *     @type array  $flags               Flags like php-format.		 * }		 */		public function __construct( $args = array() ) {			// If no singular -- empty object.			if ( ! isset( $args['singular'] ) ) {				return;			}			// Get member variable values from args hash.			foreach ( $args as $varname => $value ) {				$this->$varname = $value;			}			if ( isset( $args['plural'] ) && $args['plural'] ) {				$this->is_plural = true;			}			if ( ! is_array( $this->translations ) ) {				$this->translations = array();			}			if ( ! is_array( $this->references ) ) {				$this->references = array();			}			if ( ! is_array( $this->flags ) ) {				$this->flags = array();			}		} 		/**		 * PHP4 constructor.		 *		 * @since 2.8.0		 * @deprecated 5.4.0 Use __construct() instead.		 *		 * @see Translation_Entry::__construct()		 */		public function Translation_Entry( $args = array() ) {			_deprecated_constructor( self::class, '5.4.0', static::class );			self::__construct( $args );		} 		/**		 * Generates a unique key for this entry.		 *		 * @since 2.8.0		 *		 * @return string|false The key or false if the entry is null.

Changelog

Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/pomo/entry.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.