Translations::add_entry_or_merge() WordPress Method

The Translations::add_entry_or_merge() method is used to add or update a translation for a given key. If the key already exists, the new translation will be merged with the existing one.

Translations::add_entry_or_merge( array|Translation_Entry $entry ) #


Parameters

$entry

(array|Translation_Entry)(Required)


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/pomo/translations.php

		public function add_entry_or_merge( $entry ) {
			if ( is_array( $entry ) ) {
				$entry = new Translation_Entry( $entry );
			}
			$key = $entry->key();
			if ( false === $key ) {
				return false;
			}
			if ( isset( $this->entries[ $key ] ) ) {
				$this->entries[ $key ]->merge_with( $entry );
			} else {
				$this->entries[ $key ] = &$entry;
			}
			return true;
		}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.