translate_nooped_plural

Advertisement

Summery Summery

Translates and retrieves the singular or plural form of a string that’s been registered with _n_noop() or _nx_noop().

Syntax Syntax

translate_nooped_plural( array $nooped_plural, int $count, string $domain = 'default' )

Description Description

Used when you want to use a translatable plural string once the number is known.

Example:

$message = _n_noop( '%s post', '%s posts', 'text-domain' );
...
printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) );

Parameters Parameters

$nooped_plural

(Required) Array with singular, plural, and context keys, usually the result of _n_noop() or _nx_noop().

$count

(Required) Number of objects.

$domain

(Optional) Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains a text domain passed to _n_noop() or _nx_noop(), it will override this value. Default 'default'.

Default value: 'default'

Return Return

(string) Either $single or $plural translated text.

Source Source

File: wp-includes/l10n.php

		'context'  => null,
		'domain'   => $domain,
	);
}

/**
 * Registers plural strings with gettext context in POT file, but does not translate them.
 *
 * Used when you want to keep structures with translatable plural
 * strings and use them later when the number is known.
 *

Advertisement

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Advertisement

Leave a Reply