On this page
Translation_Entry::__construct( array $args = array() )
Parameters
$argsarray Optional-
Arguments array, supports the following keys:
singularstringThe string to translate, if omitted an empty entry will be created.pluralstringThe plural form of the string, setting this will set$is_pluralto true.translationsarrayTranslations of the string and possibly its plural forms.contextstringA string differentiating two equal strings used in different contexts.translator_commentsstringComments left by translators.extracted_commentsstringComments left by developers.referencesarrayPlaces in the code this string is used, in relative_to_root_path/file.php:linenum form.flagsarrayFlags like php-format.
Default:
array()
Source
File: wp-includes/pomo/entry.php. View all references
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();
}
}
Related
Used By
| Used By | Description |
|---|---|
| PO::read_entry() wp-includes/pomo/po.php | |
| Translations::add_entry() wp-includes/pomo/translations.php | Add entry to the PO structure |
| Translations::add_entry_or_merge() wp-includes/pomo/translations.php | |
| Translations::translate() wp-includes/pomo/translations.php | |
| Translations::translate_plural() wp-includes/pomo/translations.php | |
| Translation_Entry::Translation_Entry() wp-includes/pomo/entry.php | PHP4 constructor. |
| MO::make_entry() wp-includes/pomo/mo.php | Build a Translation_Entry from original string and translation strings, found in a MO file |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/translation_entry/__construct