_n_noop

Definition:
function _n_noop( $singular, $plural ) {}

Register plural strings in POT file, but don’t translate them.
Used when you want to keep structures with translatable plural strings and use them later.

Parameters

  • string $singular: Single form to be i18ned
  • string $plural: Plural form to be i18ned

Return values

returns:array($singular, $plural)

Source code

function _n_noop( $singular, $plural ) {

	return array( 0 => $singular, 1 => $plural, 'singular' => $singular, 'plural' => $plural, 'context' => null );

}

4349

_nx_noop

Definition:
function _nx_noop( $singular, $plural, $context ) {}

Register plural strings with context in POT file, but don’t translate them.

Parameters

  • $singular
  • $plural
  • $context

Source code

function _nx_noop( $singular, $plural, $context ) {

	return array( 0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context );

}

4347

_nx

Definition:
function _nx($single, $plural, $number, $context, $domain = 'default') {}

A hybrid of _n() and _x(). It supports contexts and plurals.

Parameters

  • $single
  • $plural
  • $number
  • $context
  • $domain

Defined filters

  • ngettext_with_context
    apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain )

Source code

function _nx($single, $plural, $number, $context, $domain = 'default') {

	$translations = &get_translations_for_domain( $domain );

	$translation = $translations->translate_plural( $single, $plural, $number, $context );

	return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );

}

4345

_nc

Definition:
function _nc( $single, $plural, $number, $domain = 'default' ) {}

A version of _n(), which supports contexts.
Strips everything from the translation after the last bar.

Parameters

  • $single
  • $plural
  • $number
  • $domain

Source code

function _nc( $single, $plural, $number, $domain = 'default' ) {

	_deprecated_function( __FUNCTION__, '2.9', '_nx()' );

	return before_last_bar( _n( $single, $plural, $number, $domain ) );

}

4343

_n

Definition:
function _n( $single, $plural, $number, $domain = 'default' ) {}

Retrieve the plural or single form based on the amount.
If the domain is not set in the $l10n list, then a comparison will be made and either $plural or $single parameters returned.

Parameters

  • string $single: The text that will be used if $number is 1
  • string $plural: The text that will be used if $number is not 1
  • int $number: The number to compare against to use either $single or $plural
  • string $domain: Optional. The domain identifier the text should be retrieved in

Return values

returns:Either $single or $plural translated text

Defined filters

  • ngettext
    apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain )

Source code

function _n( $single, $plural, $number, $domain = 'default' ) {

	$translations = &get_translations_for_domain( $domain );

	$translation = $translations->translate_plural( $single, $plural, $number );

	return apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );

}

4341