translate_nooped_plural()
Translates and returns the singular or plural form of a string that's been registered with _n_noop() or _nx_noop().
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 ) );
Хуков нет.
Возвращает
Строку
. Either $singular or $plural translated text.
Использование
translate_nooped_plural( $nooped_plural, $count, $domain );
- $nooped_plural(массив) (обязательный)
Array that is usually a return value from _n_noop() or _nx_noop().
-
singular(строка)
Singular form to be localized. -
plural(строка)
Plural form to be localized. -
context(строка|null)
Context information for the translators. - domain(строка|null)
Text domain.
-
- $count(int) (обязательный)
- Number of objects.
- $domain(строка)
- 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'
Список изменений
С версии 3.1.0 | Введена. |
Код translate_nooped_plural() translate nooped plural WP 6.7.2
function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) { if ( $nooped_plural['domain'] ) { $domain = $nooped_plural['domain']; } if ( $nooped_plural['context'] ) { return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain ); } else { return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain ); } }