class NOOP_Translations {}

In this article

Methods

NameDescription
NOOP_Translations::add_entry
NOOP_Translations::get_headerReturns a translation header.
NOOP_Translations::get_plural_forms_countReturns the plural forms count.
NOOP_Translations::merge_withMerges other translations into the current one.
NOOP_Translations::select_plural_formReturns the plural form to use.
NOOP_Translations::set_headerSets a translation header.
NOOP_Translations::set_headersSets translation headers.
NOOP_Translations::translateTranslates a singular string.
NOOP_Translations::translate_entryReturns a given translation entry.
NOOP_Translations::translate_pluralTranslates a plural string.

Source

class NOOP_Translations {
	/**
	 * List of translation entries.
	 *
	 * @since 2.8.0
	 *
	 * @var Translation_Entry[]
	 */
	public $entries = array();

	/**
	 * List of translation headers.
	 *
	 * @since 2.8.0
	 *
	 * @var array<string, string>
	 */
	public $headers = array();

	public function add_entry( $entry ) {
		return true;
	}

	/**
	 * Sets a translation header.
	 *
	 * @since 2.8.0
	 *
	 * @param string $header
	 * @param string $value
	 */
	public function set_header( $header, $value ) {
	}

	/**
	 * Sets translation headers.
	 *
	 * @since 2.8.0
	 *
	 * @param array $headers
	 */
	public function set_headers( $headers ) {
	}

	/**
	 * Returns a translation header.
	 *
	 * @since 2.8.0
	 *
	 * @param string $header
	 * @return false
	 */
	public function get_header( $header ) {
		return false;
	}

	/**
	 * Returns a given translation entry.
	 *
	 * @since 2.8.0
	 *
	 * @param Translation_Entry $entry
	 * @return false
	 */
	public function translate_entry( &$entry ) {
		return false;
	}

	/**
	 * Translates a singular string.
	 *
	 * @since 2.8.0
	 *
	 * @param string $singular
	 * @param string $context
	 */
	public function translate( $singular, $context = null ) {
		return $singular;
	}

	/**
	 * Returns the plural form to use.
	 *
	 * @since 2.8.0
	 *
	 * @param int $count
	 * @return int
	 */
	public function select_plural_form( $count ) {
		return 1 === (int) $count ? 0 : 1;
	}

	/**
	 * Returns the plural forms count.
	 *
	 * @since 2.8.0
	 *
	 * @return int
	 */
	public function get_plural_forms_count() {
		return 2;
	}

	/**
	 * Translates a plural string.
	 *
	 * @since 2.8.0
	 *
	 * @param string $singular
	 * @param string $plural
	 * @param int    $count
	 * @param string $context
	 * @return string
	 */
	public function translate_plural( $singular, $plural, $count, $context = null ) {
		return 1 === (int) $count ? $singular : $plural;
	}

	/**
	 * Merges other translations into the current one.
	 *
	 * @since 2.8.0
	 *
	 * @param Translations $other
	 */
	public function merge_with( &$other ) {
	}
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.